Skip to content

Commit a451ddb

Browse files
committed
add asc power stuff and voucher unredeem
1 parent da5700b commit a451ddb

File tree

6 files changed

+798
-2
lines changed

6 files changed

+798
-2
lines changed

ascended.lua

Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,331 @@
1+
-- ascended.lua - Used for Ascended Hands
2+
3+
G.FUNCS.cry_asc_UI_set = function(e)
4+
if G.GAME.cry_exploit_override then
5+
e.config.object.colours = { darken(G.C.SECONDARY_SET.Code, 0.2) }
6+
else
7+
e.config.object.colours = { G.C.GOLD }
8+
end
9+
e.config.object:update_text()
10+
end
11+
12+
-- Needed because get_poker_hand_info isnt called at the end of the road
13+
local evaluateroundref = G.FUNCS.evaluate_round
14+
function G.FUNCS.evaluate_round()
15+
evaluateroundref()
16+
-- This is just the easiest way to check if its gold because lua is annoying
17+
if G.C.UI_CHIPS[1] == G.C.GOLD[1] then
18+
ease_colour(G.C.UI_CHIPS, G.C.BLUE, 0.3)
19+
ease_colour(G.C.UI_MULT, G.C.RED, 0.3)
20+
end
21+
end
22+
23+
-- this is a hook to make funny "x of a kind"/"flush x" display text
24+
local pokerhandinforef = G.FUNCS.get_poker_hand_info
25+
function G.FUNCS.get_poker_hand_info(_cards)
26+
local text, loc_disp_text, poker_hands, scoring_hand, disp_text = pokerhandinforef(_cards)
27+
-- Display text if played hand contains a Cluster and a Bulwark
28+
-- Not Ascended hand related but this hooks in the same spot so i'm lumping it here anyways muahahahahahaha
29+
if text == "cry_Clusterfuck" then
30+
if next(poker_hands["cry_Bulwark"]) then
31+
disp_text = "cry-Cluster Bulwark"
32+
loc_disp_text = localize(disp_text, "poker_hands")
33+
end
34+
end
35+
local hidden = false
36+
for i, v in pairs(scoring_hand) do
37+
if v.facing == "back" then
38+
hidden = true
39+
break
40+
end
41+
end
42+
if G.SETTINGS.language == "en-us" then
43+
if #scoring_hand > 5 and (text == "Flush Five" or text == "Five of a Kind" or text == "bunc_Spectrum Five") then
44+
local rank_array = {}
45+
local county = 0
46+
for i = 1, #scoring_hand do
47+
local val = scoring_hand[i]:get_id()
48+
rank_array[val] = (rank_array[val] or 0) + 1
49+
if rank_array[val] > county then
50+
county = rank_array[val]
51+
end
52+
end
53+
local function create_num_chunk(int) -- maybe useful enough to not be local? but tbh this function is probably some common coding exercise
54+
if int >= 1000 then
55+
int = 999
56+
end
57+
local ones = {
58+
["1"] = "One",
59+
["2"] = "Two",
60+
["3"] = "Three",
61+
["4"] = "Four",
62+
["5"] = "Five",
63+
["6"] = "Six",
64+
["7"] = "Seven",
65+
["8"] = "Eight",
66+
["9"] = "Nine",
67+
}
68+
local tens = {
69+
["1"] = "Ten",
70+
["2"] = "Twenty",
71+
["3"] = "Thirty",
72+
["4"] = "Forty",
73+
["5"] = "Fifty",
74+
["6"] = "Sixty",
75+
["7"] = "Seventy",
76+
["8"] = "Eighty",
77+
["9"] = "Ninety",
78+
}
79+
local str_int = string.reverse(int .. "") -- ehhhh whatever
80+
local str_ret = ""
81+
for i = 1, string.len(str_int) do
82+
local place = str_int:sub(i, i)
83+
if place ~= "0" then
84+
if i == 1 then
85+
str_ret = ones[place]
86+
elseif i == 2 then
87+
if place == "1" and str_ret ~= "" then -- admittedly not my smartest moment, i dug myself into a hole here...
88+
if str_ret == "One" then
89+
str_ret = "Eleven"
90+
elseif str_ret == "Two" then
91+
str_ret = "Twelve"
92+
elseif str_ret == "Three" then
93+
str_ret = "Thirteen"
94+
elseif str_ret == "Five" then
95+
str_ret = "Fifteen"
96+
elseif str_ret == "Eight" then
97+
str_ret = "Eighteen"
98+
else
99+
str_ret = str_ret .. "teen"
100+
end
101+
else
102+
str_ret = tens[place] .. ((string.len(str_ret) > 0 and " " or "") .. str_ret)
103+
end
104+
elseif i == 3 then
105+
str_ret = ones[place]
106+
.. (" Hundred" .. ((string.len(str_ret) > 0 and " and " or "") .. str_ret))
107+
end -- this line is wild
108+
end
109+
end
110+
return str_ret
111+
end
112+
-- text gets stupid small at 100+ anyway
113+
loc_disp_text = (text == "Flush Five" and "Flush " or text == "bunc_Spectrum Five" and "Spectrum " or "")
114+
.. (
115+
(county < 1000 and create_num_chunk(county) or "Thousand")
116+
.. (text == "Five of a Kind" and " of a Kind" or "")
117+
)
118+
end
119+
end
120+
-- Ascension power
121+
local a_power = Cryptid.calculate_ascension_power(
122+
text,
123+
_cards,
124+
scoring_hand,
125+
G.GAME.used_vouchers.v_cry_hyperspacetether,
126+
G.GAME.bonus_asc_power
127+
)
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+
if a_power > 0 then
141+
G.GAME.current_round.current_hand.cry_asc_num = a_power
142+
-- Change mult and chips colors if hand is ascended
143+
if not hidden then
144+
ease_colour(G.C.UI_CHIPS, copy_table(G.C.GOLD), 0.3)
145+
ease_colour(G.C.UI_MULT, copy_table(G.C.GOLD), 0.3)
146+
G.GAME.current_round.current_hand.cry_asc_num_text = (
147+
a_power and (type(a_power) == "table" and a_power:gt(to_big(0)) or a_power > 0)
148+
)
149+
and " (+" .. a_power .. ")"
150+
or ""
151+
else
152+
ease_colour(G.C.UI_CHIPS, G.C.BLUE, 0.3)
153+
ease_colour(G.C.UI_MULT, G.C.RED, 0.3)
154+
G.GAME.current_round.current_hand.cry_asc_num_text = ""
155+
end
156+
else
157+
G.GAME.current_round.current_hand.cry_asc_num = 0
158+
ease_colour(G.C.UI_CHIPS, G.C.BLUE, 0.3)
159+
ease_colour(G.C.UI_MULT, G.C.RED, 0.3)
160+
G.GAME.current_round.current_hand.cry_asc_num_text = ""
161+
end
162+
return text, loc_disp_text, poker_hands, scoring_hand, disp_text
163+
end
164+
function Cryptid.ascend(num) -- edit this function at your leisure
165+
G.GAME.sunnumber = G.GAME.sunnumber or {not_modest = 0, modest = 0}
166+
if (Cryptid.safe_get(G, "GAME", "current_round", "current_hand", "cry_asc_num") or 0) <= 0 then
167+
return num
168+
end
169+
if Cryptid.gameset(G.P_CENTERS.c_cry_sunplanet) == "modest" then
170+
-- Default: Chips and Mult multiplier + 0.25 for every 1 Ascension power
171+
return num * to_big(1 + ((0.25 + G.GAME.sunnumber.modest) * G.GAME.current_round.current_hand.cry_asc_num))
172+
else
173+
-- Default: Chips and Mult multiplier X1.25 for every 1 Ascension power
174+
return num * to_big((1.25 +G.GAME.sunnumber.not_modest) ^ G.GAME.current_round.current_hand.cry_asc_num)
175+
end
176+
end
177+
178+
function Cryptid.pulse_flame(duration, intensity) -- duration is in seconds, intensity is in idfk honestly, but it increases pretty quickly
179+
G.cry_flame_override = G.cry_flame_override or {}
180+
G.cry_flame_override["duration"] = duration or 0.01
181+
G.cry_flame_override["intensity"] = intensity or 2
182+
end
183+
184+
function Cryptid.ascension_power_enabled()
185+
if Cryptid.enable_ascension_power then return true end
186+
if (SMODS.Mods["Cryptid"] or {}).can_load then
187+
return Cryptid.enabled("set_cry_poker_hand_stuff")
188+
end
189+
end
190+
191+
function Cryptid.calculate_ascension_power(hand_name, hand_cards, hand_scoring_cards, tether, bonus)
192+
bonus = bonus or 0
193+
local starting = 0
194+
if not Cryptid.ascension_power_enabled() then
195+
return 0
196+
end
197+
if hand_name then
198+
-- Get Starting Ascension power from Poker Hands
199+
if hand_cards then
200+
local check = Cryptid.hand_ascension_numbers(hand_name, tether)
201+
if check then
202+
starting = (tether and #hand_cards or #hand_scoring_cards) - check
203+
end
204+
end
205+
-- Extra starting calculation for Declare hands
206+
if G.GAME.hands[hand_name] and G.GAME.hands[hand_name].declare_cards then
207+
local total = 0
208+
for i, v in pairs(G.GAME.hands[hand_name].declare_cards or {}) do
209+
local how_many_fit = 0
210+
local suit, rank
211+
for i2, v2 in pairs(hand_cards) do
212+
if not v2.marked then
213+
if SMODS.has_no_rank(v2) and v.rank == "rankless" or v2:get_id() == v.rank then
214+
rank = true
215+
end
216+
if v2:is_suit(v.suit) or (v.suit == "suitless" and SMODS.has_no_suit(v2)) or not v.suit then
217+
suit = true
218+
end
219+
if not (suit and rank) then
220+
suit = false
221+
rank = false
222+
end
223+
if suit and rank then
224+
how_many_fit = how_many_fit + 1
225+
v2.marked = true
226+
end
227+
end
228+
end
229+
if not rank or not suit then
230+
how_many_fit = 0
231+
end
232+
total = total + how_many_fit
233+
end
234+
for i2, v2 in pairs(hand_cards) do
235+
v2.marked = nil
236+
end
237+
starting = starting + (total - #hand_scoring_cards)
238+
end
239+
end
240+
-- Get Ascension power from Exploit
241+
if G.GAME.cry_exploit_override then
242+
bonus = bonus + 1
243+
end
244+
-- Get Ascension Power From Sol/Perkele (Observatory effect)
245+
if
246+
G.GAME.used_vouchers.v_observatory and (next(SMODS.find_card("cry-sunplanet")) or next(SMODS.find_card("cry-Perkele")))
247+
then
248+
-- switch this to not use find_joker eventually please for the love of god
249+
local super_entropic_local_variable_that_stores_the_amount_of_suns = #SMODS.find_card("cry-sunplanet")
250+
+ #SMODS.find_card("cry-Perkele")
251+
252+
if super_entropic_local_variable_that_stores_the_amount_of_suns == 1 then
253+
bonus = bonus + 1
254+
else
255+
bonus = bonus
256+
+ Cryptid.nuke_decimals(
257+
Cryptid.funny_log(2, super_entropic_local_variable_that_stores_the_amount_of_suns + 1),
258+
2
259+
)
260+
end
261+
end
262+
local final = math.max(0, starting + bonus)
263+
-- Round to 1 if final value is less than 1 but greater than 0
264+
if final > 0 and final < 1 then
265+
final = 1
266+
end
267+
return final
268+
end
269+
function Cryptid.hand_ascension_numbers(hand_name, tether)
270+
if Cryptid.ascension_numbers[hand_name] and type(Cryptid.ascension_numbers[hand_name]) == "function" then
271+
return Cryptid.ascension_numbers[hand_name](hand_name, tether)
272+
end
273+
if hand_name == "High Card" then
274+
return tether and 1 or nil
275+
elseif hand_name == "Pair" then
276+
return tether and 2 or nil
277+
elseif hand_name == "Two Pair" then
278+
return 4
279+
elseif hand_name == "Three of a Kind" then
280+
return tether and 3 or nil
281+
elseif hand_name == "Straight" or hand_name == "Flush" or hand_name == "Straight Flush" then
282+
return next(SMODS.find_card("j_four_fingers")) and Cryptid.gameset() ~= "modest" and 4 or 5
283+
elseif
284+
hand_name == "Full House"
285+
or hand_name == "Five of a Kind"
286+
or hand_name == "Flush House"
287+
or hand_name == "cry_Bulwark"
288+
or hand_name == "Flush Five"
289+
or hand_name == "bunc_Spectrum"
290+
or hand_name == "bunc_Straight Spectrum"
291+
or hand_name == "bunc_Spectrum House"
292+
or hand_name == "bunc_Spectrum Five"
293+
then
294+
return 5
295+
elseif hand_name == "Four of a Kind" then
296+
return G.GAME.used_vouchers.v_cry_hyperspacetether and 4 or nil
297+
elseif hand_name == "cry_Clusterfuck" or hand_name == "cry_UltPair" then
298+
return 8
299+
elseif hand_name == "cry_WholeDeck" then
300+
return 52
301+
elseif hand_name == "cry_Declare0" then
302+
return G.GAME.hands.cry_Declare0
303+
and G.GAME.hands.cry_Declare0.declare_cards
304+
and #G.GAME.hands.cry_Declare0.declare_cards
305+
elseif hand_name == "cry_Declare1" then
306+
return G.GAME.hands.cry_Declare1
307+
and G.GAME.hands.cry_Declare1.declare_cards
308+
and #G.GAME.hands.cry_Declare1.declare_cards
309+
elseif hand_name == "cry_Declare2" then
310+
return G.GAME.hands.cry_Declare2
311+
and G.GAME.hands.cry_Declare2.declare_cards
312+
and #G.GAME.hands.cry_Declare2.declare_cards
313+
elseif
314+
hand_name == "spa_Spectrum"
315+
or hand_name == "spa_Straight_Spectrum"
316+
or hand_name == "spa_Spectrum_House"
317+
or hand_name == "spa_Spectrum_Five"
318+
or hand_name == "spa_Flush_Spectrum"
319+
or hand_name == "spa_Straight_Flush_Spectrum"
320+
or hand_name == "spa_Flush_Spectrum_House"
321+
or hand_name == "spa_Flush_Spectrum_Five"
322+
then
323+
return SpectrumAPI
324+
and SpectrumAPI.configuration.misc.four_fingers_spectrums
325+
and next(SMODS.find_card("j_four_fingers"))
326+
and Cryptid.gameset() ~= "modest"
327+
and 4
328+
or 5
329+
end
330+
return nil
331+
end

forcetrigger.lua

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,6 @@ function Cryptid.forcetrigger(card, context)
10081008

10091009
local ggpn = G.GAME.probabilities.normal
10101010
G.GAME.probabilities.normal = 1e9
1011-
10121011
if not card.config.center.force_use then
10131012
card:use_consumeable()
10141013
else

0 commit comments

Comments
 (0)