Skip to content

Commit c5db2f9

Browse files
Make Summoning Check for room
One of those changes made for consistency yknow
1 parent 6703e26 commit c5db2f9

File tree

2 files changed

+62
-59
lines changed

2 files changed

+62
-59
lines changed

items/spectral.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,9 @@ local summoning = {
554554
end,
555555
can_use = function(self, card)
556556
return #G.jokers.cards > 0
557+
and #G.jokers.cards <= G.jokers.config.card_limit
558+
--Prevent use if slots are full and all jokers are eternal (would exceed limit)
559+
and #advanced_find_joker(nil, nil, nil, { "eternal" }, true, "j") < G.jokers.config.card_limit
557560
end,
558561
use = function(self, card, area, copier)
559562
local used_consumable = copier or card

lib/misc.lua

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -55,79 +55,79 @@ function advanced_find_joker(name, rarity, edition, ability, non_debuff, area)
5555
return {}
5656
end
5757
if not area or area == "j" then
58-
for k, v in pairs(G.jokers.cards) do
59-
if v and type(v) == "table" and (non_debuff or not v.debuff) then
60-
local check = 0
61-
if name and v.ability.name == name then
62-
check = check + 1
63-
end
64-
if
65-
edition
66-
and (v.edition and v.edition.key == edition) --[[ make this use safe_get later? if it's possible anyways]]
67-
then
68-
check = check + 1
69-
end
70-
if rarity then
71-
--Passes as valid if rarity matches ANY of the values in the rarity table
72-
for _, a in ipairs(rarity) do
73-
if v.config.center.rarity == a then
74-
check = check + 1
75-
break
58+
for k, v in pairs(G.jokers.cards) do
59+
if v and type(v) == "table" and (non_debuff or not v.debuff) then
60+
local check = 0
61+
if name and v.ability.name == name then
62+
check = check + 1
63+
end
64+
if
65+
edition
66+
and (v.edition and v.edition.key == edition) --[[ make this use safe_get later? if it's possible anyways]]
67+
then
68+
check = check + 1
69+
end
70+
if rarity then
71+
--Passes as valid if rarity matches ANY of the values in the rarity table
72+
for _, a in ipairs(rarity) do
73+
if v.config.center.rarity == a then
74+
check = check + 1
75+
break
76+
end
7677
end
7778
end
78-
end
79-
if ability then
80-
--Only passes if the joker has everything in the ability table
81-
local abilitycheck = true
82-
for _, b in ipairs(ability) do
83-
if not v.ability[b] then
84-
abilitycheck = false
85-
break
79+
if ability then
80+
--Only passes if the joker has everything in the ability table
81+
local abilitycheck = true
82+
for _, b in ipairs(ability) do
83+
if not v.ability[b] then
84+
abilitycheck = false
85+
break
86+
end
87+
end
88+
if abilitycheck then
89+
check = check + 1
8690
end
8791
end
88-
if abilitycheck then
89-
check = check + 1
92+
if check == filter then
93+
table.insert(jokers, v)
9094
end
9195
end
92-
if check == filter then
93-
table.insert(jokers, v)
94-
end
9596
end
9697
end
97-
end
98-
if not area or area = "c" then
99-
for k, v in pairs(G.consumeables.cards) do
100-
if v and type(v) == "table" and (non_debuff or not v.debuff) then
101-
local check = 0
102-
if name and v.ability.name == name then
103-
check = check + 1
104-
end
105-
if
106-
edition
107-
and (v.edition and v.edition.key == edition) --[[ make this use safe_get later? if it's possible anyways]]
108-
then
109-
check = check + 1
110-
end
111-
if ability then
112-
--Only passes if the joker has everything in the ability table
113-
local abilitycheck = true
114-
for _, b in ipairs(ability) do
115-
if not v.ability[b] then
116-
abilitycheck = false
117-
break
118-
end
98+
if not area or area == "c" then
99+
for k, v in pairs(G.consumeables.cards) do
100+
if v and type(v) == "table" and (non_debuff or not v.debuff) then
101+
local check = 0
102+
if name and v.ability.name == name then
103+
check = check + 1
119104
end
120-
if abilitycheck then
105+
if
106+
edition
107+
and (v.edition and v.edition.key == edition) --[[ make this use safe_get later? if it's possible anyways]]
108+
then
121109
check = check + 1
122110
end
123-
end
124-
--Consumables don't have a rarity, so this should ignore it in that case (untested lmfao)
125-
if check == filter then
126-
table.insert(jokers, v)
111+
if ability then
112+
--Only passes if the joker has everything in the ability table
113+
local abilitycheck = true
114+
for _, b in ipairs(ability) do
115+
if not v.ability[b] then
116+
abilitycheck = false
117+
break
118+
end
119+
end
120+
if abilitycheck then
121+
check = check + 1
122+
end
123+
end
124+
--Consumables don't have a rarity, so this should ignore it in that case (untested lmfao)
125+
if check == filter then
126+
table.insert(jokers, v)
127+
end
127128
end
128129
end
129130
end
130-
end
131131
return jokers
132132
end
133133

0 commit comments

Comments
 (0)