Skip to content

Commit 7a8ed1a

Browse files
committed
"Darklord Zerato" fix
Fixed a bug where it would destroyed if the activation of its first effect was negated
1 parent 56ba92a commit 7a8ed1a

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

official/c40921744.lua

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
--Darklord Zerato
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--summon with 1 tribute
5+
--Can be Tribute Summoned using 1 DARK monster
66
local e1=aux.AddNormalSummonProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0),s.otfilter)
77
local e2=aux.AddNormalSetProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0),s.otfilter)
8-
--destroy
8+
--Destroy all monsters your opponent controls
99
local e3=Effect.CreateEffect(c)
1010
e3:SetDescription(aux.Stringid(id,1))
1111
e3:SetCategory(CATEGORY_DESTROY)
@@ -15,16 +15,16 @@ function s.initial_effect(c)
1515
e3:SetTarget(s.destg)
1616
e3:SetOperation(s.desop)
1717
c:RegisterEffect(e3)
18-
--self destroy
18+
--Destroy this card during the End Phase
1919
local e4=Effect.CreateEffect(c)
2020
e4:SetDescription(aux.Stringid(id,2))
2121
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
2222
e4:SetCode(EVENT_PHASE+PHASE_END)
2323
e4:SetRange(LOCATION_MZONE)
2424
e4:SetCountLimit(1)
25-
e4:SetCondition(s.sdescon)
26-
e4:SetTarget(s.sdestg)
27-
e4:SetOperation(s.sdesop)
25+
e4:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end)
26+
e4:SetTarget(s.selfdestg)
27+
e4:SetOperation(s.selfdesop)
2828
c:RegisterEffect(e4)
2929
end
3030
function s.otfilter(c,tp)
@@ -37,27 +37,24 @@ end
3737
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
3838
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end
3939
Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST)
40-
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
40+
e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_OATH,1)
4141
end
4242
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
43-
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
44-
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
43+
if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_MZONE,1,nil) end
44+
local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil)
4545
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
4646
end
4747
function s.desop(e,tp,eg,ep,ev,re,r,rp,chk)
48-
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil)
48+
local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil)
4949
Duel.Destroy(g,REASON_EFFECT)
5050
end
51-
function s.sdescon(e,tp,eg,ep,ev,re,r,rp)
52-
return e:GetHandler():GetFlagEffect(id)~=0
53-
end
54-
function s.sdestg(e,tp,eg,ep,ev,re,r,rp,chk)
51+
function s.selfdestg(e,tp,eg,ep,ev,re,r,rp,chk)
5552
if chk==0 then return true end
5653
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
5754
end
58-
function s.sdesop(e,tp,eg,ep,ev,re,r,rp)
55+
function s.selfdesop(e,tp,eg,ep,ev,re,r,rp)
5956
local c=e:GetHandler()
6057
if c:IsRelateToEffect(e) and c:IsFaceup() then
6158
Duel.Destroy(c,REASON_EFFECT)
6259
end
63-
end
60+
end

0 commit comments

Comments
 (0)