Commit 48d28789 authored by Tachibana's avatar Tachibana

1145141919810

parent 11df83eb
Pipeline #14739 passed with stages
in 34 minutes and 6 seconds
--卡里莫拉
function c12009046.initial_effect(c)
--link summon
local e0=aux.AddLinkProcedure(c,nil,2,2,c12009046.lcheck)
e0:SetProperty(e0:GetProperty()|EFFECT_FLAG_SET_AVAILABLE)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetDescription(1166)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(c12009046.LinkCondition(aux.TRUE,2,2,c12009046.gf))
e1:SetTarget(c12009046.LinkTarget(aux.TRUE,2,2,c12009046.gf))
e1:SetOperation(aux.LinkOperation(aux.TRUE,2,2,c12009046.gf))
e1:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e1)
--td
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(12009046,0))
......@@ -37,6 +28,10 @@ function c12009046.initial_effect(c)
e3:SetOperation(c12009046.thop)
c:RegisterEffect(e3)
end
function c12009046.lcheck(g,lc)
return g:IsExists(Card.IsPosition,1,nil,POS_FACEDOWN_DEFENSE)
end
--
function c12009046.thfilter(c)
return c:IsFacedown() and c:IsAbleToHand()
......@@ -115,83 +110,3 @@ end
function c12009046.acfilter(c,tp)
return (c:GetType()==TYPE_SPELL or c:GetType()==TYPE_SPELL+TYPE_RITUAL) and c:GetActivateEffect():IsActivatable(tp,true,true)
end
--
function c12009046.gf(g,lc)
return g:IsExists(Card.IsFacedown,1,nil)
end
function c12009046.LConditionFilter(c,f,lc)
return c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end
function c12009046.GetLinkMaterials(tp,f,lc)
local mg=Duel.GetMatchingGroup(c12009046.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,lc)
local mg2=Duel.GetMatchingGroup(aux.LExtraFilter,tp,LOCATION_HAND+LOCATION_SZONE,LOCATION_ONFIELD,nil,f,lc)
if mg2:GetCount()>0 then mg:Merge(mg2) end
return mg
end
function c12009046.LinkCondition(f,minc,maxc,gf)
return
function(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=c12009046.GetLinkMaterials(tp,f,c)
local sg=aux.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL)
if sg:IsExists(aux.MustMaterialCounterFilter,1,nil,mg) then return false end
local ct=sg:GetCount()
if ct>maxc then return false end
return c12009046.LCheckGoal(tp,sg,c,minc,ct,gf)
or mg:IsExists(c12009046.LCheckRecursive,1,sg,tp,sg,mg,c,ct,minc,maxc,gf)
end
end
--
function c12009046.LCheckGoal(tp,sg,lc,minc,ct,gf)
return ct>=minc and sg:CheckWithSumEqual(aux.GetLinkCount,lc:GetLink(),ct,ct) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg))
end
function c12009046.LCheckRecursive(c,tp,sg,mg,lc,ct,minc,maxc,gf)
sg:AddCard(c)
ct=ct+1
local res=c12009046.LCheckGoal(tp,sg,lc,minc,ct,gf)
or (ct<maxc and mg:IsExists(c12009046.LCheckRecursive,1,sg,tp,sg,mg,lc,ct,minc,maxc,gf))
sg:RemoveCard(c)
ct=ct-1
return res
end
function c12009046.LinkTarget(f,minc,maxc,gf)
return
function(e,tp,eg,ep,ev,re,r,rp,chk,c)
local mg=c12009046.GetLinkMaterials(tp,f,c)
local bg=aux.GetMustMaterialGroup(tp,EFFECT_MUST_BE_LMATERIAL)
if #bg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
bg:Select(tp,#bg,#bg,nil)
end
local sg=Group.CreateGroup()
sg:Merge(bg)
local finish=false
while #sg<maxc do
finish=c12009046.LCheckGoal(tp,sg,c,minc,#sg,gf)
local cg=mg:Filter(c12009046.LCheckRecursive,sg,tp,sg,mg,c,#sg,minc,maxc,gf)
if #cg==0 then break end
local cancel=not finish
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local tc=cg:SelectUnselect(sg,tp,finish,cancel,minc,maxc)
if not tc then break end
if not bg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
if #sg==maxc then finish=true end
else
sg:RemoveCard(tc)
end
elseif #bg>0 and #sg<=#bg then
return false
end
end
if finish then
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
end
......@@ -78,7 +78,7 @@ function s.scop(e,tp,eg,ep,ev,re,r,rp)
end
--panish
function s.pncon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(1-tp,id)>0
return Duel.GetFlagEffect(1-tp,id)>0 and aux.dscon()
end
function s.filadchk(c)
return c:IsFaceup() and (c:GetAttack()>0 or c:GetDefense()>0)
......@@ -95,13 +95,13 @@ function s.pnop(e,tp,eg,ep,ev,re,r,rp)
if tc:IsFaceup() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_DEFENSE)
e2:SetCode(EFFECT_SET_DEFENSE_FINAL)
tc:RegisterEffect(e2)
end
local e3=Effect.CreateEffect(e:GetHandler())
......
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