Skip to content

Commit bc63b0f

Browse files
committed
chipmult operator api stuff
1 parent 68f3897 commit bc63b0f

File tree

3 files changed

+37
-68
lines changed

3 files changed

+37
-68
lines changed

items/exotic.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ local universum = {
167167
},
168168
init = function(self)
169169
--Universum Patches
170+
SMODS.Scoring_Parameter:take_ownership("mult", {
171+
level_up_hand = function(amount, hand)
172+
if not next(find_joker('cry-Universum')) then
173+
hand[self.key] = math.max(hand['s_'..self.key] + hand['l_'..self.key]*(hand.level - 1), 0)
174+
end
175+
end
176+
})
170177
local uht = update_hand_text
171178
function update_hand_text(config, vals)
172179
if next(find_joker("cry-Universum")) and (not Talisman or not Talisman.config_file.disable_anims) then

lib/overrides.lua

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -2115,8 +2115,9 @@ if SMODS and SMODS.Mods and (not SMODS.Mods.Talisman or not SMODS.Mods.Talisman.
21152115
if effect.card then
21162116
juice_card(effect.card)
21172117
end
2118-
hand_chips = mod_chips(hand_chips ^ amount)
2119-
update_hand_text({ delay = 0 }, { chips = hand_chips, mult = mult })
2118+
local chips = SMODS.Scoring_Parameters["chips"]
2119+
chips.current = mod_chips(chips.current ^ amount)
2120+
update_hand_text({delay = 0}, {chips = chips.current})
21202121
if not effect.remove_default_message then
21212122
if from_edition then
21222123
card_eval_status_text(
@@ -2125,31 +2126,20 @@ if SMODS and SMODS.Mods and (not SMODS.Mods.Talisman or not SMODS.Mods.Talisman.
21252126
nil,
21262127
percent,
21272128
nil,
2128-
{ message = "^" .. amount, colour = G.C.EDITION, edition = true, sound = "cry_chips" }
2129+
{ message = "^" .. amount, colour = G.C.EDITION, edition = true }
21292130
)
21302131
elseif key ~= "Echip_mod" then
2131-
if effect.echip_message or effect.message then
2132-
local msg = effect.echip_message or effect.message
2133-
if not msg.sound then
2134-
msg.sound = "cry_echips"
2135-
end
2132+
if effect.echip_message then
21362133
card_eval_status_text(
21372134
scored_card or effect.card or effect.focus,
2138-
"e_chips",
2139-
amount,
2140-
percent,
2135+
"extra",
21412136
nil,
2142-
msg
2143-
)
2144-
else
2145-
card_eval_status_text(
2146-
scored_card or effect.card or effect.focus,
2147-
"e_chips",
2148-
amount,
21492137
percent,
21502138
nil,
2151-
{ colour = G.C.DARK_EDITION }
2139+
effect.echip_message
21522140
)
2141+
else
2142+
card_eval_status_text(scored_card or effect.card or effect.focus, "e_chips", amount, percent)
21532143
end
21542144
end
21552145
end
@@ -2159,39 +2149,31 @@ if SMODS and SMODS.Mods and (not SMODS.Mods.Talisman or not SMODS.Mods.Talisman.
21592149
if effect.card then
21602150
juice_card(effect.card)
21612151
end
2162-
mult = mod_mult(mult ^ amount)
2163-
update_hand_text({ delay = 0 }, { chips = hand_chips, mult = mult })
2152+
local mult = SMODS.Scoring_Parameters["mult"]
2153+
mult.current = mod_mult(mult.current ^ amount)
2154+
update_hand_text({delay = 0}, {mult = mult.current})
21642155
if not effect.remove_default_message then
21652156
if from_edition then
2166-
card_eval_status_text(scored_card, "jokers", nil, percent, nil, {
2167-
message = "^" .. amount .. " " .. localize("k_mult"),
2168-
colour = G.C.EDITION,
2169-
edition = true,
2170-
sound = "cry_emult",
2171-
})
2157+
card_eval_status_text(
2158+
scored_card,
2159+
"jokers",
2160+
nil,
2161+
percent,
2162+
nil,
2163+
{ message = "^" .. amount .. " " .. localize("k_mult"), colour = G.C.EDITION, edition = true }
2164+
)
21722165
elseif key ~= "Emult_mod" then
2173-
if effect.emult_message or effect.message then
2174-
local msg = effect.echip_message or effect.message
2175-
if not msg.sound then
2176-
msg.sound = "cry_emult"
2177-
end
2166+
if effect.emult_message then
21782167
card_eval_status_text(
21792168
scored_card or effect.card or effect.focus,
2180-
"e_mult",
2181-
amount,
2182-
percent,
2169+
"extra",
21832170
nil,
2184-
msg
2185-
)
2186-
else
2187-
card_eval_status_text(
2188-
scored_card or effect.card or effect.focus,
2189-
"e_mult",
2190-
amount,
21912171
percent,
21922172
nil,
2193-
{ colour = G.C.DARK_EDITION }
2173+
effect.emult_message
21942174
)
2175+
else
2176+
card_eval_status_text(scored_card or effect.card or effect.focus, "e_mult", amount, percent)
21952177
end
21962178
end
21972179
end

lovely/universum.toml

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,22 @@ version = "1.0.0"
33
dump_lua = true
44
priority = -1
55

6-
# Level up modifier
76
[[patches]]
87
[patches.pattern]
9-
target = "functions/common_events.lua"
10-
pattern = "amount = amount or 1"
11-
position = "after"
12-
payload = "if not next(find_joker('cry-Universum')) then"
13-
match_indent = true
14-
15-
16-
[[patches]]
17-
[patches.pattern]
18-
target = "functions/common_events.lua"
19-
pattern = "G.GAME.hands[hand].mult = math.max(G.GAME.hands[hand].s_mult + G.GAME.hands[hand].l_mult*(G.GAME.hands[hand].level - 1), 1)"
20-
position = "at"
21-
payload = "G.GAME.hands[hand].mult = math.max(G.GAME.hands[hand].mult + G.GAME.hands[hand].l_mult*amount, 1)"
22-
match_indent = true
23-
24-
25-
[[patches]]
26-
[patches.pattern]
27-
target = "functions/common_events.lua"
28-
pattern = "G.GAME.hands[hand].chips = math.max(G.GAME.hands[hand].s_chips + G.GAME.hands[hand].l_chips*(G.GAME.hands[hand].level - 1), 0)"
8+
target = '''=[SMODS _ "src/game_objects.lua"]'''
9+
pattern = "hand[self.key] = math.max(hand['s_'..self.key] + hand['l_'..self.key]*(hand.level - 1), 0)"
2910
position = "at"
3011
payload = '''
31-
G.GAME.hands[hand].chips = math.max(G.GAME.hands[hand].chips + G.GAME.hands[hand].l_chips*amount, 1)
12+
if not next(find_joker('cry-Universum')) then
13+
hand[self.key] = math.max(hand['s_'..self.key] + hand['l_'..self.key]*(hand.level - 1), 0)
3214
else
3315
universum_mod = 1
3416
local effects = {}
3517
SMODS.calculate_context({cry_universum = true}, effects)
3618
for i = 1, #effects do
3719
universum_mod = universum_mod * (effects[i] and effects[i].jokers and effects[i].jokers.mod or 1)
3820
end
39-
G.GAME.hands[hand].level = math.max(0, G.GAME.hands[hand].level + amount)
40-
G.GAME.hands[hand].mult = G.GAME.hands[hand].mult * (universum_mod)^amount
41-
G.GAME.hands[hand].chips = G.GAME.hands[hand].chips * (universum_mod)^amount
21+
hand[self.key] = hand[self.key]* (universum_mod)^amount
4222
end
4323
'''
4424
match_indent = true

0 commit comments

Comments
 (0)