Commit 2c0b368e authored by TanakaKotoha's avatar TanakaKotoha

mopemope

parent c969d649
Pipeline #811 passed with stages
in 44 minutes and 15 seconds
--时机龙骑·刻神指令
function c40009205.initial_effect(c)
local m=40009205
local cm=_G["c"..m]
function cm.initial_effect(c)
--proce
c:EnableReviveLimit()
aux.EnablePendulumAttribute(c,false)
aux.AddXyzProcedure(c,c40009205.mfilter,10,3)
--
aux.AddXyzProcedure(c,cm.matfilter,10,3)
--pendulum
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(40009205,0))
e1:SetDescription(aux.Stringid(m,3))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC_G)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_PZONE)
e1:SetCondition(c40009205.PendCondition())
e1:SetOperation(c40009205.PendOperation())
e1:SetCondition(cm.PendCondition())
e1:SetOperation(cm.PendOperation())
e1:SetValue(SUMMON_TYPE_PENDULUM)
c:RegisterEffect(e1)
--destroy
--reg
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(40009205,1))
e2:SetDescription(aux.Stringid(m,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCountLimit(1,40009205)
e2:SetCondition(c40009205.atkcon)
e2:SetOperation(c40009205.atkop)
e2:SetCountLimit(1,m)
e2:SetCondition(cm.xyzcon)
e2:SetOperation(cm.xyzop)
c:RegisterEffect(e2)
--pendulum
--place
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetOperation(cm.reg)
c:RegisterEffect(e3)
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(40009205,4))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e4:SetDescription(aux.Stringid(m,2))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_MZONE)
e4:SetCondition(c40009205.pencon)
e4:SetTarget(c40009205.pentg)
e4:SetOperation(c40009205.penop)
e4:SetCountLimit(1)
e4:SetCondition(cm.pcon)
e4:SetTarget(cm.ptg)
e4:SetOperation(cm.pop)
c:RegisterEffect(e4)
end
function c40009205.mfilter(c)
function cm.xyzcon(e)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
end
function cm.xyzop(e,tp)
local c=e:GetHandler()
Duel.Hint(HINT_CARD,0,m)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetCondition(cm.negcon)
e1:SetOperation(cm.negop)
Duel.RegisterEffect(e1,tp)
end
function cm.matfilter(c)
return c:IsType(TYPE_PENDULUM) and c:IsAttribute(ATTRIBUTE_DARK)
end
function c40009205.PConditionFilter(c,e,tp)
local lv=0
if c.pendulum_level then
lv=c.pendulum_level
else
lv=c:GetLevel()
end
local bool=aux.PendulumSummonableBool(c)
return (c:IsLocation(LOCATION_HAND)
or c:IsLocation(LOCATION_REMOVED)
or (c:IsFaceup() and c:IsType(TYPE_PENDULUM)))
and c:IsSetCard(0xf1c)
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
function cm.PConditionExtraFilterSpecific(c,e,tp,nu1,nu2,te)
if not te then return true end
local f=te:GetValue()
return not f or f(te,c,e,tp,nil,nil)
end
function cm.PConditionExtraFilter(c,e,tp,nu1,nu2,eset)
for _,te in ipairs(eset) do
if cm.PConditionExtraFilterSpecific(c,e,tp,nil,nil,te) then return true end
end
return false
end
function cm.PConditionFilter(c,e,tp,nu1,nu2,eset)
local bool=Auxiliary.PendulumSummonableBool(c)
return (c:IsLevelAbove(1) or c.pendulum_level) and c:IsSetCard(0x1f1c) and (c:IsLocation(LOCATION_HAND) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM))) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_PENDULUM,tp,bool,bool)
and not c:IsForbidden()
and (Auxiliary.PendulumChecklist&(0x1<<tp)==0 or cm.PConditionExtraFilter(c,e,tp,nil,nil,eset))
end
--
function c40009205.PendCondition()
return
function(e,c,og)
function cm.PendCondition()
return function(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local seq=c:GetSequence()
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
if Auxiliary.PendulumChecklist&(0x1<<tp)~=0 and #eset==0 then return false end
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
if rpz==nil or c==rpz then return false end
local loc=0
local LE=Duel.GetLocationCountFromEx(tp)
local LM=Duel.GetLocationCount(tp,LOCATION_MZONE)
if LE>0 then loc=loc+LOCATION_EXTRA end
if LM>0 then loc=loc+LOCATION_HAND+LOCATION_REMOVED end
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then loc=loc+LOCATION_HAND+LOCATION_REMOVED end
if loc==0 then return false end
local g=nil
if og then
g=og:Filter(Card.IsLocation,nil,loc)
g=og:Filter(Card.IsLocation,nil,LOCATION_HAND+LOCATION_REMOVED)
else
g=Duel.GetFieldGroup(tp,loc,0)
g=Duel.GetFieldGroup(tp,LOCATION_HAND+LOCATION_REMOVED,0)
end
return g:IsExists(c40009205.PConditionFilter,1,nil,e,tp)
return g:IsExists(cm.PConditionFilter,1,nil,e,tp,nil,nil,eset)
end
end
--
function c40009205.PendOperation()
return
function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
function cm.PendOperation()
return function(e,tp,eg,ep,ev,re,r,rp,c,sg,og)
Duel.Hint(HINT_CARD,0,m)
local rpz=Duel.GetFieldCard(tp,LOCATION_PZONE,1)
local eset={Duel.IsPlayerAffectedByEffect(tp,EFFECT_EXTRA_PENDULUM_SUMMON)}
local tg=nil
local loc=0
local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE)
local ft2=Duel.GetLocationCountFromEx(tp)
local ft=Duel.GetUsableMZoneCount(tp)
if Duel.IsPlayerAffectedByEffect(tp,59822133) then
if ft1>0 then ft1=1 end
if ft2>0 then ft2=1 end
ft=1
end
local loc=0
if ft1>0 then loc=loc+LOCATION_HAND+LOCATION_REMOVED end
if ft2>0 then loc=loc+LOCATION_EXTRA end
local tg=nil
if ft1>0 then
loc=loc|LOCATION_HAND
loc=loc|LOCATION_REMOVED
end
if og then
tg=og:Filter(Card.IsLocation,nil,loc):Filter(c40009205.PConditionFilter,nil,e,tp)
tg=og:Filter(Card.IsLocation,nil,loc):Filter(cm.PConditionFilter,nil,e,tp,nil,nil,eset)
else
tg=Duel.GetMatchingGroup(c40009205.PConditionFilter,tp,loc,0,nil,e,tp)
end
ft1=math.min(ft1,tg:FilterCount(Card.IsLocation,nil,LOCATION_HAND+LOCATION_REMOVED))
ft2=math.min(ft2,tg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA))
local ect=c29724053 and Duel.IsPlayerAffectedByEffect(tp,29724053) and c29724053[tp]
if ect and ect<ft2 then ft2=ect end
while true do
local ct1=tg:FilterCount(Card.IsLocation,nil,LOCATION_HAND+LOCATION_REMOVED)
local ct2=tg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)
local ct=ft
if ct1>ft1 then ct=math.min(ct,ft1) end
if ct2>ft2 then ct=math.min(ct,ft2) end
if ct<=0 then break end
if sg:GetCount()>0 and not Duel.SelectYesNo(tp,210) then ft=0 break end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=tg:Select(tp,1,ct,nil)
tg:Sub(g)
sg:Merge(g)
if g:GetCount()<ct then ft=0 break end
ft=ft-g:GetCount()
ft1=ft1-g:FilterCount(Card.IsLocation,nil,LOCATION_HAND+LOCATION_REMOVED)
ft2=ft2-g:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)
end
if ft>0 then
local tg1=tg:Filter(Card.IsLocation,nil,LOCATION_HAND+LOCATION_REMOVED)
local tg2=tg:Filter(Card.IsLocation,nil,LOCATION_EXTRA)
if ft1>0 and ft2==0 and tg1:GetCount()>0 and (sg:GetCount()==0 or Duel.SelectYesNo(tp,210)) then
local ct=math.min(ft1,ft)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=tg1:Select(tp,1,ct,nil)
sg:Merge(g)
tg=Duel.GetMatchingGroup(cm.PConditionFilter,tp,loc,0,nil,e,tp,nil,nil,eset)
end
if ft1==0 and ft2>0 and tg2:GetCount()>0 and (sg:GetCount()==0 or Duel.SelectYesNo(tp,210)) then
local ct=math.min(ft2,ft)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=tg2:Select(tp,1,ct,nil)
sg:Merge(g)
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(cm.PConditionExtraFilterSpecific,nil,e,tp,nil,nil,ce)
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
Auxiliary.GCheckAdditional=Auxiliary.PendOperationCheck(ft1,0,ft)
local g=tg:SelectSubGroup(tp,aux.TRUE,true,1,math.min(#tg,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))
end
end
function c40009205.atkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
end
function c40009205.atkop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_SOLVING)
e1:SetReset(RESET_PHASE+PHASE_END)
e1:SetCost(c40009205.drcost)
e1:SetCondition(c40009205.discon2)
e1:SetOperation(c40009205.disop2)
Duel.RegisterEffect(e1,tp)
function cm.tdfilter(c)
return c:IsFaceup() and c:IsSetCard(0x1f1c) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeck()
end
function c40009205.crfilter(c)
return c:IsFaceup() and c:IsSetCard(0xf1c) and c:IsType(TYPE_MONSTER) and c:IsAbleToDeckAsCost()
function cm.negcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(cm.tdfilter,tp,LOCATION_REMOVED,0,2,nil)
and rp==1-tp and Duel.IsChainDisablable(ev) and aux.nbcon(tp,re)
end
function c40009205.drcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c40009205.crfilter,tp,LOCATION_REMOVED,0,2,nil) end
function cm.negop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SelectYesNo(tp,aux.Stringid(m,1)) then return end
Duel.Hint(HINT_CARD,0,m)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,c40009205.crfilter,tp,LOCATION_REMOVED,0,2,2,nil)
Duel.SendtoDeck(g,nil,2,REASON_COST)
end
function c40009205.discon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsChainDisablable(ev) and rp~=tp
end
function c40009205.disop2(e,tp,eg,ep,ev,re,r,rp)
if Duel.SelectYesNo(tp,aux.Stringid(40009205,2)) then
Duel.Hint(HINT_CARD,0,40009205)
Duel.Hint(HINT_OPSELECTED,1-tp,aux.Stringid(40009205,3))
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
local tg=Duel.SelectMatchingCard(tp,cm.tdfilter,tp,LOCATION_REMOVED,0,2,2,nil)
Duel.HintSelection(tg)
Duel.SendtoDeck(tg,nil,2,REASON_EFFECT)
local rc=re:GetHandler()
if Duel.NegateEffect(ev) and rc:IsRelateToEffect(re) then
Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)
end
end
function cm.reg(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if re and re:IsHasType(EFFECT_TYPE_ACTIONS) then
c:RegisterFlagEffect(m+100,RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END,0,1)
end
end
function c40009205.pencon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
function cm.pcon(e,tp)
return e:GetHandler():GetFlagEffect(m+100)>0
end
function c40009205.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
function cm.ptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_GRAVE+LOCATION_REMOVED)
end
function c40009205.penfilter(c,e,tp)
return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsSetCard(0xf1c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
function cm.spfilter(c,e,tp)
return c:IsSetCard(0x1f1c) and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function c40009205.penop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return false end
function cm.pop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) and Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) then
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(c40009205.penfilter),tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e,tp)
if g:GetCount()>0 and Duel.SelectYesNo(tp,aux.Stringid(40009205,5)) then
Duel.BreakEffect()
if not c:IsRelateToEffect(e) then return end
if not Duel.CheckLocation(tp,LOCATION_PZONE,0) and not Duel.CheckLocation(tp,LOCATION_PZONE,1) then return end
if not Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) then return end
local sg=Duel.GetMatchingGroup(cm.spfilter,tp,LOCATION_GRAVE+LOCATION_REMOVED,0,nil,e,tp)
if #sg>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(m,3)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
local sg2=sg:Select(tp,1,1,nil)
Duel.BreakEffect()
Duel.SpecialSummon(sg2,0,tp,tp,false,false,POS_FACEUP)
end
end
\ No newline at end of file
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