Skip to content

Commit ea2d107

Browse files
authored
Update "Emergency Evasion"
-Fixed issue with card replacement -Should place the cards affected after the spell resolves -Slight script optimization update for handling pendulum and field spell cards.
1 parent c6d9a78 commit ea2d107

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

unofficial/c511001750.lua

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
2323
if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then
2424
local rg=Duel.GetOperatedGroup()
2525
rg:KeepAlive()
26-
local tc=rg:GetFirst()
27-
while tc do
26+
for tc in rg:Iter() do
2827
tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
29-
tc=rg:GetNext()
3028
end
3129
local e1=Effect.CreateEffect(c)
3230
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
3331
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
34-
e1:SetCode(EVENT_FREE_CHAIN)
32+
e1:SetCode(EVENT_CHAIN_END)
3533
e1:SetCountLimit(1)
3634
e1:SetLabelObject(rg)
3735
e1:SetCondition(function(e) local tp=e:GetHandlerPlayer() return Duel.IsPlayerCanDraw(tp,1) end)
@@ -62,24 +60,18 @@ function s.drop(e,tp,eg,ep,ev,re,r,rp,c,og)
6260
return
6361
end
6462
if g:IsExists(s.retfilter,1,nil,tp,tpe) then
65-
local rg=g:FilterSelect(tp,s.retfilter,1,1,nil,tp,tpe)
66-
Duel.HintSelection(rg)
67-
local rc=rg:GetFirst()
68-
local loc=rc:GetPreviousLocation()
69-
local pos=rc:GetPreviousPosition()
70-
if (rc:GetType()&TYPE_FIELD) then
71-
loc=LOCATION_FZONE
72-
local of=Duel.GetFieldCard(1-tp,LOCATION_FZONE,0)
73-
if of then Duel.Destroy(of,REASON_RULE) end
74-
of=Duel.GetFieldCard(tp,LOCATION_FZONE,0)
75-
if of and Duel.Destroy(of,REASON_RULE)==0 and Duel.SendtoGrave(of,REASON_RULE)==0 then
76-
Duel.SendtoGrave(rc,REASON_RULE)
63+
local rg=g:Filter(Card.IsType,nil,tpe)
64+
for rc in rg:Iter() do
65+
if rc:IsPreviousLocation(LOCATION_PZONE) then
66+
local seq=0
67+
if rc:GetPreviousSequence()==7 or rc:GetPreviousSequence()==4 then seq=1 end
68+
Duel.MoveToField(rc,tp,tp,LOCATION_PZONE,rc:GetPreviousPosition(),true,(1<<seq))
69+
elseif rc:IsPreviousLocation(LOCATION_FZONE) and rc:IsFieldSpell() then
70+
Duel.MoveToField(rc,tp,tp,LOCATION_FZONE,rc:GetPreviousPosition(),true)
71+
else
72+
Duel.MoveToField(rc,tp,tp,rc:GetPreviousLocation(),rc:GetPreviousPosition(),true)
7773
end
7874
end
79-
Duel.MoveToField(rc,tp,tp,loc,pos,true)
8075
end
81-
Duel.ShuffleHand(tp)
82-
end
83-
g:DeleteGroup()
84-
return
76+
end
8577
end

0 commit comments

Comments
 (0)