Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative edition: Better cardarea support #214

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/overrides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@ function Card:set_edition(edition, immediate, silent)
G.jokers.config.card_limit = G.jokers.config.card_limit - self.edition.card_limit
elseif self.area == G.hand then
G.hand.config.card_limit = G.hand.config.card_limit - self.edition.card_limit
elseif self.area and self.area.config and self.area.config.card_limit then
self.area.config.card_limit = self.area.config.card_limit - self.edition.card_limit
end
end

Expand Down Expand Up @@ -916,7 +918,7 @@ function Card:set_edition(edition, immediate, silent)
self.edition[k] = v
end
if k == 'card_limit' and (self.added_to_deck or self.joker_added_to_deck_but_debuffed or (self.area == G.hand and not self.debuff)) and G.jokers and G.consumeables then
if self.ability.consumeable then
if self.ability.consumeable and self.area == G.consumeables then
G.consumeables.config.card_limit = G.consumeables.config.card_limit + v
elseif self.ability.set == 'Joker' then
G.jokers.config.card_limit = G.jokers.config.card_limit + v
Expand All @@ -929,6 +931,8 @@ function Card:set_edition(edition, immediate, silent)
return true
end
}))
elseif self.area and self.area.config and self.area.config.card_limit then
self.area.config.card_limit = self.area.config.card_limit + self.edition.card_limit
end
end
end
Expand Down
17 changes: 16 additions & 1 deletion lovely/center.toml
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,19 @@ payload = '''
local obj = self.config.center
if obj.calc_dollar_bonus and type(obj.calc_dollar_bonus) == 'function' then
return obj:calc_dollar_bonus(self)
end'''
end'''

# G.FUNCS.buy_from_shop()
[[patches]]
[patches.pattern]
target = "functions/button_callbacks.lua"
pattern = "G.consumeables:emplace(c1)"
position = "at"
match_indent = true
payload = '''
if c1.ability and c1.ability.cardarea and type(c1.ability.cardarea) == 'string' and G[c1.ability.cardarea] and G[c1.ability.cardarea].emplace then
G[c1.ability.cardarea]:emplace(c1)
else
G.consumeables:emplace(c1)
end
'''
13 changes: 10 additions & 3 deletions lovely/edition.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ if true then
self.ability.joker_added_to_deck_but_debuffed = nil
else
if self.edition and self.edition.card_limit then
if self.ability.consumeable then
if self.ability.cardarea and type(self.ability.cardarea) == 'string' and G[self.ability.cardarea] and G[self.ability.cardarea].config and G[self.ability.cardarea].config.card_limit then
G[self.ability.cardarea].config.card_limit = G[self.ability.cardarea].config.card_limit + self.edition.card_limit
elseif self.ability.consumeable then
G.consumeables.config.card_limit = G.consumeables.config.card_limit + self.edition.card_limit
else
G.jokers.config.card_limit = G.jokers.config.card_limit + self.edition.card_limit
Expand All @@ -179,9 +181,12 @@ if G.jokers then
if from_debuff then
self.ability.joker_added_to_deck_but_debuffed = true
else
print(self.area==nil)
if self.edition and self.edition.card_limit then
if self.ability.consumeable then
if self.ability.consumeable and self.area == G.consumeables then
G.consumeables.config.card_limit = G.consumeables.config.card_limit - self.edition.card_limit
elseif self.ability.cardarea and type(self.ability.cardarea) == 'string' and G[self.ability.cardarea] and G[self.ability.cardarea].config and G[self.ability.cardarea].config.card_limit then
G[self.ability.cardarea].config.card_limit = G[self.ability.cardarea].config.card_limit - self.edition.card_limit
else
G.jokers.config.card_limit = G.jokers.config.card_limit - self.edition.card_limit
end'''
Expand All @@ -195,8 +200,10 @@ position = "at"
payload = '''
if self.ability.joker_added_to_deck_but_debuffed then
if self.edition and self.edition.card_limit then
if self.ability.consumeable then
if self.ability.consumeable and self.area == G.consumeables then
G.consumeables.config.card_limit = G.consumeables.config.card_limit - self.edition.card_limit
elseif self.ability.cardarea and type(self.ability.cardarea) == 'string' and G[self.ability.cardarea] and G[self.ability.cardarea].config and G[self.ability.cardarea].config.card_limit then
G[self.ability.cardarea].config.card_limit = G[self.ability.cardarea].config.card_limit - self.edition.card_limit
else
G.jokers.config.card_limit = G.jokers.config.card_limit - self.edition.card_limit
end'''
Expand Down