Commit 9c2d25f8 authored by GuGu's avatar GuGu

Update c26507.lua

parent 0349f1de
Pipeline #33400 passed with stage
in 8 seconds
--漏洞与错误的连结✿封兽鵺 --漏洞与错误的连结✿封兽鵺
function c26507.initial_effect(c) function c26507.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--link summon --link summon
local e1=Effect.CreateEffect(c) c26507.AddLinkProcedure(c,aux.TRUE,1,1)
e1:SetType(EFFECT_TYPE_FIELD) --spsummon
e1:SetDescription(aux.Stringid(26507,0)) local e3=Effect.CreateEffect(c)
e1:SetCode(EFFECT_SPSUMMON_PROC) e3:SetDescription(aux.Stringid(26507,1))
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON)
e1:SetRange(LOCATION_EXTRA) e3:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCondition(c26507.lkcon) e3:SetCode(EVENT_FREE_CHAIN)
e1:SetOperation(c26507.lkop) e3:SetHintTiming(0,0x1c0+TIMING_MAIN_END)
e1:SetValue(SUMMON_TYPE_LINK) e3:SetRange(LOCATION_MZONE)
c:RegisterEffect(e1) e3:SetCountLimit(1)
--spsummon e3:SetCondition(c26507.condition)
local e3=Effect.CreateEffect(c) e3:SetTarget(c26507.fustg)
e3:SetDescription(aux.Stringid(26507,1)) e3:SetOperation(c26507.fusop)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) c:RegisterEffect(e3)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetHintTiming(0,0x1c0+TIMING_MAIN_END)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c26507.condition)
e3:SetTarget(c26507.fustg)
e3:SetOperation(c26507.fusop)
c:RegisterEffect(e3)
end
function c26507.lkfilter(c,lc)
local tp=lc:GetControler()
return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and Duel.GetLocationCountFromEx(tp,tp,c,lc)>0
end
function c26507.lkcon(e,c)
if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local tp=c:GetControler()
local mg=Duel.GetMatchingGroup(c26507.lkfilter,tp,LOCATION_MZONE,0,nil,c)
return mg:GetCount()>0
end end
function c26507.lkop(e,tp,eg,ep,ev,re,r,rp,c) function c26507.lkop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(c26507.lkfilter,tp,LOCATION_MZONE,0,nil,c) local sg=e:GetLabelObject()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL) local tc=sg:GetFirst()
local sg=mg:Select(tp,1,1,nil) local code=tc:GetOriginalCode()
local tc=sg:GetFirst() c:SetMaterial(sg)
local code=tc:GetOriginalCode() aux.LExtraMaterialCount(sg,c,tp)
c:SetMaterial(sg) Duel.SendtoGrave(sg,REASON_MATERIAL+REASON_LINK)
Duel.SendtoGrave(sg,REASON_MATERIAL+REASON_LINK) local e1=Effect.CreateEffect(c)
local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT+0xfe0000)
e1:SetReset(RESET_EVENT+0xfe0000) e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(code)
e1:SetValue(code) c:RegisterEffect(e1)
c:RegisterEffect(e1) local e2=Effect.CreateEffect(c)
local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_TRIGGER)
e2:SetCode(EFFECT_CANNOT_TRIGGER) e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END)
e2:SetReset(RESET_EVENT+0x1fe0000+RESET_PHASE+PHASE_END) if tc then
if tc then tc:RegisterEffect(e2,true)
tc:RegisterEffect(e2,true) end
end local e3=Effect.CreateEffect(c)
local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD)
e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0)
e3:SetTargetRange(1,0) e3:SetTarget(c26507.splimit)
e3:SetTarget(c26507.splimit) e3:SetReset(RESET_PHASE+PHASE_END)
e3:SetReset(RESET_PHASE+PHASE_END) Duel.RegisterEffect(e3,tp)
Duel.RegisterEffect(e3,tp) sg:DeleteGroup()
end end
function c26507.splimit(e,c,tp,sumtp,sumpos) function c26507.splimit(e,c,tp,sumtp,sumpos)
return bit.band(sumtp,SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK return bit.band(sumtp,SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK
end end
function c26507.condition(e,tp,eg,ep,ev,re,r,rp) function c26507.condition(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase() local ph=Duel.GetCurrentPhase()
return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2) return (ph==PHASE_MAIN1 or ph==PHASE_MAIN2)
end end
function c26507.filter1(c,e) function c26507.filter1(c,e)
return not c:IsImmuneToEffect(e) return not c:IsImmuneToEffect(e)
end end
function c26507.filter2(c,e,tp,m,f,chkf) function c26507.filter2(c,e,tp,m,f,chkf)
return c:IsType(TYPE_FUSION) and (not f or f(c)) return c:IsType(TYPE_FUSION) and (not f or f(c))
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) and c:CheckFusionMaterial(m,nil,chkf)
end end
function c26507.fustg(e,tp,eg,ep,ev,re,r,rp,chk) function c26507.fustg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local chkf=tp local chkf=tp
local mg1=Duel.GetMatchingGroup(filter1,tp,LOCATION_MZONE,0,nil) local mg1=Duel.GetMatchingGroup(filter1,tp,LOCATION_MZONE,0,nil)
local res=Duel.IsExistingMatchingCard(c26507.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf) local res=Duel.IsExistingMatchingCard(c26507.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg1,nil,chkf)
if not res then if not res then
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
local fgroup=ce:GetTarget() local fgroup=ce:GetTarget()
local mg2=fgroup(ce,e,tp) local mg2=fgroup(ce,e,tp)
local mf=ce:GetValue() local mf=ce:GetValue()
res=Duel.IsExistingMatchingCard(c26507.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf) res=Duel.IsExistingMatchingCard(c26507.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,mg2,mf,chkf)
end end
end end
return res return res
end end
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 c26507.fusop(e,tp,eg,ep,ev,re,r,rp) function c26507.fusop(e,tp,eg,ep,ev,re,r,rp)
local chkf=tp local chkf=tp
local mg1=Duel.GetMatchingGroup(filter1,tp,LOCATION_MZONE,0,nil) local mg1=Duel.GetMatchingGroup(filter1,tp,LOCATION_MZONE,0,nil)
local sg1=Duel.GetMatchingGroup(c26507.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf) local sg1=Duel.GetMatchingGroup(c26507.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg1,nil,chkf)
local mg2=nil local mg2=nil
local sg2=nil local sg2=nil
local ce=Duel.GetChainMaterial(tp) local ce=Duel.GetChainMaterial(tp)
if ce~=nil then if ce~=nil then
local fgroup=ce:GetTarget() local fgroup=ce:GetTarget()
mg2=fgroup(ce,e,tp) mg2=fgroup(ce,e,tp)
local mf=ce:GetValue() local mf=ce:GetValue()
sg2=Duel.GetMatchingGroup(c26507.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf) sg2=Duel.GetMatchingGroup(c26507.filter2,tp,LOCATION_EXTRA,0,nil,e,tp,mg2,mf,chkf)
end end
if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then if sg1:GetCount()>0 or (sg2~=nil and sg2:GetCount()>0) then
local sg=sg1:Clone() local sg=sg1:Clone()
if sg2 then sg:Merge(sg2) end if sg2 then sg:Merge(sg2) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tg=sg:Select(tp,1,1,nil) local tg=sg:Select(tp,1,1,nil)
local tc=tg:GetFirst() local tc=tg:GetFirst()
if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then if sg1:IsContains(tc) and (sg2==nil or not sg2:IsContains(tc) or not Duel.SelectYesNo(tp,ce:GetDescription())) then
local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf) local mat1=Duel.SelectFusionMaterial(tp,tc,mg1,nil,chkf)
tc:SetMaterial(mat1) tc:SetMaterial(mat1)
Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION) Duel.SendtoGrave(mat1,REASON_EFFECT+REASON_MATERIAL+REASON_FUSION)
Duel.BreakEffect() Duel.BreakEffect()
Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)
else else
local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf) local mat2=Duel.SelectFusionMaterial(tp,tc,mg2,nil,chkf)
local fop=ce:GetOperation() local fop=ce:GetOperation()
fop(ce,e,tp,tc,mat2) fop(ce,e,tp,tc,mat2)
end end
tc:CompleteProcedure() tc:CompleteProcedure()
end end
end end
--
function c26507.AddLinkProcedure(c,f,min,max,gf)
if max==nil then max=c:GetLink() end
local e1=Effect.CreateEffect(c)
e1:SetDescription(1166)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(aux.LinkCondition(f,min,max,gf))
e1:SetTarget(aux.LinkTarget(f,min,max,gf))
e1:SetOperation(c26507.lkop)
e1:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e1)
return e1
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