From a586bd5ffff213cc6d0d70a5944cc70d0b8657ce Mon Sep 17 00:00:00 2001 From: Saydyrya90 <66742221+Saydyrya90@users.noreply.github.com> Date: Thu, 13 Mar 2025 13:55:10 +0000 Subject: [PATCH 1/2] ExtraCredit Cryptid compatibility for ease dollars --- src/essay.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/essay.lua b/src/essay.lua index 0a2694e..2cdd4a4 100644 --- a/src/essay.lua +++ b/src/essay.lua @@ -192,9 +192,19 @@ local function sum_levels() end local ed = ease_dollars function ease_dollars(mod, x) - ed(mod, x) + -- Use Talisman's to_number if available + local safe_mod = type(mod) == "table" and (to_number and to_number(mod) or tonumber(mod)) or mod + local safe_x = type(x) == "table" and (to_number and to_number(x) or tonumber(x)) or x + + -- If conversion fails, default to 0 + safe_mod = safe_mod or 0 + safe_x = safe_x or 0 + + -- Call original ease_dollars with converted values + ed(safe_mod, safe_x) + for i = 1, #G.jokers.cards do - local effects = G.jokers.cards[i]:calculate_joker({ EC_ease_dollars = mod }) + local effects = G.jokers.cards[i]:calculate_joker({ EC_ease_dollars = safe_x }) end end @@ -402,10 +412,10 @@ SMODS.Joker{ --Eclipse end, calculate = function(self, card, context) - if context.cardarea == G.jokers and (sum_levels() - 12) > 0 and context.joker_main then + if context.cardarea == G.jokers and (sum_levels() - to_big(12)) > 0 and context.joker_main then return { - message = localize{type='variable',key='a_chips',vars={(sum_levels()-12)*card.ability.extra.chip_mod}}, - chip_mod = (sum_levels()-12)*card.ability.extra.chip_mod, + message = localize{type='variable',key='a_chips',vars={(sum_levels() - to_big(12))*card.ability.extra.chip_mod}}, + chip_mod = (sum_levels() - to_big(12))*card.ability.extra.chip_mod, colour = G.C.CHIPS } end From cfca085346e16d828e727c2280d4aaba20f28ab5 Mon Sep 17 00:00:00 2001 From: Saydyrya90 <66742221+Saydyrya90@users.noreply.github.com> Date: Mon, 24 Mar 2025 03:57:21 +0000 Subject: [PATCH 2/2] fix Eclipse joker to not crash with other mods (talisman) --- src/essay.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/essay.lua b/src/essay.lua index a8a2f1e..d1112f0 100644 --- a/src/essay.lua +++ b/src/essay.lua @@ -195,14 +195,11 @@ function ease_dollars(mod, x) -- Use Talisman's to_number if available local safe_mod = type(mod) == "table" and (to_number and to_number(mod) or tonumber(mod)) or mod local safe_x = type(x) == "table" and (to_number and to_number(x) or tonumber(x)) or x - -- If conversion fails, default to 0 safe_mod = safe_mod or 0 safe_x = safe_x or 0 - -- Call original ease_dollars with converted values ed(safe_mod, safe_x) - for i = 1, #G.jokers.cards do local effects = G.jokers.cards[i]:calculate_joker({ EC_ease_dollars = safe_x }) end @@ -412,7 +409,7 @@ SMODS.Joker{ --Eclipse end, calculate = function(self, card, context) - if context.cardarea == G.jokers and (sum_levels() - to_big(12)) > 0 and context.joker_main then + if context.cardarea == G.jokers and (sum_levels() - to_big(12)) > to_big(0) and context.joker_main then return { message = localize{type='variable',key='a_chips',vars={(sum_levels() - to_big(12))*card.ability.extra.chip_mod}}, chip_mod = (sum_levels() - to_big(12))*card.ability.extra.chip_mod,