Skip to content

Commit

Permalink
quantum wild cards
Browse files Browse the repository at this point in the history
  • Loading branch information
MathIsFun0 committed Dec 23, 2024
1 parent 7f28169 commit 330fb7a
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
38 changes: 34 additions & 4 deletions lovely/enhancement.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,30 @@ target = "card.lua"
pattern = "if context.scoring_hand[i].ability.name ~= 'Wild Card' then"
match_indent = true
position = "at"
payload = "if context.scoring_hand[i].ability.name ~= 'Wild Card' and not context.scoring_hand[i].config.center.any_suit then"
payload = '''local is_wild = false
for k, _ in pairs(SMODS.get_enhancements(context.scoring_hand[i])) do
print(k)
if k == "m_wild" or G.P_CENTERS[k].any_suit then
is_wild = true
break
end
end
if not is_wild then'''

[[patches]]
[patches.pattern]
target = "card.lua"
pattern = "if context.scoring_hand[i].ability.name == 'Wild Card' then"
match_indent = true
position = "at"
payload = "if context.scoring_hand[i].ability.name == 'Wild Card' or context.scoring_hand[i].config.center.any_suit then"
payload = '''local is_wild = false
for k, _ in pairs(SMODS.get_enhancements(context.scoring_hand[i])) do
if k == "m_wild" or G.P_CENTERS[k].any_suit then
is_wild = true
break
end
end
if is_wild then'''

# Card:get_suit()
[[patches]]
Expand All @@ -73,14 +89,28 @@ target = "card.lua"
pattern = 'if self.ability.name == "Wild Card" then'
match_indent = true
position = "at"
payload = "if self.ability.name == 'Wild Card' or self.config.center.any_suit then"
payload = '''local is_wild = false
for k, _ in pairs(SMODS.get_enhancements(self)) do
if k == "m_wild" or G.P_CENTERS[k].any_suit then
is_wild = true
break
end
end
if is_wild then'''
[[patches]]
[patches.pattern]
target = "card.lua"
pattern = 'if self.ability.name == "Wild Card" and not self.debuff then'
match_indent = true
position = "at"
payload = "if (self.ability.name == 'Wild Card' or self.config.center.any_suit) and not self.debuff then"
payload = '''local is_wild = false
for k, _ in pairs(SMODS.get_enhancements(self)) do
if k == "m_wild" or G.P_CENTERS[k].any_suit then
is_wild = true
break
end
end
if is_wild and not self.debuff then'''

# check_for_unlock
[[patches]]
Expand Down
4 changes: 3 additions & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,9 @@ function SMODS.get_enhancements(card, extra_only)
local eval = G.jokers.cards[i]:calculate_joker({other_card = card, check_enhancement = true})
if eval then
for k, _ in pairs(eval) do
enhancements[k] = true
if G.P_CENTERS[k] then
enhancements[k] = true
end
end
end
end
Expand Down

0 comments on commit 330fb7a

Please sign in to comment.