Commit 245b8cd0 authored by Grajade's avatar Grajade

Update script/c22201106.lua

parent f92f7054
Pipeline #7729 failed with stage
in 50 seconds
--未曾预见
function c22201106.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c22201106.target)
e1:SetOperation(c22201106.activate)
c:RegisterEffect(e1)
end
function c22201106.filter(c)
return c:IsFaceup() and c:IsCanOverlay()
end
function c22201106.filter2(c,g)
return g:IsExists(Card.IsOriginalCodeRule,1,c,c:GetOriginalCode())
end
function c22201106.spfilter(c,e,tp,ec)
return c:IsCode(22200122) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,ec,c,0x60)>0
end
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
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 sg:GetCount()>0 and Duel.IsExistingMatchingCard(c22201106.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,e:GetHandler())
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local hg1=sg:Select(tp,1,1,nil)
local hg2=sg:Filter(Card.IsOriginalCodeRule,hg1:GetFirst(),hg1:GetFirst():GetOriginalCode())
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)
end
function c22201106.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
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()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,0x60)>0 then
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetLabelObject(tc)
e2:SetCondition(c22201106.descon)
e2:SetOperation(c22201106.desop)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3,true)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e4,true)
local e5=e3:Clone()
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e5,true)
local e6=e5:Clone()
e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e6,true)
tc:RegisterFlagEffect(22201106,RESET_EVENT+RESETS_STANDARD,0,1)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,e)
if tg:GetCount()<1 then return end
local tg1=tg:GetFirst():GetOverlayGroup()
local tg2=tg:GetNext():GetOverlayGroup()
tg1:Merge(tg2)
if tg1:GetCount()>0 then
Duel.SendtoGrave(tg1,REASON_RULE)
end
local tc1=tg:GetFirst()
while tc1 do
if tc1:IsType(TYPE_SPELL+TYPE_TRAP) then tc1:CancelToGrave() end
tc1=tg:GetNext()
end
Duel.Overlay(tc,tg)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(tg:GetFirst():GetOriginalCode())
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
function c22201106.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(22201106)~=0 then
return true
else
e:Reset()
return false
end
end
function c22201106.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.Destroy(tc,REASON_EFFECT)
end
\ No newline at end of file
--未曾预见
function c22201106.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(c22201106.target)
e1:SetOperation(c22201106.activate)
c:RegisterEffect(e1)
end
function c22201106.filter(c)
return c:IsFaceup() and c:IsCanOverlay()
end
function c22201106.filter2(sg)
return sg:GetClassCount(Card.GetOriginalCodeRule)==1
end
function c22201106.spfilter(c,e,tp)
return c:IsCode(22200122) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c,0x60)>0
end
function c22201106.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local g=Duel.GetMatchingGroup(c22201106.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)
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())
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local hg=g:SelectSubGroup(tp,c22201106.filter2,false,2,2)
Duel.SetTargetCard(hg)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
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)
local c=e:GetHandler()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
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
local fid=c:GetFieldID()
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetCountLimit(1)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetLabel(fid)
e2:SetLabelObject(tc)
e2:SetCondition(c22201106.descon)
e2:SetOperation(c22201106.desop)
Duel.RegisterEffect(e2,tp)
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL)
e3:SetValue(1)
e3:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e3,true)
local e4=e3:Clone()
e4:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL)
tc:RegisterEffect(e4,true)
local e5=e3:Clone()
e5:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL)
tc:RegisterEffect(e5,true)
local e6=e5:Clone()
e6:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e6,true)
tc:RegisterFlagEffect(22201106,RESET_EVENT+RESETS_STANDARD,0,1,fid)
local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(c22201106.tfilter,nil,e)
if tg:GetCount()>0 then
local dg=Group.CreateGroup()
for tc in aux.Next(tg) do
local rg=tc:GetOverlayGroup()
if rg:GetCount()>0 then dg:Merge(rg) end
if tc:IsType(TYPE_SPELL+TYPE_TRAP) then tc:CancelToGrave() end
end
if dg:GetCount()>0 then
Duel.SendtoGrave(dg,REASON_RULE)
end
Duel.Overlay(tc,tg)
end
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(tg:GetFirst():GetOriginalCode())
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
function c22201106.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(22201106)==e:GetLabel() then
return true
else
e:Reset()
return false
end
end
function c22201106.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.Destroy(tc,REASON_EFFECT)
end
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