Skip to content

Commit 3a0feb8

Browse files
SDM0jolly[bot]Jevonnissocoolman
authored
Improved decks (#438)
* Updated decks * Added Exotic joker spawn * jolly-bot: auto-format Lua files using Stylua * Fixed wrong rarity check * do these too --------- Co-authored-by: jolly[bot] <jolly[bot]@users.noreply.github.com> Co-authored-by: Jevonnissocoolman <[email protected]>
1 parent 1fd5b9c commit 3a0feb8

File tree

1 file changed

+53
-68
lines changed

1 file changed

+53
-68
lines changed

items/deck.lua

Lines changed: 53 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ local legendary = {
260260
pos = { x = 0, y = 6 },
261261
atlas = "atlasdeck",
262262
order = 15,
263-
trigger_effect = function(self, args)
264-
if args.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
263+
calculate = function(self, back, context)
264+
if context.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
265265
if G.jokers then
266266
if #G.jokers.cards < G.jokers.config.card_limit then
267267
local legendary_poll = pseudorandom(pseudoseed("cry_legendary"))
@@ -390,8 +390,8 @@ local glowing = {
390390
return { vars = { " " } }
391391
end,
392392
atlas = "glowing",
393-
trigger_effect = function(self, args)
394-
if args.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
393+
calculate = function(self, back, context)
394+
if context.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
395395
for i = 1, #G.jokers.cards do
396396
if not Card.no(G.jokers.cards[i], "immutable", true) then
397397
cry_with_deck_effects(G.jokers.cards[i], function(card)
@@ -492,11 +492,11 @@ local antimatter = {
492492
cry_forced_draw_amount = 5,
493493
},
494494
pos = { x = 2, y = 0 },
495-
trigger_effect = function(self, args)
496-
if args.context ~= "final_scoring_step" then
497-
antimatter_trigger_effect(self, args)
495+
calculate = function(self, back, context)
496+
if context.context ~= "final_scoring_step" then
497+
antimatter_trigger_effect(self, context)
498498
else
499-
return antimatter_trigger_effect_final_scoring_step(self, args)
499+
return antimatter_trigger_effect_final_scoring_step(self, context)
500500
end
501501
end,
502502
apply = function(self)
@@ -671,24 +671,21 @@ local antimatter = {
671671
-- Wormhole deck
672672
if (wormholecheck or 0) ~= 0 then
673673
G.GAME.modifiers.cry_negative_rate = 20
674-
--[[
675-
676-
Needs to check if exotic Jokers exist are enabled (whenever that happens)
677-
678-
G.E_MANAGER:add_event(Event({
679-
func = function()
680-
if G.jokers then
681-
local card = create_card("Joker", G.jokers, nil, "cry_exotic", nil, nil, nil, "cry_wormhole")
682-
card:add_to_deck()
683-
card:start_materialize()
684-
G.jokers:emplace(card)
685-
return true
686-
end
687-
end,
688-
}))
689674

690-
]]
691-
--
675+
if cry_card_enabled("set_cry_exotic") == true then
676+
G.E_MANAGER:add_event(Event({
677+
func = function()
678+
if G.jokers then
679+
local card =
680+
create_card("Joker", G.jokers, nil, "cry_exotic", nil, nil, nil, "cry_wormhole")
681+
card:add_to_deck()
682+
card:start_materialize()
683+
G.jokers:emplace(card)
684+
return true
685+
end
686+
end,
687+
}))
688+
end
692689
end
693690
-- Redeemed deck
694691
if (redeemedcheck or 0) ~= 0 then
@@ -721,9 +718,8 @@ local antimatter = {
721718
end,
722719
}))
723720
end
724-
--Encoded Deck (TBA)
721+
--Encoded Deck
725722
if (encodedcheck or 0) ~= 0 then
726-
--[[
727723
G.E_MANAGER:add_event(Event({
728724
func = function()
729725
if G.jokers then
@@ -749,23 +745,26 @@ local antimatter = {
749745
end
750746
end,
751747
}))
752-
]]
753-
--
754748
end
755749
end
756750

757-
function antimatter_trigger_effect_final_scoring_step(self, args)
751+
function antimatter_trigger_effect_final_scoring_step(self, context)
758752
local critcheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_cry_critical", "wins", 8)
759753
local plasmacheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_plasma", "wins", 8)
760754

761-
if args.context == "final_scoring_step" then
755+
if cry_get_gameset(G.P_CENTERS.b_cry_antimatter) == "madness" then
756+
critcheck = 1
757+
plasmacheck = 1
758+
end
759+
760+
if context.context == "final_scoring_step" then
762761
local crit_poll = pseudorandom(pseudoseed("cry_critical"))
763762
crit_poll = crit_poll / (G.GAME.probabilities.normal or 1)
764763
--Critical Deck
765764
if (critcheck or 0) ~= 0 then
766765
if crit_poll < self.config.cry_crit_rate then
767-
args.mult = args.mult ^ 2
768-
update_hand_text({ delay = 0 }, { mult = args.mult, chips = args.chips })
766+
context.mult = context.mult ^ 2
767+
update_hand_text({ delay = 0 }, { mult = context.mult, chips = context.chips })
769768
G.E_MANAGER:add_event(Event({
770769
func = function()
771770
play_sound("talisman_emult", 1)
@@ -784,11 +783,11 @@ local antimatter = {
784783
end
785784
end
786785
--Plasma Deck
787-
local tot = args.chips + args.mult
786+
local tot = context.chips + context.mult
788787
if (plasmacheck or 0) ~= 0 then
789-
args.chips = math.floor(tot / 2)
790-
args.mult = math.floor(tot / 2)
791-
update_hand_text({ delay = 0 }, { mult = args.mult, chips = args.chips })
788+
context.chips = math.floor(tot / 2)
789+
context.mult = math.floor(tot / 2)
790+
update_hand_text({ delay = 0 }, { mult = context.mult, chips = context.chips })
792791

793792
G.E_MANAGER:add_event(Event({
794793
func = function()
@@ -837,16 +836,22 @@ local antimatter = {
837836

838837
delay(0.6)
839838
end
840-
return args.chips, args.mult
839+
return context.chips, context.mult
841840
end
842841
end
843842

844-
function antimatter_trigger_effect(self, args)
843+
function antimatter_trigger_effect(self, context)
845844
local glowingcheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_cry_glowing", "wins", 8)
846845
local legendarycheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_cry_legendary", "wins", 8)
847846
local anaglyphcheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_anaglyph", "wins", 8)
848847

849-
if args.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
848+
if cry_get_gameset(G.P_CENTERS.b_cry_antimatter) == "madness" then
849+
glowingcheck = 1
850+
legendarycheck = 1
851+
anaglyphcheck = 1
852+
end
853+
854+
if context.context == "eval" and safe_get(G.GAME, "last_blind", "boss") then
850855
--Glowing Deck
851856
if (glowingcheck or 0) ~= 0 then
852857
for i = 1, #G.jokers.cards do
@@ -906,6 +911,7 @@ local antimatter = {
906911
if not voucher_table or type(voucher_table) ~= "table" then
907912
voucher_table = {}
908913
end
914+
local skip = (cry_get_gameset(G.P_CENTERS.b_cry_antimatter) == "madness")
909915

910916
-- Add Vouchers into the table by key
911917
local function already_exists(t, voucher)
@@ -923,40 +929,37 @@ local antimatter = {
923929
end
924930
end
925931

926-
--Checks for nils in the extremely nested thing i'm checking for
927-
928932
local nebulacheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_nebula", "wins", 8)
929933
local magiccheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_magic", "wins", 8)
930934
local zodiaccheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_zodiac", "wins", 8)
931935
local equilibriumcheck =
932936
safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_cry_equilibrium", "wins", 8)
933937

934938
--Nebula Deck
935-
if (nebulacheck or 0) ~= 0 then
939+
if (nebulacheck or 0) ~= 0 or skip then
936940
Add_voucher_to_the_table(voucher_table, "v_telescope")
937941
end
938942
-- Magic Deck
939-
if (magiccheck or 0) ~= 0 then
943+
if (magiccheck or 0) ~= 0 or skip then
940944
Add_voucher_to_the_table(voucher_table, "v_crystal_ball")
941945
end
942946

943947
-- Zodiac Deck
944-
if (zodiaccheck or 0) ~= 0 then
948+
if (zodiaccheck or 0) ~= 0 or skip then
945949
Add_voucher_to_the_table(voucher_table, "v_tarot_merchant")
946950
Add_voucher_to_the_table(voucher_table, "v_planet_merchant")
947951
Add_voucher_to_the_table(voucher_table, "v_overstock_norm")
948952
end
949953
-- Deck Of Equilibrium
950-
if (equilibriumcheck or 0) ~= 0 then
954+
if (equilibriumcheck or 0) ~= 0 or skip then
951955
Add_voucher_to_the_table(voucher_table, "v_overstock_norm")
952956
Add_voucher_to_the_table(voucher_table, "v_overstock_plus")
953957
end
954958
return voucher_table
955959
end
956960
--Does this even need to be a function idk
957961
function get_antimatter_consumables(consumable_table)
958-
--Checks for nils in the extremely nested thing i'm checking for
959-
-- Create a table or use one that is passed into the function
962+
local skip = (cry_get_gameset(G.P_CENTERS.b_cry_antimatter) == "madness")
960963
if not consumable_table or type(consumable_table) ~= "table" then
961964
consumable_table = {}
962965
end
@@ -966,34 +969,16 @@ local antimatter = {
966969
local magiccheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_magic", "wins", 8)
967970
local ghostcheck = safe_get(G.PROFILES, G.SETTINGS.profile, "deck_usage", "b_ghost", "wins", 8)
968971

969-
if (magiccheck or 0) ~= 0 then
972+
if (magiccheck or 0) ~= 0 or skip then
970973
table.insert(consumable_table, "c_fool")
971974
table.insert(consumable_table, "c_fool")
972975
end
973-
if (ghostcheck or 0) ~= 0 then
976+
if (ghostcheck or 0) ~= 0 or skip then
974977
table.insert(consumable_table, "c_hex")
975978
end
976979

977980
return consumable_table
978981
end
979-
980-
--[[
981-
local test = antimatter_trigger_effect
982-
function antimatter_trigger_effect(self, args)
983-
test(self, args)
984-
if args.context == "eval" then
985-
ease_dollars(900)
986-
end
987-
end
988-
local test2 = get_antimatter_consumables
989-
function get_antimatter_consumables(consumable_table)
990-
if not consumable_table or type(consumable_table) ~= "table" then consumable_table = {} end
991-
table.insert(consumable_table, "c_soul")
992-
table.insert(consumable_table, "c_soul")
993-
return test2(consumable_table)
994-
end
995-
]]
996-
--
997982
end,
998983
}
999984

0 commit comments

Comments
 (0)