Skip to content

Commit 4875d24

Browse files
Observatory + Misc Planets, Asc file cleanup
--Added Infoqueues for Ascension Power information and Misc Planets Observatory effects (The observatory effects were always present, just not visible) --Planet lua: Observatory Effect 1 in 5 chance for x1.5 > Variable XMult --Sol: X1.5 Mult on Ascended Hands > Held Sol Cards increase Ascension Power, Modest effect 0.05 > 0.1 Also Cleaned up some ascension stuff and move some things there into functions (Still pretty messy though imo)
1 parent 2252980 commit 4875d24

File tree

7 files changed

+429
-226
lines changed

7 files changed

+429
-226
lines changed

items/code.lua

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,28 @@ local exploit = {
10301030
order = 403,
10311031
config = { cry_multiuse = 2, extra = { enteredhand = "" } }, -- i don't think this ever uses config...?
10321032
loc_vars = function(self, info_queue, card)
1033+
if G.STAGE == G.STAGES.RUN and Cryptid.enabled("set_cry_poker_hand_stuff") == true then
1034+
local modest = Cryptid.gameset(G.P_CENTERS.c_cry_sunplanet) == "modest"
1035+
local current_power = Cryptid.safe_get(G, "GAME", "current_round", "current_hand", "cry_asc_num")
1036+
or Cryptid.calculate_ascension_power(
1037+
nil,
1038+
nil,
1039+
nil,
1040+
G.GAME.used_vouchers.v_cry_hyperspacetether,
1041+
G.GAME.bonus_asc_power
1042+
)
1043+
local multiplier = modest and 1 + ((0.25 + G.GAME.sunnumber.modest) * current_power)
1044+
or (1.25 + G.GAME.sunnumber.not_modest) ^ current_power
1045+
info_queue[#info_queue + 1] = {
1046+
key = "asc_misc" .. (modest and 2 or ""),
1047+
set = "Other",
1048+
specific_vars = {
1049+
current_power,
1050+
multiplier,
1051+
modest and (G.GAME.sunnumber.modest + 0.25) or (G.GAME.sunnumber.not_modest + 1.25),
1052+
},
1053+
}
1054+
end
10331055
return { vars = { Cryptid.safe_get(card, "ability", "cry_multiuse") or self.config.cry_multiuse } }
10341056
end,
10351057
can_use = function(self, card)

items/planet.lua

Lines changed: 164 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -313,9 +313,78 @@ local planetlua = {
313313
atlas = "atlasnotjokers",
314314
order = 101,
315315
loc_vars = function(self, info_queue, card)
316+
local aaa, bbb = SMODS.get_probability_vars(card, 1, card.ability.extra.odds, "Planet.lua")
317+
local xmulttexts = {}
318+
local loc_mult = " " .. (localize("k_mult")) .. " "
319+
for i = 0, 100 do
320+
xmulttexts[#xmulttexts + 1] = "X" .. (1 + (i / 100))
321+
end
322+
local o_plua = {
323+
-- For people "borrowing" this code: There's a lovely patch done in order to get this to work properly on infoqueues, if you don't need this on infoqueues then ignore this line
324+
-- Small "Correction" to center text a bit more
325+
{ n = G.UIT.T, config = { text = " ", colour = G.C.WHITE, scale = 0.32 } },
326+
-- Xmult text
327+
{
328+
n = G.UIT.C,
329+
config = { align = "m", colour = G.C.RED, r = 0.05, padding = 0.03, res = 0.15 },
330+
nodes = {
331+
{
332+
n = G.UIT.O,
333+
config = {
334+
object = DynaText({
335+
string = xmulttexts,
336+
colours = { G.C.WHITE },
337+
pop_in_rate = 9999999,
338+
silent = true,
339+
random_element = true,
340+
pop_delay = 0.5,
341+
scale = 0.32,
342+
min_cycle_time = 0,
343+
}),
344+
},
345+
},
346+
},
347+
},
348+
-- Mult Text
349+
{
350+
n = G.UIT.O,
351+
config = {
352+
object = DynaText({
353+
string = {
354+
{ string = "rand()", colour = G.C.JOKER_GREY },
355+
{ string = "#@" .. (Cryptid.get_m_jokers()) .. "M", colour = G.C.RED },
356+
loc_mult,
357+
loc_mult,
358+
loc_mult,
359+
loc_mult,
360+
loc_mult,
361+
loc_mult,
362+
loc_mult,
363+
loc_mult,
364+
loc_mult,
365+
loc_mult,
366+
loc_mult,
367+
loc_mult,
368+
loc_mult,
369+
},
370+
colours = { G.C.UI.TEXT_DARK },
371+
pop_in_rate = 9999999,
372+
silent = true,
373+
random_element = true,
374+
pop_delay = 0.2011,
375+
scale = 0.32,
376+
min_cycle_time = 0,
377+
}),
378+
},
379+
},
380+
}
381+
if Cryptid.safe_get(G, "GAME", "used_vouchers", "v_observatory") then
382+
info_queue[#info_queue + 1] = { key = "o_planetlua", set = "Other", plua_extra = o_plua }
383+
end
316384
return {
317385
vars = {
318-
SMODS.get_probability_vars(card, 1, card.ability.extra.odds, "Planet.lua"),
386+
aaa,
387+
bbb,
319388
},
320389
}
321390
end,
@@ -566,24 +635,23 @@ local planetlua = {
566635
end
567636
end
568637
end,
569-
calculate = function(self, card, context) --Observatory effect: (G.GAME.probabilities.normal) in (odds) chance for (G.P_CENTERS.v_observatory.config.extra) Mult
570-
if
571-
G.GAME.used_vouchers.v_observatory
572-
and context.joker_main
573-
and (
574-
SMODS.pseudorandom_probability(
575-
card,
576-
"mstar", --this is how it was before i didnt make it use the same seed
577-
1,
578-
card.ability.extra.odds,
579-
"Planet.lua"
580-
)
581-
)
582-
then
583-
local value = G.P_CENTERS.v_observatory.config.extra
638+
calculate = function(self, card, context) --Observatory effect: Variable XMult
639+
if G.GAME.used_vouchers.v_observatory and context.joker_main then
640+
pseudorandom("cry_googol_play")
641+
local aaa = pseudorandom("mstar")
642+
local limit = Card.get_gameset(card) == "modest" and 2 or 1e100
643+
local formula = aaa + (0.07 * (aaa ^ 5 / (1 - aaa ^ 2)))
644+
local value = Cryptid.nuke_decimals(math.min(limit, 1.7 ^ formula), 2)
645+
--[[
646+
647+
OverFlow Compat TODO
648+
It needs to be done in a way that keep expected score consistent between having 1 big stack and several smaller stacks
649+
and ideally doesn't cause a lot of lag at large stacks like the bulk_use does
650+
584651
if Overflow then
585652
value = value ^ to_big(card:getQty())
586653
end
654+
]]
587655
return {
588656
message = localize({ type = "variable", key = "a_xmult", vars = { value } }),
589657
Xmult_mod = value,
@@ -630,13 +698,14 @@ local nstar = {
630698
return true
631699
end,
632700
loc_vars = function(self, info_queue, center)
633-
return { vars = { (G.GAME and G.GAME.neutronstarsusedinthisrun or 0) } }
701+
local aaa = Cryptid.safe_get(G, "GAME", "neutronstarsusedinthisrun") or 0
702+
if Cryptid.safe_get(G, "GAME", "used_vouchers", "v_observatory") then
703+
info_queue[#info_queue + 1] = { key = "o_nstar", set = "Other", specific_vars = { 0.1, (1 + (0.1 * aaa)) } }
704+
end
705+
return { vars = { aaa } }
634706
end,
635707
use = function(self, card, area, copier)
636708
local used_consumable = copier or card
637-
--Get amount of Neutron stars use this run or set to 0 if nil
638-
G.GAME.neutronstarsusedinthisrun = G.GAME.neutronstarsusedinthisrun or 0
639-
640709
--Add +1 to amount of neutron stars used this run
641710
G.GAME.neutronstarsusedinthisrun = G.GAME.neutronstarsusedinthisrun + 1
642711
local neutronhand = Cryptid.get_random_hand(nil, "nstar" .. G.GAME.round_resets.ante) --Random poker hand
@@ -655,8 +724,6 @@ local nstar = {
655724
end,
656725
bulk_use = function(self, card, area, copier, number)
657726
local used_consumable = copier or card
658-
G.GAME.neutronstarsusedinthisrun = G.GAME.neutronstarsusedinthisrun or 0
659-
660727
local handstolv = {}
661728
local neutronhand = "n/a"
662729
for i = 1, number do
@@ -694,7 +761,7 @@ local nstar = {
694761
}))
695762
end,
696763
calculate = function(self, card, context) --Observatory effect: X0.1 mult for each neutron star used this run
697-
if G.GAME.used_vouchers.v_observatory and G.GAME.neutronstarsusedinthisrun ~= nil and context.joker_main then
764+
if G.GAME.used_vouchers.v_observatory and G.GAME.neutronstarsusedinthisrun > 0 and context.joker_main then
698765
local value = G.GAME.neutronstarsusedinthisrun
699766
if Overflow then
700767
value = value ^ to_big(card:getQty())
@@ -740,9 +807,8 @@ local nstar = {
740807
card:use_consumeable(area)
741808
end,
742809
}
743-
744810
-- Sol
745-
-- Upgrades Ascended Hand Power by 0.05
811+
-- Upgrades Ascended Hand Power
746812
local sunplanet = {
747813
cry_credits = {
748814
idea = {
@@ -756,7 +822,6 @@ local sunplanet = {
756822
"Toneblock",
757823
},
758824
},
759-
--TODO: disable ascendant hands if this is disabled
760825
dependencies = {
761826
items = {
762827
"set_cry_planet",
@@ -773,7 +838,7 @@ local sunplanet = {
773838
atlas = "atlasnotjokers",
774839
order = 150,
775840
config = {
776-
extra = 0.05,
841+
extra = { modest = 0.1, not_modest = 0.05 },
777842
},
778843
set_card_type_badge = function(self, card, badges)
779844
badges[1] = create_badge(localize("cry_p_star"), get_type_colour(self or card.config, card), nil, 1.2)
@@ -783,12 +848,13 @@ local sunplanet = {
783848
end,
784849
use = function(self, card, area, copier)
785850
local used_consumable = copier or card
786-
local sunlevel = (G.GAME.sunlevel and G.GAME.sunlevel or 0) + 1
787-
G.GAME.sunlevel = (G.GAME.sunlevel or 0) + 1
851+
G.GAME.sunlevel = G.GAME.sunlevel + 1
852+
G.GAME.sunnumber.modest = G.GAME.sunnumber.modest + card.ability.extra.modest
853+
G.GAME.sunnumber.not_modest = G.GAME.sunnumber.not_modest + card.ability.extra.not_modest
788854
delay(0.4)
789855
update_hand_text(
790856
{ sound = "button", volume = 0.7, pitch = 0.8, delay = 0.3 },
791-
{ handname = localize("cry_asc_hands"), chips = "...", mult = "...", level = to_big(sunlevel) }
857+
{ handname = localize("cry_asc_hands"), chips = "...", mult = "...", level = to_big(G.GAME.sunlevel - 1) }
792858
)
793859
delay(1.0)
794860
G.E_MANAGER:add_event(Event({
@@ -798,7 +864,7 @@ local sunplanet = {
798864
play_sound("tarot1")
799865
ease_colour(G.C.UI_CHIPS, copy_table(G.C.GOLD), 0.1)
800866
ease_colour(G.C.UI_MULT, copy_table(G.C.GOLD), 0.1)
801-
Cryptid.pulse_flame(0.01, sunlevel)
867+
Cryptid.pulse_flame(0.01, G.GAME.sunlevel)
802868
used_consumable:juice_up(0.8, 0.5)
803869
G.E_MANAGER:add_event(Event({
804870
trigger = "after",
@@ -814,23 +880,28 @@ local sunplanet = {
814880
return true
815881
end,
816882
}))
817-
update_hand_text({ sound = "button", volume = 0.7, pitch = 0.9, delay = 0 }, { level = to_big(sunlevel + 1) })
883+
update_hand_text(
884+
{ sound = "button", volume = 0.7, pitch = 0.9, delay = 0 },
885+
{ level = to_big(G.GAME.sunlevel) }
886+
)
818887
delay(2.6)
819-
G.GAME.sunnumber = G.GAME.sunnumber ~= nil and G.GAME.sunnumber + card.ability.extra or card.ability.extra
820888
update_hand_text(
821889
{ sound = "button", volume = 0.7, pitch = 1.1, delay = 0 },
822890
{ mult = 0, chips = 0, handname = "", level = "" }
823891
)
824892
end,
825893
bulk_use = function(self, card, area, copier, number)
826894
local used_consumable = copier or card
827-
local sunlevel = (G.GAME.sunlevel and G.GAME.sunlevel or 0) + 1
828-
G.GAME.sunlevel = (G.GAME.sunlevel or 0) + 1
895+
G.GAME.sunlevel = G.GAME.sunlevel + number
896+
G.GAME.sunnumber.modest = G.GAME.sunnumber.modest + number * card.ability.extra.modest
897+
G.GAME.sunnumber.not_modest = G.GAME.sunnumber.not_modest + number * card.ability.extra.not_modest
829898
delay(0.4)
830-
update_hand_text(
831-
{ sound = "button", volume = 0.7, pitch = 0.8, delay = 0.3 },
832-
{ handname = localize("cry_asc_hands"), chips = "...", mult = "...", level = to_big(sunlevel) }
833-
)
899+
update_hand_text({ sound = "button", volume = 0.7, pitch = 0.8, delay = 0.3 }, {
900+
handname = localize("cry_asc_hands"),
901+
chips = "...",
902+
mult = "...",
903+
level = to_big(G.GAME.sunlevel - number),
904+
})
834905
delay(1.0)
835906
G.E_MANAGER:add_event(Event({
836907
trigger = "after",
@@ -839,7 +910,7 @@ local sunplanet = {
839910
play_sound("tarot1")
840911
ease_colour(G.C.UI_CHIPS, copy_table(G.C.GOLD), 0.1)
841912
ease_colour(G.C.UI_MULT, copy_table(G.C.GOLD), 0.1)
842-
Cryptid.pulse_flame(0.01, (sunlevel - 1) + number)
913+
Cryptid.pulse_flame(0.01, G.GAME.sunlevel)
843914
used_consumable:juice_up(0.8, 0.5)
844915
G.E_MANAGER:add_event(Event({
845916
trigger = "after",
@@ -857,46 +928,71 @@ local sunplanet = {
857928
}))
858929
update_hand_text(
859930
{ sound = "button", volume = 0.7, pitch = 0.9, delay = 0 },
860-
{ level = to_big(sunlevel + number) }
931+
{ level = to_big(G.GAME.sunlevel) }
861932
)
862933
delay(2.6)
863-
G.GAME.sunnumber = G.GAME.sunnumber ~= nil and G.GAME.sunnumber + number * card.ability.extra
864-
or number * card.ability.extra
865934
update_hand_text(
866935
{ sound = "button", volume = 0.7, pitch = 1.1, delay = 0 },
867936
{ mult = 0, chips = 0, handname = "", level = "" }
868937
)
869938
end,
870-
calculate = function(self, card, context) --Observatory effect: X1.5 mult if hand is an ascended hand
871-
if
872-
G.GAME.used_vouchers.v_observatory
873-
and G.GAME.current_round.current_hand.cry_asc_num ~= 0
874-
and context.joker_main
875-
then
876-
local value = G.P_CENTERS.v_observatory.config.extra
877-
if Overflow then
878-
value = value ^ to_big(card:getQty())
879-
end
880-
return {
881-
message = localize({ type = "variable", key = "a_xmult", vars = { value } }),
882-
Xmult_mod = value,
883-
}
884-
end
885-
end,
886939
loc_vars = function(self, info_queue, center)
887-
local levelone = (G.GAME.sunlevel and G.GAME.sunlevel or 0) + 1
940+
local levelone = Cryptid.safe_get(G, "GAME", "sunlevel") or 1
888941
local planetcolourone = G.C.HAND_LEVELS[math.min(levelone, 7)]
942+
if G.STAGE == G.STAGES.RUN then
943+
local modest = Cryptid.gameset(G.P_CENTERS.c_cry_sunplanet) == "modest"
944+
local current_power = Cryptid.safe_get(G, "GAME", "current_round", "current_hand", "cry_asc_num")
945+
or Cryptid.calculate_ascension_power(
946+
nil,
947+
nil,
948+
nil,
949+
G.GAME.used_vouchers.v_cry_hyperspacetether,
950+
G.GAME.bonus_asc_power
951+
)
952+
local multiplier = modest and 1 + ((0.25 + G.GAME.sunnumber.modest) * current_power)
953+
or (1.25 + G.GAME.sunnumber.not_modest) ^ current_power
954+
info_queue[#info_queue + 1] = {
955+
key = "asc_misc" .. (modest and 2 or ""),
956+
set = "Other",
957+
specific_vars = {
958+
current_power,
959+
multiplier,
960+
modest and (G.GAME.sunnumber.modest + 0.25) or (G.GAME.sunnumber.not_modest + 1.25),
961+
},
962+
}
963+
end
964+
if Cryptid.safe_get(G, "GAME", "used_vouchers", "v_observatory") then
965+
local observatory_power = 0
966+
if #find_joker("cry-sunplanet") == 1 then
967+
observatory_power = 1
968+
elseif #find_joker("cry-sunplanet") > 1 then
969+
observatory_power = Cryptid.funny_log(2, #find_joker("cry-sunplanet") + 1)
970+
end
971+
info_queue[#info_queue + 1] = { key = "o_sunplanet", set = "Other", specific_vars = { observatory_power } }
972+
end
889973
if levelone == 1 then
890974
planetcolourone = G.C.UI.TEXT_DARK
891975
end
892-
return {
893-
vars = {
894-
(G.GAME.sunlevel or 0) + 1,
895-
center.ability.extra or 0.05,
896-
(G.GAME.sunnumber and G.GAME.sunnumber or 0) + 1.25,
897-
colours = { planetcolourone },
898-
},
899-
}
976+
if Cryptid.gameset(center) == "modest" then
977+
return {
978+
vars = {
979+
levelone,
980+
center.ability.extra.modest,
981+
(Cryptid.safe_get(G, "GAME", "sunnumber", "modest") or 0) + 0.25,
982+
colours = { planetcolourone },
983+
},
984+
key = "c_cry_sunplanet2",
985+
}
986+
else
987+
return {
988+
vars = {
989+
levelone,
990+
center.ability.extra.not_modest,
991+
(Cryptid.safe_get(G, "GAME", "sunnumber", "not_modest") or 0) + 1.25,
992+
colours = { planetcolourone },
993+
},
994+
}
995+
end
900996
end,
901997
in_pool = function(self)
902998
if G.GAME.cry_asc_played and G.GAME.cry_asc_played > 0 then

0 commit comments

Comments
 (0)