Commit 6423812a authored by Tachibana's avatar Tachibana

sign out

parent d1aed62b
Pipeline #2971 passed with stages
in 25 minutes and 49 seconds
No preview for this file type
......@@ -141,3 +141,170 @@ function Tenka.PyroLink(c)
c:RegisterEffect(eb)
end
--
function Tenka.Pendulum(c)
if not Auxiliary.PendulumChecklist then
Auxiliary.PendulumChecklist=0
local ge1=Effect.GlobalEffect()
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_PHASE_START+PHASE_DRAW)
ge1:SetOperation(Auxiliary.PendulumReset)
Duel.RegisterEffect(ge1,0)
end
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(81000000,0))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC_G)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
e1:SetRange(LOCATION_PZONE)
e1:SetCondition(Tenka.PendCondition())
e1:SetOperation(Tenka.PendOperation())
e1:SetValue(SUMMON_TYPE_PENDULUM)
c:RegisterEffect(e1)
--register by default
local e2=Effect.CreateEffect(c)
e2:SetDescription(1160)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_HAND)
c:RegisterEffect(e2)
end
function Tenka.PConditionFilter(c,e,tp,lscale,rscale,f,tc,eset)
local lv=0
if c.pendulum_level then
lv=c.pendulum_level
else
lv=c:GetLevel()
end
local bool=aux.PendulumSummonableBool(c)
return lv>lscale and lv<rscale and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
and (Auxiliary.PendulumChecklist&(0x1<<tp)==0 or aux.PConditionExtraFilter(c,e,tp,lscale,rscale,eset))
and not c:IsForbidden() and (not f or f(c,tc))
end
function Tenka.SetForceExtra(tp,res)
if forced_to_extra then
forced_to_extra[tp]=res
end
end
function Tenka.PendCondition()
return function(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
if Auxiliary.PendulumChecklist&(0x1<<tp)~=0 and #eset==0 then return false end
local rpz=Tenka.GetPendulumCard(tp,1)
if rpz==nil or c==rpz then return false end
local lscale=c:GetLeftScale()
local rscale=rpz:GetRightScale()
if lscale>rscale then lscale,rscale=rscale,lscale end
local ft=Duel.GetUsableMZoneCount(tp)
if ft<=0 then return false end
local mft=Duel.GetMZoneCount(tp)
Tenka.SetForceExtra(tp,true)
local eft=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)
Tenka.SetForceExtra(tp,false)
local g=nil
if og then
g=og:Filter(aux.PConditionFilter,1,nil,e,tp,lscale,rscale,eset)
else
g=Duel.GetMatchingGroup(aux.PConditionFilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,nil,e,tp,lscale,rscale,eset)
end
if mft<=0 then g=g:Filter(Card.IsLocation,nil,LOCATION_EXTRA) end
if eft<=0 then g:Remove(Card.IsLocation,nil,LOCATION_EXTRA) end
return #g>0
end
end
function Tenka.PendCheckAdditional(mft,maxlist)
return function(g)
if mft>0 and g:IsExists(Card.IsLocation,mft+1,nil,0xbf) then return false end
for loc,lct in pairs(maxlist) do
if lct>0 and g:IsExists(Card.IsLocation,lct+1,nil,loc) then return false end
end
return true
end
end
function Tenka.PendOperation()
return function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
local rpz=Tenka.GetPendulumCard(tp,1)
local lscale=c:GetLeftScale()
local rscale=rpz:GetRightScale()
if lscale>rscale then lscale,rscale=rscale,lscale end
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
local ft=Duel.GetUsableMZoneCount(tp)
local mft=Duel.GetMZoneCount(tp)
Tenka.SetForceExtra(tp,true)
local eft=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM)
Tenka.SetForceExtra(tp,false)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then
mft=math.min(1,mft)
mft=math.min(1,eft)
ft=1
end
local tg=nil
local maxlist={}
if og then
tg=og:Filter(aux.PConditionFilter,1,nil,e,tp,lscale,rscale)
else
tg=Duel.GetMatchingGroup(aux.PConditionFilter,tp,LOCATION_HAND+LOCATION_EXTRA,0,nil,e,tp,lscale,rscale,eset)
end
if mft<=0 then tg=tg:Filter(Card.IsLocation,nil,LOCATION_EXTRA) end
if eft<=0 then tg:Remove(Card.IsLocation,nil,LOCATION_EXTRA) end
local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and math.min(c29724053[tp],eft) or eft
local left=maxlist[LOCATION_EXTRA]
if left then
maxlist[LOCATION_EXTRA]=math.min(left,ect)
else
maxlist[LOCATION_EXTRA]=ect
end
local ce=nil
local b1=Auxiliary.PendulumChecklist&(0x1<<tp)==0
local b2=#eset>0
if b1 and b2 then
local options={1163}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
if op>0 then
ce=eset[op]
end
elseif b2 and not b1 then
local options={}
for _,te in ipairs(eset) do
table.insert(options,te:GetDescription())
end
local op=Duel.SelectOption(tp,table.unpack(options))
ce=eset[op+1]
end
if ce then
tg=tg:Filter(aux.PConditionExtraFilterSpecific,nil,e,tp,lscale,rscale,ce)
end
Auxiliary.GCheckAdditional=Tenka.PendCheckAdditional(mft,maxlist)
local g=Tenka.SelectGroupWithCancel(tp,HINTMSG_SPSUMMON,tg,aux.TRUE,nil,1,ft)
Auxiliary.GCheckAdditional=nil
if not g then return end
if ce then
Duel.Hint(HINT_CARD,0,ce:GetOwner():GetOriginalCode())
ce:Reset()
else
Auxiliary.PendulumChecklist=Auxiliary.PendulumChecklist|(0x1<<tp)
end
sg:Merge(g)
Duel.HintSelection(Group.FromCards(c))
Duel.HintSelection(Group.FromCards(rpz))
Tenka.SetForceExtra(tp,true)
end
end
function Tenka.GetPendulumCard(tp,seq)
return Duel.GetFieldCard(tp,LOCATION_PZONE,seq)
end
function Tenka.SelectGroupWithCancel(tp,desc,g,f,cg,min,max,...)
return Tenka.SelectGroupNew(tp,desc,true,g,f,cg,min,max,...)
end
function Tenka.SelectGroupNew(tp,desc,cancelable,g,f,cg,min,max,...)
local min=min or 1
local max=max or #g
local ext_params={...}
if cg then Duel.SetSelectedCard(cg) end
Duel.Hint(tp,HINT_SELECTMSG,desc)
return g:SelectSubGroup(tp,f,cancelable,min,max,...)
end
--冰晶隧道·佐城雪美
local m=81021016
local cm=_G["c"..m]
Duel.LoadScript("c81000000.lua")
function cm.initial_effect(c)
c:EnableReviveLimit()
aux.EnablePendulumAttribute(c,false)
Tenka.Pendulum(c)
aux.AddSynchroProcedure(c,nil,aux.NonTuner(nil),1,1)
--atk
local e0=Effect.CreateEffect(c)
......
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