Skip to content

Commit 928d2ab

Browse files
authored
Update "Trap Eater (Anime)"
Script polish
1 parent bb3c2a8 commit 928d2ab

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

unofficial/c511013002.lua

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
local s,id=GetID()
44
function s.initial_effect(c)
55
c:EnableReviveLimit()
6-
--cannot special summon
6+
--Cannot be Normal Summoned/Set, must be Special Summoned by its own procedure.
77
local e1=Effect.CreateEffect(c)
88
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
99
e1:SetType(EFFECT_TYPE_SINGLE)
1010
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
1111
c:RegisterEffect(e1)
12-
--spsummon proc
12+
--Special Summon procedure: Send 1 faceup Trap your opponent controls to the GY
1313
local e2=Effect.CreateEffect(c)
1414
e2:SetType(EFFECT_TYPE_FIELD)
1515
e2:SetCode(EFFECT_SPSUMMON_PROC)
@@ -19,28 +19,28 @@ function s.initial_effect(c)
1919
e2:SetTarget(s.sptg)
2020
e2:SetOperation(s.spop)
2121
c:RegisterEffect(e2)
22-
--destroy
22+
--Destroy 1 card in the Spell/Trap Zones
2323
local e3=Effect.CreateEffect(c)
2424
e3:SetDescription(aux.Stringid(998999,0))
2525
e3:SetCategory(CATEGORY_DESTROY)
2626
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
2727
e3:SetCode(EVENT_TO_GRAVE)
28-
e3:SetCondition(s.condition)
29-
e3:SetTarget(s.target)
30-
e3:SetOperation(s.operation)
28+
e3:SetCondition(s.descon)
29+
e3:SetTarget(s.destg)
30+
e3:SetOperation(s.desop)
3131
c:RegisterEffect(e3)
3232
end
3333
function s.spfilter(c)
34-
return c:IsFaceup() and c:IsTrap() and c:IsAbleToGraveAsCost()
34+
return c:IsTrap() and c:IsAbleToGraveAsCost()
3535
end
3636
function s.spcon(e,c)
3737
if c==nil then return true end
3838
local tp=c:GetControler()
39-
local g=Duel.GetMatchingGroup(s.spfilter,tp,0,LOCATION_ONFIELD,nil)
39+
local g=Duel.GetMatchingGroup(aux.FaceupFilter(s.spfilter),tp,0,LOCATION_ONFIELD,nil)
4040
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 and aux.SelectUnselectGroup(g,e,tp,1,1,aux.ChkfMMZ(1),0)
4141
end
4242
function s.sptg(e,tp,eg,ep,ev,re,r,rp,c)
43-
local rg=Duel.GetMatchingGroup(s.spfilter,tp,0,LOCATION_ONFIELD,nil)
43+
local rg=Duel.GetMatchingGroup(aux.FaceupFilter(s.spfilter),tp,0,LOCATION_ONFIELD,nil)
4444
local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_TOGRAVE,aux.ChkfMMZ(1),nil,true)
4545
if #g>0 then
4646
g:KeepAlive()
@@ -55,22 +55,18 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
5555
Duel.SendtoGrave(g,REASON_COST)
5656
g:DeleteGroup()
5757
end
58-
function s.condition(e,tp,eg,ep,ev,re,r,rp)
58+
function s.descon(e,tp,eg,ep,ev,re,r,rp)
5959
local c=e:GetHandler()
60-
return c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp)
61-
and (c:GetPreviousLocation()&LOCATION_ONFIELD)~=0
60+
return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD)
6261
end
63-
function s.filter2(c)
64-
return c:IsSpellTrap() and c:IsDestructable()
65-
end
66-
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
67-
if chkc then return chkc:IsLocation(LOCATION_SZONE) and s.filter2(chkc) and chkc~=e:GetHandler() end
68-
if chk==0 then return Duel.IsExistingTarget(s.filter2,tp,LOCATION_SZONE,LOCATION_SZONE,1,e:GetHandler()) end
62+
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
63+
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsDestructable() and chkc~=e:GetHandler() end
64+
if chk==0 then return Duel.IsExistingTarget(Card.IsDestructable,tp,LOCATION_SZONE,LOCATION_SZONE,1,e:GetHandler()) end
6965
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
70-
local g=Duel.SelectTarget(tp,s.filter2,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,e:GetHandler())
66+
local g=Duel.SelectTarget(tp,Card.IsDestructable,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,e:GetHandler())
7167
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,1,0,0)
7268
end
73-
function s.operation(e,tp,eg,ep,ev,re,r,rp)
69+
function s.desop(e,tp,eg,ep,ev,re,r,rp)
7470
local tc=Duel.GetFirstTarget()
7571
if tc and tc:IsRelateToEffect(e) then
7672
Duel.Destroy(tc,REASON_EFFECT)

0 commit comments

Comments
 (0)