Commit 245b8cd0 authored by Grajade's avatar Grajade

Update script/c22201106.lua

parent f92f7054
Pipeline #7729 failed with stage
in 50 seconds
...@@ -13,37 +13,37 @@ end ...@@ -13,37 +13,37 @@ end
function c22201106.filter(c) function c22201106.filter(c)
return c:IsFaceup() and c:IsCanOverlay() return c:IsFaceup() and c:IsCanOverlay()
end end
function c22201106.filter2(c,g) function c22201106.filter2(sg)
return g:IsExists(Card.IsOriginalCodeRule,1,c,c:GetOriginalCode()) return sg:GetClassCount(Card.GetOriginalCodeRule)==1
end end
function c22201106.spfilter(c,e,tp,ec) function c22201106.spfilter(c,e,tp)
return c:IsCode(22200122) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,ec,c,0x60)>0 return c:IsCode(22200122) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c,0x60)>0
end end
function c22201106.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function c22201106.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and c22201106.filter(chkc) end if chkc then return false end
local g=Duel.GetMatchingGroup(c22201106.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) local g=Duel.GetMatchingGroup(c22201106.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
local sg=g:Filter(c22201106.filter2,nil,g) if chk==0 then return g:CheckSubGroup(c22201106.filter2,2,2,nil) and Duel.IsExistingMatchingCard(c22201106.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,e:GetHandler())
if chk==0 then
return sg:GetCount()>0 and Duel.IsExistingMatchingCard(c22201106.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,e:GetHandler())
end end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local hg1=sg:Select(tp,1,1,nil) local hg=g:SelectSubGroup(tp,c22201106.filter2,false,2,2)
local hg2=sg:Filter(Card.IsOriginalCodeRule,hg1:GetFirst(),hg1:GetFirst():GetOriginalCode()) Duel.SetTargetCard(hg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
hg1:AddCard(hg2:Select(tp,1,1,nil):GetFirst())
Duel.SetTargetCard(hg1)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end end
function c22201106.tfilter(c,e)
return c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e)
end
function c22201106.activate(e,tp,eg,ep,ev,re,r,rp) function c22201106.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,c22201106.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,e:GetHandler()):GetFirst() local tc=Duel.SelectMatchingCard(tp,c22201106.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,0x60)>0 then if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,0x60)>0 then
local fid=c:GetFieldID()
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1) e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetLabel(fid)
e2:SetLabelObject(tc) e2:SetLabelObject(tc)
e2:SetCondition(c22201106.descon) e2:SetCondition(c22201106.descon)
e2:SetOperation(c22201106.desop) e2:SetOperation(c22201106.desop)
...@@ -63,21 +63,20 @@ function c22201106.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -63,21 +63,20 @@ function c22201106.activate(e,tp,eg,ep,ev,re,r,rp)
local e6=e5:Clone() local e6=e5:Clone()
e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e6,true) tc:RegisterEffect(e6,true)
tc:RegisterFlagEffect(22201106,RESET_EVENT+RESETS_STANDARD,0,1) tc:RegisterFlagEffect(22201106,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c22201106.tfilter,nil,e)
if tg:GetCount()<1 then return end if tg:GetCount()>0 then
local tg1=tg:GetFirst():GetOverlayGroup() local dg=Group.CreateGroup()
local tg2=tg:GetNext():GetOverlayGroup() for tc in aux.Next(tg) do
tg1:Merge(tg2) local rg=tc:GetOverlayGroup()
if tg1:GetCount()>0 then if rg:GetCount()>0 then dg:Merge(rg) end
Duel.SendtoGrave(tg1,REASON_RULE) if tc:IsType(TYPE_SPELL+TYPE_TRAP) then tc:CancelToGrave() end
end end
local tc1=tg:GetFirst() if dg:GetCount()>0 then
while tc1 do Duel.SendtoGrave(dg,REASON_RULE)
if tc1:IsType(TYPE_SPELL+TYPE_TRAP) then tc1:CancelToGrave() end
tc1=tg:GetNext()
end end
Duel.Overlay(tc,tg) Duel.Overlay(tc,tg)
end
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE) e1:SetCode(EFFECT_CHANGE_CODE)
...@@ -89,7 +88,7 @@ function c22201106.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -89,7 +88,7 @@ function c22201106.activate(e,tp,eg,ep,ev,re,r,rp)
end end
function c22201106.descon(e,tp,eg,ep,ev,re,r,rp) function c22201106.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject() local tc=e:GetLabelObject()
if tc:GetFlagEffect(22201106)~=0 then if tc:GetFlagEffectLabel(22201106)==e:GetLabel() then
return true return true
else else
e:Reset() e:Reset()
......
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