Skip to content
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
32 changes: 32 additions & 0 deletions lovely/interest_changes.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[manifest]
version = "1.0.0"
dump_lua = true
priority = 0

[[patches]]
[patches.regex]
target = 'functions/common_events.lua'
pattern = 'G\.GAME\.interest_cap/5'
position = 'at'
payload = 'SMODS.get_interest()["interest_cap"]'

[[patches]]
[patches.regex]
target = 'functions/common_events.lua'
pattern = 'vars = \{G\.GAME\.interest_amount, 5'
position = 'at'
payload = 'vars = {G.GAME.interest_amount, SMODS.get_interest()["per_interest"]'

[[patches]]
[patches.regex]
target = 'functions/state_events.lua'
pattern = 'G\.GAME\.interest_cap/5'
position = 'at'
payload = 'SMODS.get_interest()["interest_cap"]'

[[patches]]
[patches.regex]
target = 'functions/state_events.lua'
pattern = 'G\.GAME\.dollars/5'
position = 'at'
payload = 'G.GAME.dollars/SMODS.get_interest()["per_interest"]'
33 changes: 32 additions & 1 deletion src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2868,4 +2868,35 @@ function ease_dollars(mod, instant)
from_consumeable = (G.STATE == G.STATES.PLAY_TAROT) or nil,
from_scoring = (G.STATE == G.STATES.HAND_PLAYED) or nil,
})
end
end

function SMODS.get_interest()
local add_interest_cap = 0
local add_per_interest = 0
for _, area in ipairs(SMODS.get_card_areas('jokers')) do
for _, _card in ipairs(area.cards) do
local ret = _card:calculate_interest()

-- TARGET: calc_interest per card
if ret then
if ret then
if ret.add_cap then
add_interest_cap = add_interest_cap + ret.add_cap
end
if ret.add_per_interest then
add_per_interest = add_per_interest + ret.add_per_interest
end
end
end
end
end
return {interest_cap = add_interest_cap + (G.GAME.extra_interest_cap or 0) + G.GAME.interest_cap/5, per_interest = add_per_interest + (G.GAME.extra_per_interest or 0) + 5}
end

function Card:calculate_interest()
if not self:can_calculate() then return end
local obj = self.config.center
if obj.calc_interest and type(obj.calc_interest) == 'function' then
return obj:calc_interest(self)
end
end