Skip to content

Commit 308ce21

Browse files
committed
epic scaling detection
1 parent c02e805 commit 308ce21

File tree

2 files changed

+94
-35
lines changed

2 files changed

+94
-35
lines changed

items/epic.lua

Lines changed: 67 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -763,12 +763,17 @@ local m = {
763763
end
764764
if context.selling_card and context.card:is_jolly() and not context.blueprint then
765765
card.ability.extra.x_mult = lenient_bignum(to_big(card.ability.extra.x_mult) + card.ability.extra.extra)
766-
if not context.retrigger_joker then
766+
local msg = SMODS.scale_card(card, {
767+
ref_table = card.ability.extra,
768+
ref_value = "x_mult",
769+
scalar_value = "extra"
770+
})
771+
if not context.retrigger_joker and (not msg or type(msg) == "string") then
767772
--This doesn't display the correct amount of mult if retriggered it display the amount from the first retrigger instead of the final one
768773
--But I would rather have this than constant card_eval_status_text spam
769774
--If anyone knows a solution feel free to do a pr xd
770775
card_eval_status_text(card, "extra", nil, nil, nil, {
771-
message = localize({
776+
message = msg or localize({
772777
type = "variable",
773778
key = "a_xmult",
774779
vars = { number_format(card.ability.extra.x_mult) },
@@ -779,12 +784,17 @@ local m = {
779784
end
780785
if context.forcetrigger then
781786
card.ability.extra.x_mult = lenient_bignum(to_big(card.ability.extra.x_mult) + card.ability.extra.extra)
787+
local msg = SMODS.scale_card(card, {
788+
ref_table = card.ability.extra,
789+
ref_value = "x_mult",
790+
scalar_value = "extra"
791+
})
782792
return {
783-
message = localize({
793+
message = not msg and localize({
784794
type = "variable",
785795
key = "a_xmult",
786796
vars = { number_format(card.ability.extra.x_mult) },
787-
}),
797+
}) or (type(msg) == "string" and msg) or nil,
788798
Xmult_mod = card.ability.extra.x_mult,
789799
}
790800
end
@@ -976,9 +986,15 @@ local number_blocks = {
976986
card = card,
977987
}
978988
else
979-
card.ability.extra.money =
980-
lenient_bignum(to_big(card.ability.extra.money) + card.ability.extra.money_mod)
981-
card_eval_status_text(card, "extra", nil, nil, nil, { message = localize("k_upgrade_ex") })
989+
card.ability.extra.money = lenient_bignum(to_big(card.ability.extra.money) + card.ability.extra.money_mod)
990+
local msg = SMODS.scale_card(card, {
991+
ref_table = card.ability.extra,
992+
ref_value = "money",
993+
scalar_value = "money_mod"
994+
})
995+
if not msg or type(msg) == "string" then
996+
card_eval_status_text(card, "extra", nil, nil, nil, { message = msg or localize("k_upgrade_ex") })
997+
end
982998
return nil, true
983999
end
9841000
end
@@ -1717,24 +1733,36 @@ local goldjoker = {
17171733
calculate = function(self, card, context)
17181734
if context.cardarea == G.play and context.individual and not context.blueprint then
17191735
if SMODS.has_enhancement(context.other_card, "m_gold") then
1720-
card.ability.extra.percent =
1721-
lenient_bignum(to_big(card.ability.extra.percent) + card.ability.extra.percent_mod)
1722-
return {
1723-
extra = { focus = card, message = localize("k_upgrade_ex") },
1724-
card = card,
1725-
colour = G.C.MONEY,
1726-
}
1736+
card.ability.extra.percent = lenient_bignum(to_big(card.ability.extra.percent) + card.ability.extra.percent_mod)
1737+
local msg = SMODS.scale_card(card, {
1738+
ref_table = card.ability.extra,
1739+
ref_value = "percent",
1740+
scalar_value = "percent_mod"
1741+
})
1742+
if not msg or type(msg) == "string" then
1743+
return {
1744+
extra = { focus = card, message = msg or localize("k_upgrade_ex") },
1745+
card = card,
1746+
colour = G.C.MONEY,
1747+
}
1748+
end
17271749
end
17281750
end
17291751
if context.individual and context.cardarea == G.play then
17301752
if SMODS.has_enhancement(context.other_card, "m_gold") then
1731-
card.ability.extra.percent =
1732-
lenient_bignum(to_big(card.ability.extra.percent) + card.ability.extra.percent_mod)
1733-
return {
1734-
message = localize("k_upgrade_ex"),
1735-
card = card,
1736-
colour = G.C.CHIPS,
1737-
}
1753+
card.ability.extra.percent = lenient_bignum(to_big(card.ability.extra.percent) + card.ability.extra.percent_mod)
1754+
local msg = SMODS.scale_card(card, {
1755+
ref_table = card.ability.extra,
1756+
ref_value = "percent",
1757+
scalar_value = "percent_mod"
1758+
})
1759+
if not msg or type(msg) == "string" then
1760+
return {
1761+
message = msg or localize("k_upgrade_ex"),
1762+
card = card,
1763+
colour = G.C.CHIPS,
1764+
}
1765+
end
17381766
end
17391767
end
17401768
end,
@@ -2525,6 +2553,12 @@ local starfruit = {
25252553
end
25262554
if context.reroll_shop or context.forcetrigger then
25272555
card.ability.emult = card.ability.emult - card.ability.emult_mod
2556+
local msg = SMODS.scale_card(card, {
2557+
ref_table = card.ability,
2558+
ref_value = "emult",
2559+
scalar_value = "emult_mod",
2560+
operation = "-"
2561+
})
25282562
--floating point precision can kiss my ass istg
25292563
if to_number(card.ability.emult) <= 1.00000001 then
25302564
G.E_MANAGER:add_event(Event({
@@ -2553,16 +2587,18 @@ local starfruit = {
25532587
colour = G.C.RARITY.cry_epic,
25542588
}
25552589
else
2556-
return {
2557-
message = localize({
2558-
type = "variable",
2559-
key = "a_powmult_minus",
2560-
vars = {
2561-
number_format(card.ability.emult_mod),
2562-
},
2563-
}),
2564-
colour = G.C.RARITY.cry_epic,
2565-
}
2590+
if not msg or type(msg) == "string" then
2591+
return {
2592+
message = msg or localize({
2593+
type = "variable",
2594+
key = "a_powmult_minus",
2595+
vars = {
2596+
number_format(card.ability.emult_mod),
2597+
},
2598+
}),
2599+
colour = G.C.RARITY.cry_epic,
2600+
}
2601+
end
25662602
end
25672603
end
25682604
end,

items/spooky.lua

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -946,12 +946,23 @@ local candy_basket = {
946946
card.ability.extra.candies
947947
+ to_big(card.ability.extra.candy_mod) * card.ability.extra.candy_boss_mod
948948
)
949+
local msg = SMODS.scale_card(card, {
950+
ref_table = card.ability.extra,
951+
ref_value = "candies",
952+
scalar_value = "candy_boss_mod"
953+
})
949954
end
950955
if card.ability.immutable.current_win_count >= card.ability.immutable.wins_needed then
951956
card.ability.immutable.current_win_count = 0
952-
card.ability.extra.candies =
953-
lenient_bignum(to_big(card.ability.extra.candies) + card.ability.extra.candy_mod)
954-
card_eval_status_text(card, "extra", nil, nil, nil, { message = localize("k_upgrade_ex") })
957+
card.ability.extra.candies = lenient_bignum(to_big(card.ability.extra.candies) + card.ability.extra.candy_mod)
958+
local msg = SMODS.scale_card(card, {
959+
ref_table = card.ability.extra,
960+
ref_value = "candies",
961+
scalar_value = "candy_mod"
962+
})
963+
if not msg or type(msg) == "string" then
964+
card_eval_status_text(card, "extra", nil, nil, nil, { message = msg or localize("k_upgrade_ex") })
965+
end
955966
end
956967
end
957968
if context.forcetrigger then
@@ -962,7 +973,19 @@ local candy_basket = {
962973
)
963974
card.ability.extra.candies =
964975
lenient_bignum(to_big(card.ability.extra.candies) + card.ability.extra.candy_mod)
965-
card_eval_status_text(card, "extra", nil, nil, nil, { message = localize("k_upgrade_ex") })
976+
local msg = SMODS.scale_card(card, {
977+
ref_table = card.ability.extra,
978+
ref_value = "candies",
979+
scalar_value = "candy_boss_mod"
980+
})
981+
local msg = SMODS.scale_card(card, {
982+
ref_table = card.ability.extra,
983+
ref_value = "candies",
984+
scalar_value = "candy_mod"
985+
})
986+
if not msg or type(msg) == "string" then
987+
card_eval_status_text(card, "extra", nil, nil, nil, { message = msg or localize("k_upgrade_ex") })
988+
end
966989
for i = 1, math.floor(math.min(card.ability.immutable.max_spawn, card.ability.extra.candies)) do
967990
local card = create_card("Joker", G.jokers, nil, "cry_candy", nil, nil, nil, "cry_candy_basket")
968991
card:add_to_deck()

0 commit comments

Comments
 (0)