Skip to content

Commit af47828

Browse files
authored
Trigger effects during hand size adjustment fix
Allow only 1 Chain to be built if an effect meets its activation condition during hand size adjustment at the end of the End Phase.
1 parent 93247bd commit af47828

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

proc_workaround.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,39 @@
11
--Utilities to be added to the core
22

3+
--[[
4+
Allow only 1 Chain to be built if an effect meets its activation condition during hand size adjustment at the end of the End Phase
5+
--]]
6+
do
7+
--Track if a card is discarded for hand size adjustment
8+
local hand_adjust_eff=Effect.GlobalEffect()
9+
hand_adjust_eff:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
10+
hand_adjust_eff:SetCode(EVENT_DISCARD)
11+
hand_adjust_eff:SetCountLimit(1)
12+
hand_adjust_eff:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_ADJUST)>0 end)
13+
hand_adjust_eff:SetOperation(function()
14+
--Track the moment that the Chain starts resolving
15+
local chain_solving_eff=Effect.GlobalEffect()
16+
chain_solving_eff:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
17+
chain_solving_eff:SetCode(EVENT_CHAIN_SOLVING)
18+
chain_solving_eff:SetCountLimit(1)
19+
chain_solving_eff:SetOperation(function()
20+
chain_solving_eff:Reset()
21+
--Neither player can activate another effect after the first Chain built during hand size adjustment starts resolving
22+
local cannot_act_eff=Effect.GlobalEffect()
23+
cannot_act_eff:SetType(EFFECT_TYPE_FIELD)
24+
cannot_act_eff:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
25+
cannot_act_eff:SetCode(EFFECT_CANNOT_ACTIVATE)
26+
cannot_act_eff:SetTargetRange(1,1)
27+
cannot_act_eff:SetValue(1)
28+
cannot_act_eff:SetReset(RESET_PHASE|PHASE_END)
29+
Duel.RegisterEffect(cannot_act_eff,0)
30+
end)
31+
chain_solving_eff:SetReset(RESET_PHASE|PHASE_END)
32+
Duel.RegisterEffect(chain_solving_eff,0)
33+
end)
34+
Duel.RegisterEffect(hand_adjust_eff,0)
35+
end
36+
337
--[[
438
If a monster in the Monster Zone is flipped face-down and back up again it shouldn't be treated as a monster that was Summoned that turn
539
--]]

0 commit comments

Comments
 (0)