Skip to content

Commit 0ed1c94

Browse files
Fix Mondrian/Dgrat triggering with labyrinth
-Full rewrite of Labyrinth functionality :jimball: -Fixed Mondrian and Delayed Gratification incorrectly activating their effects when discards are used with labyrinth
1 parent 2915722 commit 0ed1c94

File tree

2 files changed

+33
-18
lines changed

2 files changed

+33
-18
lines changed

items/misc_joker.lua

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,24 +2728,6 @@ local maze = {
27282728
order = 61,
27292729
immutable = true,
27302730
atlas = "atlastwo",
2731-
update = function(self, card, dt)
2732-
if G.STAGE == G.STAGES.RUN then
2733-
if G.GAME.current_round.hands_played > 0 then
2734-
G.GAME.current_round.hands_played = 0
2735-
end
2736-
if G.GAME.current_round.discards_used > 0 then
2737-
G.GAME.current_round.discards_used = 0
2738-
end
2739-
end
2740-
end,
2741-
add_to_deck = function(self, card, from_debuff)
2742-
if G.GAME.current_round.hands_played > 0 then
2743-
G.GAME.current_round.hands_played = 0
2744-
end
2745-
if G.GAME.current_round.discards_used > 0 then
2746-
G.GAME.current_round.discards_used = 0
2747-
end
2748-
end,
27492731
cry_credits = {
27502732
idea = {
27512733
"zy-b-org",

lib/overrides.lua

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,11 @@ end
18541854

18551855
local discard_ref = G.FUNCS.discard_cards_from_highlighted
18561856
G.FUNCS.discard_cards_from_highlighted = function(e, hook)
1857+
--Labyrinth: set current_round_discards_used to 0 for effects
1858+
G.GAME.current_round.discards_used2 = G.GAME.current_round.discards_used
1859+
if next(find_joker("cry-maze")) then
1860+
G.GAME.current_round.discards_used = 0
1861+
end
18571862
discard_ref(e, hook)
18581863
local highlighted_count = math.min(#G.hand.highlighted, G.discard.config.card_limit - #G.play.cards)
18591864
if highlighted_count <= 0 then
@@ -1889,9 +1894,22 @@ G.FUNCS.discard_cards_from_highlighted = function(e, hook)
18891894
end,
18901895
}))
18911896
end
1897+
--Labyrinth: return current_round_discards_used back to the amount it is supposed to be after
1898+
G.GAME.current_round.discards_used = G.GAME.current_round.discards_used2 + 1
18921899
end
18931900
local play_ref = G.FUNCS.play_cards_from_highlighted
18941901
G.FUNCS.play_cards_from_highlighted = function(e)
1902+
--Labyrinth: set current_round_hands played to 0 for effects
1903+
G.E_MANAGER:add_event(Event({
1904+
trigger = "immediate",
1905+
func = function()
1906+
G.GAME.current_round.hands_played2 = G.GAME.current_round.hands_played
1907+
if next(find_joker("cry-maze")) then
1908+
G.GAME.current_round.hands_played = 0
1909+
end
1910+
return true
1911+
end,
1912+
}))
18951913
G.GAME.before_play_buffer = true
18961914
-- None Stuff
18971915
if G.GAME.stamp_mod and not G.PROFILES[G.SETTINGS.profile].cry_none and #G.hand.highlighted == 1 then
@@ -1905,6 +1923,21 @@ G.FUNCS.play_cards_from_highlighted = function(e)
19051923
--Add blind context for Just before cards are played
19061924
G.GAME.blind:cry_before_play()
19071925
play_ref(e)
1926+
--Labyrinth: return current_round_hands played to the amount it is supposed to be at after
1927+
G.E_MANAGER:add_event(Event({
1928+
trigger = "immediate",
1929+
func = function()
1930+
G.E_MANAGER:add_event(Event({
1931+
trigger = "after",
1932+
delay = 0.1,
1933+
func = function()
1934+
G.GAME.current_round.hands_played = G.GAME.current_round.hands_played2 + 1
1935+
return true
1936+
end,
1937+
}))
1938+
return true
1939+
end,
1940+
}))
19081941
G.GAME.before_play_buffer = nil
19091942
end
19101943

0 commit comments

Comments
 (0)