Commit eea13527 authored by Grajade's avatar Grajade

Update c21133.lua

parent cd412cd1
Pipeline #8771 passed with stage
in 32 seconds
...@@ -24,7 +24,7 @@ function c21133.initial_effect(c) ...@@ -24,7 +24,7 @@ function c21133.initial_effect(c)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function c21133.rfilter(c) function c21133.rfilter(c)
return c:IsSetCard(0x208) return c:IsSetCard(0x208) and c:IsType(TYPE_MONSTER)
end end
function c21133.cost(e,tp,eg,ep,ev,re,r,rp,chk) function c21133.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroupEx(tp,c21133.rfilter,1,nil) end if chk==0 then return Duel.CheckReleaseGroupEx(tp,c21133.rfilter,1,nil) end
...@@ -32,7 +32,7 @@ function c21133.cost(e,tp,eg,ep,ev,re,r,rp,chk) ...@@ -32,7 +32,7 @@ function c21133.cost(e,tp,eg,ep,ev,re,r,rp,chk)
Duel.Release(g,REASON_COST) Duel.Release(g,REASON_COST)
end end
function c21133.filter(c) function c21133.filter(c)
return c:IsSetCard(0x522a) and c:IsType(TYPE_SPELL+TYPE_TRAP) and c:IsSSetable(true) return c:IsSetCard(0x522a) and c:IsType(TYPE_TRAP) and c:IsSSetable()
end end
function c21133.settg(e,tp,eg,ep,ev,re,r,rp,chk) function c21133.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>1 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>1
...@@ -47,33 +47,44 @@ function c21133.setop(e,tp,eg,ep,ev,re,r,rp) ...@@ -47,33 +47,44 @@ function c21133.setop(e,tp,eg,ep,ev,re,r,rp)
Duel.ConfirmCards(1-tp,g) Duel.ConfirmCards(1-tp,g)
end end
end end
function c21133.rmfilter(c,sp) function c21133.rmfilter(c,tp)
return c:GetSummonPlayer()==sp and c:IsAbleToRemove() and not c:IsPreviousLocation(LOCATION_HAND) and c:IsLocation(LOCATION_MZONE) return c:IsSummonPlayer(tp) and c:IsAbleToRemove(tp,POS_FACEDOWN) and not c:IsPreviousLocation(LOCATION_HAND)
end end
function c21133.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) function c21133.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(c21133.rmfilter,1,nil,1-tp) end if chk==0 then return eg:IsExists(c21133.rmfilter,1,nil,1-tp) end
local g=eg:Filter(c21133.rmfilter,nil,1-tp) local g=eg:Filter(c21133.rmfilter,nil,tp)
Duel.SetTargetCard(g) Duel.SetTargetCard(g)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,g:GetCount(),0,0)
end end
function c21133.rmop(e,tp,eg,ep,ev,re,r,rp) function c21133.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT+REASON_TEMPORARY)~=0 then if Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT+REASON_TEMPORARY)~=0 then
local tc=g:GetFirst() local fid=e:GetHandler():GetFieldID()
while tc do for tc in aux.Next(g) do
local e1=Effect.CreateEffect(e:GetHandler()) tc:RegisterFlagEffect(21133,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1,fid)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetRange(LOCATION_REMOVED)
e1:SetCountLimit(1)
e1:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e1:SetOperation(c21133.retop)
tc:RegisterEffect(e1)
tc=g:GetNext()
end end
g:KeepAlive()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(g)
e1:SetCondition(c21133.retcon)
e1:SetOperation(c21133.retop)
e1:SetReset(RESET_PHASE+PHASE_END)
Duel.RegisterEffect(e1,tp)
end end
end end
function c21133.retop(e,tp,eg,ep,ev,re,r,rp) function c21133.retfilter(c,fid)
Duel.ReturnToField(e:GetHandler()) return c:GetFlagEffect(21133)>0 and c:GetFlagEffectLabel(21133)==fid
e:Reset() end
function c21133.retcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetLabelObject():IsExists(c21133.retfilter,1,nil,e:GetLabel())
end end
function c21133.retop(e,tp,eg,ep,ev,re,r,rp)
local g=e:GetLabelObject():Filter(c21133.retfilter,nil,e:GetLabel())
for tc in aux.Next(g) do
Duel.ReturnToField(tc)
end
end
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment