Commit de1f7445 authored by nanahira's avatar nanahira

update link procedures

parent fc580948
......@@ -4,7 +4,7 @@ local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
function cm.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,aux.TRUE,4)
cm.AddLinkProcedure(c,aux.TRUE,4)
c:EnableReviveLimit()
Senya.AddSummonMusic(c,m*16+1,SUMMON_TYPE_LINK)
--atk
......
......@@ -4,7 +4,7 @@ local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
cm.Senya_name_with_prism=true
function cm.initial_effect(c)
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_SEASERPENT),2,2)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_SEASERPENT),2,2)
c:EnableReviveLimit()
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(m,0))
......
......@@ -4,7 +4,7 @@ local cm=_G["c"..m]
xpcall(function() require("expansions/script/c37564765") end,function() require("script/c37564765") end)
cm.Senya_name_with_prism=true
function cm.initial_effect(c)
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_SEASERPENT),2,3)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkRace,RACE_SEASERPENT),2,3)
c:EnableReviveLimit()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -6,7 +6,7 @@ cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
Senya.Nanahira(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,2)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,2)
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(m,0))
--e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
......
......@@ -7,7 +7,7 @@ function cm.initial_effect(c)
Senya.Nanahira(c)
Senya.AddSummonMusic(c,m*16+1,SUMMON_TYPE_LINK)
--link summon
aux.AddLinkProcedure(c,function(c) return c:GetOriginalCode()==37564765 end,1,1)
cm.AddLinkProcedure(c,function(c) return c:GetOriginalCode()==37564765 end,1,1)
c:EnableReviveLimit()
--special summon
local e3=Effect.CreateEffect(c)
......
......@@ -6,7 +6,7 @@ cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
Senya.Nanahira(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,3)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,3)
local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE)
ex:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
......
......@@ -6,7 +6,7 @@ cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
Senya.Nanahira(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,2)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,2)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN)
......
......@@ -7,7 +7,7 @@ function cm.initial_effect(c)
Senya.Nanahira(c)
Senya.AddSummonMusic(c,m*16+1,SUMMON_TYPE_LINK)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.mfilter,2,2,cm.lcheck)
cm.AddLinkProcedure(c,cm.mfilter,2,2,cm.lcheck)
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_FIELD)
e4:SetRange(LOCATION_MZONE)
......
......@@ -6,7 +6,7 @@ cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
Senya.Nanahira(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,4)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),2,4)
Senya.AddSummonMusic(c,m*16,SUMMON_TYPE_LINK)
local ex=Effect.CreateEffect(c)
ex:SetType(EFFECT_TYPE_SINGLE)
......
......@@ -6,7 +6,7 @@ cm.Senya_desc_with_nanahira=true
function cm.initial_effect(c)
Senya.Nanahira(c)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),3,3)
cm.AddLinkProcedure(c,aux.FilterBoolFunction(Card.IsLinkCode,37564765),3,3)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
......
......@@ -2576,4 +2576,107 @@ function cm.AddAttackSE(c,desc)
end
cm.AttackSEList[c]=desc
end
--triggered a build on Dec 9
--Link Summon
function cm.AddLinkProcedure(c,f,min,max,gf)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetRange(LOCATION_EXTRA)
if max==nil then max=c:GetLink() end
e1:SetCondition(cm.LinkCondition(f,min,max,gf))
e1:SetTarget(cm.LinkTarget(f,min,max,gf))
e1:SetOperation(cm.LinkOperation(f,min,max,gf))
e1:SetValue(SUMMON_TYPE_LINK)
c:RegisterEffect(e1)
end
function cm.LConditionFilter(c,f,lc)
return c:IsFaceup() and c:IsCanBeLinkMaterial(lc) and (not f or f(c))
end
function cm.GetLinkCount(c)
if c:IsType(TYPE_LINK) and c:GetLink()>1 then
return 1+0x10000*c:GetLink()
else return 1 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.LCheckGoal(tp,sg,lc,minc,ct,gf)
return ct>=minc and sg:CheckWithSumEqual(cm.GetLinkCount,lc:GetLink(),ct,ct) and Duel.GetLocationCountFromEx(tp,tp,sg,lc)>0 and (not gf or gf(sg))
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=Duel.GetMatchingGroup(cm.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,c)
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()
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.LinkTarget(f,minc,maxc,gf)
return function(e,tp,eg,ep,ev,re,r,rp,chk,c)
local mg=Duel.GetMatchingGroup(cm.LConditionFilter,tp,LOCATION_MZONE,0,nil,f,c)
local bg=Group.CreateGroup()
for i,pe in ipairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_MUST_BE_LMATERIAL)}) do
bg:AddCard(pe:GetHandler())
end
if #bg>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
bg:Select(tp,#bg,#bg,nil)
end
local sg=Group.CreateGroup()
local res=false
sg:Merge(bg)
while #sg<maxc do
local cg=mg:Filter(cm.LCheckRecursive,sg,tp,sg,mg,c,#sg,minc,maxc,gf)
if #cg==0 then break end
if #cg<=maxc and cm.LCheckGoal(tp,sg,c,minc,#sg,gf)
and mg:IsExists(cm.LCheckRecursive,1,sg,tp,sg,mg,c,#sg,minc,maxc,gf) then
res=true
--if not Duel.SelectYesNo(tp,210) then break end
else
res=false
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LMATERIAL)
local tc=Group.SelectUnselect(cg,sg,tp,res,#sg==0 or res,minc,maxc)
if not tc then break end
if not bg:IsContains(tc) then
if not sg:IsContains(tc) then
sg:AddCard(tc)
else
sg:RemoveCard(tc)
end
elseif #bg>0 and #sg<=#bg then
return false
end
end
if #sg>0 then
sg:KeepAlive()
e:SetLabelObject(sg)
return true
else return false end
end
end
function cm.LinkOperation(f,min,max,gf)
return function(e,tp,eg,ep,ev,re,r,rp,c,smat,mg)
local g=e:GetLabelObject()
c:SetMaterial(g)
Duel.SendtoGrave(g,REASON_MATERIAL+REASON_LINK)
g:DeleteGroup()
end
end
......@@ -5,7 +5,7 @@ xpcall(function() require("expansions/script/c37564765") end,function() require(
function cm.initial_effect(c)
c:EnableReviveLimit()
Senya.AddSummonMusic(c,m*16+2,SUMMON_TYPE_LINK)
aux.AddLinkProcedure(c,Senya.check_link_set_3L,2,2)
cm.AddLinkProcedure(c,Senya.check_link_set_3L,2,2)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_SPSUMMON_SUCCESS)
......
......@@ -5,7 +5,7 @@ xpcall(function() require("expansions/script/c37564765") end,function() require(
function cm.initial_effect(c)
c:EnableReviveLimit()
Senya.AddSummonMusic(c,m*16+2,SUMMON_TYPE_LINK)
aux.AddLinkProcedure(c,Senya.check_link_set_3L,3,4)
cm.AddLinkProcedure(c,Senya.check_link_set_3L,3,4)
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_SPSUMMON_SUCCESS)
......
......@@ -6,7 +6,7 @@ cm.Senya_name_with_sayuri=true
function cm.initial_effect(c)
Senya.AddSummonMusic(c,m*16,SUMMON_TYPE_LINK)
c:EnableReviveLimit()
aux.AddLinkProcedure(c,cm.mfilter,3,3,cm.lcheck)
cm.AddLinkProcedure(c,cm.mfilter,3,3,cm.lcheck)
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(37564765,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
......
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