Commit 0d4a066b authored by Huangnan's avatar Huangnan

Update c101202042.lua

parent 847624cf
Pipeline #23070 failed with stages
in 77 minutes and 1 second
--coded by Lyris, Lanpa and beyond --厄災の星ティ・フォン
--Stellar Nemesis T-PHON - Doomsday Star --Stellar Nemesis T-PHON - Doomsday Star
--coded by Lyris
local s,id,o=GetID() local s,id,o=GetID()
local special_count = {}
function s.initial_effect(c) function s.initial_effect(c)
c:EnableReviveLimit() c:EnableReviveLimit()
--material --material
aux.AddXyzProcedure(c,nil,12,2) aux.AddXyzProcedure(c,nil,12,2,s.mfilter(c:GetControler()),aux.Stringid(id,0),2,s.altop)
s.AddMaxXyzProcedure(c)
if not s.global_check then if not s.global_check then
s.global_check=true s.global_check=true
local ge1=Effect.GlobalEffect(c) local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SPSUMMON_SUCCESS) ge1:SetCode(EVENT_SPSUMMON_SUCCESS)
ge1:SetOperation(s.chcon) ge1:SetOperation(s.chk)
ge1:SetOperation(s.chop)
Duel.RegisterEffect(ge1,0) Duel.RegisterEffect(ge1,0)
end end
--limit summons
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCondition(s.lscon)
e1:SetOperation(s.lsop)
c:RegisterEffect(e1)
--limit effects --limit effects
local e2=Effect.CreateEffect(c) local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD) e2:SetType(EFFECT_TYPE_FIELD)
...@@ -24,7 +30,7 @@ function s.initial_effect(c) ...@@ -24,7 +30,7 @@ function s.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetTargetRange(1,1) e2:SetTargetRange(1,1)
e2:SetCondition(s.lecon) e2:SetCondition(s.lecon)
e2:SetValue(s.actlimit) e2:SetTarget(s.letg)
c:RegisterEffect(e2) c:RegisterEffect(e2)
--to hand --to hand
local e3=Effect.CreateEffect(c) local e3=Effect.CreateEffect(c)
...@@ -38,6 +44,26 @@ function s.initial_effect(c) ...@@ -38,6 +44,26 @@ function s.initial_effect(c)
e3:SetOperation(s.thop) e3:SetOperation(s.thop)
c:RegisterEffect(e3) c:RegisterEffect(e3)
end end
function s.chk(e,tp,eg)
for p=0,1 do
if eg:IsExists(Card.IsSummonPlayer,1,nil,1-p) then
Duel.RegisterFlagEffect(p,id,RESET_PHASE+PHASE_END,0,2)
end
end
end
function s.mfilter(tp)
return function(c)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil):GetMaxGroup(Card.GetAttack)
return g and #g>0 and g:IsContains(c)
end
end
function s.altop(e,tp,chk)
if chk==0 then return Duel.GetFlagEffect(tp,id)>1 end
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT+RESETS_STANDARD-RESET_TOFIELD+RESET_PHASE+PHASE_END,0,1)
end
function s.lscon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end
function s.lsop(e,tp,eg,ep,ev,re,r,rp) function s.lsop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler()) local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,3)) e1:SetDescription(aux.Stringid(id,3))
...@@ -51,13 +77,12 @@ function s.lsop(e,tp,eg,ep,ev,re,r,rp) ...@@ -51,13 +77,12 @@ function s.lsop(e,tp,eg,ep,ev,re,r,rp)
e2:SetDescription(aux.Stringid(id,3)) e2:SetDescription(aux.Stringid(id,3))
e2:SetCode(EFFECT_CANNOT_SUMMON) e2:SetCode(EFFECT_CANNOT_SUMMON)
Duel.RegisterEffect(e2,tp) Duel.RegisterEffect(e2,tp)
e:Reset()
end end
function s.lecon(e,tp,eg,ep,ev,re,r,rp) function s.lecon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ) return e:GetHandler():IsSummonType(SUMMON_TYPE_XYZ)
end end
function s.actlimit(e,re,tp) function s.letg(e,te)
return re:IsActiveType(TYPE_MONSTER) and re:GetHandler():IsAttackAbove(3000) return te:IsActiveType(TYPE_MONSTER) and te:GetHandler():IsAttackAbove(3000)
end end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler() local c=e:GetHandler()
...@@ -74,100 +99,3 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) ...@@ -74,100 +99,3 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.SendtoHand(g,nil,REASON_EFFECT)
end end
\ No newline at end of file
function s.chcon(e,tp,eg,ev,ep,re,r,rp)
return eg:IsExists(s.cf,1,nil,1-tp)
end
function s.cf(c,tp)
return c:IsPreviousLocation(LOCATION_EXTRA)
end
function s.chop(e,tp,eg,ev,ep,re,r,rp)
if eg:IsExists(s.cf,1,nil,1-tp) then
local turn = Duel.GetTurnCount()
if not special_count[1-ep] then special_count[1-ep]={} end
if not special_count[1-ep][turn] then special_count[1-ep][turn]=0 end
special_count[1-ep][turn]=special_count[1-ep][turn]+1
end
end
function s.AddMaxXyzProcedure(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(1165)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(s.xyzcon)
e1:SetTarget(s.xyztg)
e1:SetOperation(s.xyzop)
e1:SetValue(SUMMON_TYPE_XYZ)
c:RegisterEffect(e1)
return e1
end
function s.xyzcon(e,c,og)
if c==nil then return true end
local tp=c:GetControler()
local turn=Duel.GetTurnCount()
if not special_count[tp] then return false end
if not special_count[tp][turn] and not special_count[tp][turn-1] then return false end
local the_true=2
if (special_count[tp][turn] and special_count[tp][turn]<2) or not special_count[tp][turn] then the_true=the_true-1 end
if (special_count[tp][turn-1] and special_count[tp][turn-1]<2) or not special_count[tp][turn-1] then the_true=the_true-1 end
if the_true==0 then return false else the_true=nil end
local g=nil
if og then g=og else g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) end
local ct=0
if #g>0 then a,ct=g:GetMaxGroup(Card.GetAttack) end
return g:CheckSubGroup(s.MaxXyzGoal,1,1,tp,c,ct)
end
function s.xyztg(e,tp,og)
local c=e:GetHandler()
local turn=Duel.GetTurnCount()
if not special_count[tp] then return false end
if not special_count[tp][turn] and not special_count[tp][turn-1] then return false end
local the_true=2
if (special_count[tp][turn] and special_count[tp][turn]<2) or not special_count[tp][turn] then the_true=the_true-1 end
if (special_count[tp][turn-1] and special_count[tp][turn-1]<2) or not special_count[tp][turn-1] then the_true=the_true-1 end
if the_true==0 then return false else the_true=nil end
local g=nil
if og then g=og else g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) end
local cancel=Duel.IsSummonCancelable()
aux.GCheckAdditional=aux.TuneMagicianCheckAdditionalX(EFFECT_TUNE_MAGICIAN_X)
Duel.Hint(3,tp,513)
local ct=0
if #g>0 then a,ct=g:GetMaxGroup(Card.GetAttack) end
local mg=g:SelectSubGroup(tp,s.MaxXyzGoal,cancel,1,1,tp,c,ct)
aux.GCheckAdditional=nil
if mg and mg:GetCount()>0 then
mg:KeepAlive()
e:SetLabelObject(mg)
return true
else return false end
end
function s.xyzop(e,tp,og)
local c=e:GetHandler()
local g=e:GetLabelObject()
local sg=g:Filter(Card.IsType,nil,TYPE_XYZ)
if #g>0 then
local tc=sg:GetFirst()
while tc do
local ag=tc:GetOverlayGroup()
if #ag>0 then
g:Merge(ag)
end
tc=sg:GetNext()
end
end
c:SetMaterial(g)
Duel.Overlay(c,g)
g:DeleteGroup()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetOperation(s.lsop)
c:RegisterEffect(e1)
end
function s.MaxXyzGoal(g,tp,xyzc,ct)
local sg=Duel.GetMustMaterial(tp,EFFECT_MUST_BE_XMATERIAL)
if sg:IsExists(aux.MustMaterialCounterFilter,1,nil,g) or g:IsExists(function(c) return not c:IsCanBeXyzMaterial(xyzc) end,1,nil) then return false end
return g:IsExists(Card.IsAttack,nil,1,ct)
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