Commit 3712784a authored by TanakaKotoha's avatar TanakaKotoha

fix

parent ea01f5a4
...@@ -2,18 +2,18 @@ ...@@ -2,18 +2,18 @@
local m=69696918 local m=69696918
local cm=_G["c"..m] local cm=_G["c"..m]
function cm.initial_effect(c) function cm.initial_effect(c)
aux.AddLinkProcedure(c,nil,2,99,cm.lcheck)
c:EnableReviveLimit() c:EnableReviveLimit()
--extra link local e01=Effect.CreateEffect(c)
local e0=Effect.CreateEffect(c) e01:SetDescription(1166)
e0:SetType(EFFECT_TYPE_FIELD) e01:SetType(EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE) e01:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetRange(LOCATION_EXTRA) e01:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e0:SetTarget(cm.mattg) e01:SetRange(LOCATION_EXTRA)
e0:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e01:SetCondition(cm.LinkCondition(aux.TRUE,2,3,cm.gf))
e0:SetTargetRange(LOCATION_EXTRA,0) e01:SetTarget(cm.LinkTarget(aux.TRUE,2,3,cm.gf))
e0:SetValue(cm.matval) e01:SetOperation(aux.LinkOperation(aux.TRUE,2,3,cm.gf))
c:RegisterEffect(e0) e01:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e01)
--destroy --destroy
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0)) e1:SetDescription(aux.Stringid(m,0))
...@@ -38,15 +38,86 @@ function cm.initial_effect(c) ...@@ -38,15 +38,86 @@ function cm.initial_effect(c)
e2:SetOperation(cm.spop) e2:SetOperation(cm.spop)
c:RegisterEffect(e2) c:RegisterEffect(e2)
end end
function cm.mattg(e,c) function cm.gf(g,lc)
return c:IsRace(RACE_SPELLCASTER) and c:IsFaceup() return g:IsExists(Card.IsRace,1,nil,RACE_SPELLCASTER)
end end
function cm.matval(e,c,mg) function cm.LConditionFilter(c,f,lc)
return c:IsCode(69696918) if c:IsLocation(LOCATION_EXTRA) then return c:IsCanBeLinkMaterial(lc) and (not f or f(c)) and c:IsFaceup() end
return c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end end
function cm.lcheck(g,lc) function cm.GetLinkMaterials(tp,f,lc)
return g:IsExists(Card.IsRace,1,nil,RACE_SPELLCASTER) local mg=Duel.GetMatchingGroup(cm.LConditionFilter,tp,LOCATION_MZONE+LOCATION_EXTRA,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 cm.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=cm.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 cm.LCheckGoal(tp,sg,c,minc,ct,gf)
or mg:IsExists(cm.LCheckRecursive,1,sg,tp,sg,mg,c,ct,minc,maxc,gf)
end
end
--
function cm.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 end
function cm.LCheckRecursive(c,tp,sg,mg,lc,ct,minc,maxc,gf)
sg:AddCard(c)
ct=ct+1
local res=cm.LCheckGoal(tp,sg,lc,minc,ct,gf)
or (ct<maxc and mg:IsExists(cm.LCheckRecursive,1,sg,tp,sg,mg,lc,ct,minc,maxc,gf))
sg:RemoveCard(c)
ct=ct-1
return res
end
function cm.LinkTarget(f,minc,maxc,gf)
return
function(e,tp,eg,ep,ev,re,r,rp,chk,c)
local mg=cm.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=cm.LCheckGoal(tp,sg,c,minc,#sg,gf)
local cg=mg:Filter(cm.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
function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) function cm.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end if chkc then return false end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,0,1,nil) if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,0,1,nil)
...@@ -65,10 +136,13 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp) ...@@ -65,10 +136,13 @@ function cm.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tg,REASON_EFFECT) Duel.Destroy(tg,REASON_EFFECT)
end end
end end
function cm.filter22(c,tp)
return c:GetPreviousControler()==tp and c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function cm.spcon(e,tp,eg,ep,ev,re,r,rp) function cm.spcon(e,tp,eg,ep,ev,re,r,rp)
local sg=eg:Filter(Card.IsControler,e:GetHandler(),tp) local sg=eg:Filter(cm.filter22,e:GetHandler(),tp)
local tc=sg:GetFirst() local tc=sg:GetFirst()
if sg:GetCount()==1 and tc:IsReason(REASON_BATTLE+REASON_EFFECT) and tc:IsPreviousLocation(LOCATION_MZONE) and tc:GetControler()==tp then if sg:GetCount()==1 then
e:SetLabel(tc:GetPreviousRaceOnField()) e:SetLabel(tc:GetPreviousRaceOnField())
return true return true
else return false end else return false 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