Skip to content

Commit 15b3764

Browse files
committed
move create_card away from a full override
1 parent 9ad6eac commit 15b3764

File tree

2 files changed

+11
-59
lines changed

2 files changed

+11
-59
lines changed

lib/misprintize.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ function Cryptid.manipulate(card, args)
401401
if not Card.no(card, "immutable", true) or (args and args.bypass_checks) then
402402
if not args then
403403
return Cryptid.manipulate(card, {
404-
min = G.GAME.modifiers.cry_misprint_min,
405-
max = G.GAME.modifiers.cry_misprint_max,
404+
min = (G.GAME.modifiers.cry_misprint_min or 1) * (G.GAME.modifiers.cry_jkr_misprint_mod or 1),
405+
max = (G.GAME.modifiers.cry_misprint_max or 1) * (G.GAME.modifiers.cry_jkr_misprint_mod or 1),
406406
type = "X",
407407
dont_stack = true,
408408
no_deck_effects = true,

lib/overrides.lua

Lines changed: 9 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ function calculate_reroll_cost(skip_increment)
808808
+ G.GAME.current_round.reroll_cost_increase
809809
end
810810

811-
-- We're modifying so much of this for Brown and Yellow Stake, Equilibrium Deck, etc. that it's fine to override...
811+
local create_card_ref = create_card
812812
function create_card(_type, area, legendary, _rarity, skip_materialize, soulable, forced_key, key_append)
813813
local area = area or G.jokers
814814
local pseudo = function(x)
@@ -821,7 +821,6 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
821821
end
822822
ps = Cryptid.predict_pseudoseed
823823
end
824-
local center = G.P_CENTERS.b_red
825824
if (_type == "Joker" or _type == "Meme") and G.GAME and G.GAME.modifiers and G.GAME.modifiers.all_rnj then
826825
forced_key = "j_cry_rnjoker"
827826
end
@@ -881,20 +880,7 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
881880
end
882881

883882
if forced_key then --vanilla behavior change, mainly for M Joker reasons
884-
center = G.P_CENTERS[forced_key]
885-
_type = (center.set ~= "Default" and center.set or _type)
886-
else
887-
gcparea = area
888-
local _pool, _pool_key = get_current_pool(_type, _rarity, legendary, key_append)
889-
gcparea = nil
890-
center = pseudorandom_element(_pool, ps(_pool_key))
891-
local it = 1
892-
while center == "UNAVAILABLE" do
893-
it = it + 1
894-
center = pseudorandom_element(_pool, ps(_pool_key .. "_resample" .. it))
895-
end
896-
897-
center = G.P_CENTERS[center]
883+
_type = (G.P_CENTERS[forced_key].set ~= "Default" and G.P_CENTERS[forced_key].set or _type)
898884
end
899885

900886
local front = (
@@ -906,7 +892,7 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
906892
) or nil
907893

908894
if area == "ERROR" then
909-
local ret = (front or center)
895+
local ret = (front or G.P_CENTERS[forced_key] or G.P_CENTERS.b_red)
910896
if not ret.config then
911897
ret.config = {}
912898
end
@@ -922,28 +908,11 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
922908
return ret --the config.center.key stuff prevents a crash with Jen's Almanac hook
923909
end
924910

925-
local card = Card(
926-
area and (area.T.x + area.T.w / 2) or 0,
927-
area and area.T.y or 0,
928-
G.CARD_W * (center and center.set == "Booster" and 1.27 or 1),
929-
G.CARD_H * (center and center.set == "Booster" and 1.27 or 1),
930-
front,
931-
center,
932-
{
933-
bypass_discovery_center = area == G.shop_jokers
934-
or area == G.pack_cards
935-
or area == G.shop_vouchers
936-
or (G.shop_demo and area == G.shop_demo)
937-
or area == G.jokers
938-
or area == G.consumeables,
939-
bypass_discovery_ui = area == G.shop_jokers
940-
or area == G.pack_cards
941-
or area == G.shop_vouchers
942-
or (G.shop_demo and area == G.shop_demo),
943-
discover = area == G.jokers or area == G.consumeables,
944-
bypass_back = G.GAME.selected_back.pos,
945-
}
946-
)
911+
local card = create_card_ref(_type, area, legendary, _rarity, skip_materialize, soulable, forced_key, key_append)
912+
local center = card and card.config and card.config.center or {}
913+
if front then
914+
card:set_base(front, true)
915+
end
947916
if front and G.GAME.modifiers.cry_force_suit then
948917
card:change_suit(G.GAME.modifiers.cry_force_suit)
949918
end
@@ -952,23 +921,11 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
952921
end
953922
if front and G.GAME.modifiers.cry_force_edition then
954923
card:set_edition({ [G.GAME.modifiers.cry_force_edition] = true }, true, true)
924+
card:add_to_deck()
955925
end
956926
if front and G.GAME.modifiers.cry_force_seal then
957927
card:set_seal(G.GAME.modifiers.cry_force_seal)
958928
end
959-
if card.ability.consumeable and not skip_materialize then
960-
card:start_materialize()
961-
end
962-
for k, v in ipairs(SMODS.Sticker.obj_buffer) do
963-
local sticker = SMODS.Stickers[v]
964-
if
965-
sticker.should_apply
966-
and type(sticker.should_apply) == "function"
967-
and sticker:should_apply(card, center, area)
968-
then
969-
sticker:apply(card, true)
970-
end
971-
end
972929
if
973930
G.GAME.modifiers.cry_force_sticker == "eternal"
974931
or (
@@ -1116,11 +1073,6 @@ function create_card(_type, area, legendary, _rarity, skip_materialize, soulable
11161073
card.cry_flipped = true
11171074
end
11181075
end
1119-
if _type == "Joker" and not G.GAME.modifiers.cry_force_edition then
1120-
local edition = poll_edition("edi" .. (key_append or "") .. G.GAME.round_resets.ante)
1121-
card:set_edition(edition)
1122-
check_for_unlock({ type = "have_edition" })
1123-
end
11241076
end
11251077
if (card.ability.set == "Code") and G.GAME.used_vouchers.v_cry_quantum_computing then
11261078
local tot = 0

0 commit comments

Comments
 (0)