Commit 28d665d8 authored by TanakaKotoha's avatar TanakaKotoha

fix

parent bb269da3
No preview for this file type
...@@ -4,18 +4,19 @@ local m=33700785 ...@@ -4,18 +4,19 @@ local m=33700785
local cm=_G["c"..m] local cm=_G["c"..m]
function cm.initial_effect(c) function cm.initial_effect(c)
--link summon --link summon
aux.AddLinkProcedure(c,cm.lfilter(c:GetControler()),2,2) aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_CYBERSE+RACE_MACHINE),2,2)
c:EnableReviveLimit() c:EnableReviveLimit()
--extra link --extra link
local e0=Effect.CreateEffect(c) local e0=Effect.CreateEffect(c)
e0:SetDescription(aux.Stringid(12035010,0))
e0:SetType(EFFECT_TYPE_FIELD) e0:SetType(EFFECT_TYPE_FIELD)
e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE) e0:SetCode(EFFECT_SPSUMMON_PROC)
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e0:SetRange(LOCATION_EXTRA) e0:SetRange(LOCATION_EXTRA)
e0:SetTarget(cm.mattg) e0:SetCondition(cm.lkcon)
e0:SetCode(EFFECT_EXTRA_LINK_MATERIAL) e0:SetOperation(cm.lkop)
e0:SetTargetRange(LOCATION_SZONE,0) e0:SetValue(SUMMON_TYPE_LINK)
e0:SetValue(cm.matval) c:RegisterEffect(e0)
c:RegisterEffect(e0)
-- --
local e1=Effect.CreateEffect(c) local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND) e1:SetCategory(CATEGORY_TOHAND)
...@@ -28,6 +29,80 @@ function cm.initial_effect(c) ...@@ -28,6 +29,80 @@ function cm.initial_effect(c)
e1:SetOperation(cm.thop) e1:SetOperation(cm.thop)
c:RegisterEffect(e1) c:RegisterEffect(e1)
end end
function cm.cknfilter(c)
return c:GetOriginalCode()==77765004 and not c:IsDisabled()
end
function cm.lkfilter(c,lc,tp)
local flag=c:IsFaceup() and c:IsCanBeLinkMaterial(lc)
if c:IsType(TYPE_MONSTER) then
return flag and c:IsLinkRace(RACE_CYBERSE+RACE_MACHINE)
else
return c:IsFaceup() and c:IsType(TYPE_SPELL) and not Duel.IsExistingMatchingCard(cm.cknfilter,tp,0,LOCATION_SZONE,1,nil)
end
end
function cm.lvfilter(c)
if c:IsType(TYPE_LINK) and c:GetLink()>1 then
return 1+0x10000*c:GetLink()
else
return 1
end
end
--
function cm.lcheck(tp,sg,lc,minc,ct)
return ct>=minc and sg:CheckWithSumEqual(cm.lvfilter,lc:GetLink(),ct,ct) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0
end
function cm.lkchenk(c,tp,sg,mg,lc,ct,minc,maxc)
sg:AddCard(c)
ct=ct+1
local res=cm.lcheck(tp,sg,lc,minc,ct) or (ct<maxc and mg:IsExists(cm.lkchenk,1,sg,tp,sg,mg,lc,ct,minc,maxc))
sg:RemoveCard(c)
ct=ct-1
return res
end
function cm.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(cm.lkfilter,tp,LOCATION_ONFIELD,0,nil,c,tp)
local sg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_LMATERIAL)}) do
local pc=pe:GetHandler()
if not mg:IsContains(pc) then return false end
sg:AddCard(pc)
end
local ct=sg:GetCount()
local minc=2
local maxc=2
if ct>maxc then return false end
return cm.lcheck(tp,sg,c,minc,ct) or mg:IsExists(cm.lkchenk,1,nil,tp,sg,mg,c,ct,minc,maxc)
end
function cm.lkop(e,tp,eg,ep,ev,re,r,rp,c)
local mg=Duel.GetMatchingGroup(cm.lkfilter,tp,LOCATION_ONFIELD,0,nil,c,tp)
local sg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_LMATERIAL)}) do
sg:AddCard(pe:GetHandler())
end
local ct=sg:GetCount()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
sg:Select(tp,ct,ct,nil)
local minc=2
local maxc=2
for i=ct,maxc-1 do
local cg=mg:Filter(cm.lkchenk,sg,tp,sg,mg,c,i,minc,maxc)
if cg:GetCount()==0 then break end
local minct=1
if cm.lcheck(tp,sg,c,minc,i) then
if not Duel.SelectYesNo(tp,aux.Stringid(12035010,0)) then break end
minct=0
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local g=cg:Select(tp,minct,1,nil)
if g:GetCount()==0 then break end
sg:Merge(g)
end
c:SetMaterial(sg)
Duel.SendtoGrave(sg,REASON_MATERIAL+REASON_LINK)
end
function cm.thcon(e,tp,eg,ep,ev,re,r,rp) function cm.thcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler() local c=e:GetHandler()
return c:IsSummonType(SUMMON_TYPE_LINK) return c:IsSummonType(SUMMON_TYPE_LINK)
...@@ -57,21 +132,4 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -57,21 +132,4 @@ function cm.thop(e,tp,eg,ep,ev,re,r,rp)
else else
Duel.SSet(tp,tc) Duel.SSet(tp,tc)
end end
end end
function cm.lfilter(tp) \ No newline at end of file
return function(c)
return c:IsLinkRace(RACE_CYBERSE+RACE_MACHINE) or (c:IsType(TYPE_SPELL) and c:IsControler(tp))
end
end
function cm.matval(e,c,mg,mc)
if c~=e:GetHandler() then return false end
local counter_effects={mc:IsHasEffect(77765004)}
for _,te in pairs(counter_effects) do
local vf=te:GetValue()
if not vf or vf(te,c) then return false end
end
return true
end
function cm.mattg(e,c)
return c:IsFaceup() and c:IsType(TYPE_SPELL)
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