Commit 5eb93685 authored by mercury233's avatar mercury233 Committed by DailyShana

update Card.IsLinkSummonable and Duel.LinkSummon (#1190)

parent 2419fc3e
...@@ -11,7 +11,7 @@ function c12989604.initial_effect(c) ...@@ -11,7 +11,7 @@ function c12989604.initial_effect(c)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function c12989604.filter(c) function c12989604.filter(c)
return c:IsSpecialSummonable(SUMMON_TYPE_LINK) return c:IsLinkSummonable(nil)
end end
function c12989604.target(e,tp,eg,ep,ev,re,r,rp,chk) function c12989604.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c12989604.filter,tp,LOCATION_EXTRA,0,1,nil) end if chk==0 then return Duel.IsExistingMatchingCard(c12989604.filter,tp,LOCATION_EXTRA,0,1,nil) end
...@@ -22,6 +22,6 @@ function c12989604.activate(e,tp,eg,ep,ev,re,r,rp) ...@@ -22,6 +22,6 @@ function c12989604.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,c12989604.filter,tp,LOCATION_EXTRA,0,1,1,nil) local g=Duel.SelectMatchingCard(tp,c12989604.filter,tp,LOCATION_EXTRA,0,1,1,nil)
local tc=g:GetFirst() local tc=g:GetFirst()
if tc then if tc then
Duel.SpecialSummonRule(tp,tc,SUMMON_TYPE_LINK) Duel.LinkSummon(tp,tc,nil)
end end
end end
...@@ -36,50 +36,25 @@ end ...@@ -36,50 +36,25 @@ end
function c15447747.matfilter(c) function c15447747.matfilter(c)
return c:IsFaceup() and c:IsSetCard(0x120) return c:IsFaceup() and c:IsSetCard(0x120)
end end
function c15447747.lkfilter(c) function c15447747.lkfilter(c,mg)
return c:IsSetCard(0x120) and c:IsType(TYPE_LINK) and c:IsSpecialSummonable(SUMMON_TYPE_LINK) return c:IsSetCard(0x120) and c:IsLinkSummonable(mg)
end end
function c15447747.lktg(e,tp,eg,ep,ev,re,r,rp,chk) function c15447747.lktg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then if chk==0 then
local el={}
local mg=Duel.GetMatchingGroup(c15447747.matfilter,tp,LOCATION_MZONE,0,nil) local mg=Duel.GetMatchingGroup(c15447747.matfilter,tp,LOCATION_MZONE,0,nil)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,mg) return Duel.IsExistingMatchingCard(c15447747.lkfilter,tp,LOCATION_EXTRA,0,1,nil,mg)
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e1)
table.insert(el,e1)
end
local res=Duel.IsExistingMatchingCard(c15447747.lkfilter,tp,LOCATION_EXTRA,0,1,nil)
for _,e in ipairs(el) do
e:Reset()
end
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 c15447747.lkop(e,tp,eg,ep,ev,re,r,rp) function c15447747.lkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end if not c:IsRelateToEffect(e) then return end
local el={}
local mg=Duel.GetMatchingGroup(c15447747.matfilter,tp,LOCATION_MZONE,0,nil) local mg=Duel.GetMatchingGroup(c15447747.matfilter,tp,LOCATION_MZONE,0,nil)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,mg)
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
tc:RegisterEffect(e1)
table.insert(el,e1)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local xg=Duel.SelectMatchingCard(tp,c15447747.lkfilter,tp,LOCATION_EXTRA,0,1,1,nil) local tg=Duel.SelectMatchingCard(tp,c15447747.lkfilter,tp,LOCATION_EXTRA,0,1,1,nil,mg)
local tc=xg:GetFirst() local tc=tg:GetFirst()
if tc then if tc then
Duel.SpecialSummonRule(tp,tc,SUMMON_TYPE_LINK) Duel.LinkSummon(tp,tc,mg)
end
for _,e in ipairs(el) do
e:Reset()
end end
end end
function c15447747.atkcon(e,tp,eg,ep,ev,re,r,rp) function c15447747.atkcon(e,tp,eg,ep,ev,re,r,rp)
......
...@@ -1827,26 +1827,50 @@ function Auxiliary.LCheckGoal(sg,tp,lc,gf) ...@@ -1827,26 +1827,50 @@ function Auxiliary.LCheckGoal(sg,tp,lc,gf)
and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg)) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg))
and not sg:IsExists(Auxiliary.LUncompatibilityFilter,1,nil,sg,lc) and not sg:IsExists(Auxiliary.LUncompatibilityFilter,1,nil,sg,lc)
end end
function Auxiliary.LinkCondition(f,min,max,gf) function Auxiliary.LinkCondition(f,minc,maxc,gf)
return function(e,c) return function(e,c,og,min,max)
if c==nil then return true end if c==nil then return true end
if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end if c:IsType(TYPE_PENDULUM) and c:IsFaceup() then return false end
local minc=minc
local maxc=maxc
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
if minc>maxc then return false end
end
local tp=c:GetControler() local tp=c:GetControler()
local mg=Auxiliary.GetLinkMaterials(tp,f,c) local mg=nil
if og then
mg=og:Filter(Auxiliary.LConditionFilter,nil,f,c)
else
mg=Auxiliary.GetLinkMaterials(tp,f,c)
end
local fg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL) local fg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL)
if fg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end if fg:IsExists(Auxiliary.MustMaterialCounterFilter,1,nil,mg) then return false end
Duel.SetSelectedCard(fg) Duel.SetSelectedCard(fg)
return mg:CheckSubGroup(Auxiliary.LCheckGoal,min,max,tp,c,gf) return mg:CheckSubGroup(Auxiliary.LCheckGoal,minc,maxc,tp,c,gf)
end end
end end
function Auxiliary.LinkTarget(f,min,max,gf) function Auxiliary.LinkTarget(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,chk,c) return function(e,tp,eg,ep,ev,re,r,rp,chk,c,og,min,max)
local mg=Auxiliary.GetLinkMaterials(tp,f,c) local minc=minc
local maxc=maxc
if min then
if min>minc then minc=min end
if max<maxc then maxc=max end
if minc>maxc then return false end
end
local mg=nil
if og then
mg=og:Filter(Auxiliary.LConditionFilter,nil,f,c)
else
mg=Auxiliary.GetLinkMaterials(tp,f,c)
end
local fg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL) local fg=Auxiliary.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL)
Duel.SetSelectedCard(fg) Duel.SetSelectedCard(fg)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local cancel=Duel.GetCurrentChain()==0 local cancel=Duel.GetCurrentChain()==0
local sg=mg:SelectSubGroup(tp,Auxiliary.LCheckGoal,cancel,min,max,tp,c,gf) local sg=mg:SelectSubGroup(tp,Auxiliary.LCheckGoal,cancel,minc,maxc,tp,c,gf)
if sg then if sg then
sg:KeepAlive() sg:KeepAlive()
e:SetLabelObject(sg) e:SetLabelObject(sg)
...@@ -1854,8 +1878,8 @@ function Auxiliary.LinkTarget(f,min,max,gf) ...@@ -1854,8 +1878,8 @@ function Auxiliary.LinkTarget(f,min,max,gf)
else return false end else return false end
end end
end end
function Auxiliary.LinkOperation(f,min,max,gf) function Auxiliary.LinkOperation(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,c,smat,mg) return function(e,tp,eg,ep,ev,re,r,rp,c,og,min,max)
local g=e:GetLabelObject() local g=e:GetLabelObject()
c:SetMaterial(g) c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK) Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK)
......
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