Skip to content

Commit c15787a

Browse files
authored
Implement Entropy compatibility patch for a_power (#810)
Added a compatibility patch to handle big-number tables from Entropy, preventing crashes when comparing numbers. On branch ascended-card-lvl-up-fix Changes to be committed: modified: lib/ascended.lua
1 parent 1499f88 commit c15787a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/ascended.lua

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,27 @@ function G.FUNCS.get_poker_hand_info(_cards)
125125
G.GAME.used_vouchers.v_cry_hyperspacetether,
126126
G.GAME.bonus_asc_power
127127
)
128-
if to_big(a_power) > to_big(0) then
128+
-- 🔧 Entropy Compatibility Patch (prevents "compare number with table" crash)
129+
if type(a_power) == "table" then
130+
-- Entropy uses big-number tables. Normalize to a Lua number.
131+
if a_power.to_number then
132+
a_power = a_power:to_number()
133+
elseif a_power.val then
134+
a_power = tonumber(a_power.val) or 0
135+
else
136+
-- Unknown format: fail safe instead of crashing
137+
a_power = 0
138+
end
139+
end
140+
141+
if a_power > 0 then
129142
G.GAME.current_round.current_hand.cry_asc_num = a_power
130143
-- Change mult and chips colors if hand is ascended
131144
if not hidden then
132145
ease_colour(G.C.UI_CHIPS, copy_table(G.C.GOLD), 0.3)
133146
ease_colour(G.C.UI_MULT, copy_table(G.C.GOLD), 0.3)
134147
G.GAME.current_round.current_hand.cry_asc_num_text = (
135-
a_power and (Cryptid.is_big(a_power) and a_power:gt(to_big(0)) or a_power > 0)
148+
a_power and (type(a_power) == "table" and a_power:gt(to_big(0)) or a_power > 0)
136149
)
137150
and " (+" .. a_power .. ")"
138151
or ""

0 commit comments

Comments
 (0)