Commit cc66947a authored by Chen Bill's avatar Chen Bill Committed by GitHub

use Duel.GetReadyChain (#2299)

parent 98b4c8cc
......@@ -21,7 +21,7 @@ function c11593137.filter(c)
return c:IsAttribute(0x30) and c:IsAbleToRemove()
end
function c11593137.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and eg:IsExists(c11593137.filter,1,nil)
return aux.NegateSummonCondition() and eg:IsExists(c11593137.filter,1,nil)
end
function c11593137.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,2000) end
......
......@@ -11,7 +11,7 @@ function c1637760.initial_effect(c)
c:RegisterEffect(e1)
end
function c1637760.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and Duel.GetTurnPlayer()~=tp and rp==1-tp
return aux.NegateSummonCondition() and Duel.GetTurnPlayer()~=tp and rp==1-tp
and (Duel.GetCurrentPhase()==PHASE_MAIN1 or Duel.GetCurrentPhase()==PHASE_MAIN2)
end
function c1637760.target(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -5,7 +5,7 @@ function c2572890.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SPSUMMON)
e1:SetCondition(c2572890.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c2572890.cost)
e1:SetTarget(c2572890.target1)
e1:SetOperation(c2572890.activate1)
......@@ -31,9 +31,6 @@ function c2572890.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectReleaseGroup(REASON_COST,tp,c2572890.cfilter,1,1,nil)
Duel.Release(g,REASON_COST)
end
function c2572890.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c2572890.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,eg:GetCount(),0,0)
......
......@@ -70,12 +70,9 @@ function c28292031.target(event)
return Duel.IsExistingMatchingCard(c28292031.filter,tp,LOCATION_GRAVE,0,1,nil,event)
end
e:SetLabel(0)
local _GetCurrentChain=Duel.GetCurrentChain
Duel.GetCurrentChain=function() return _GetCurrentChain()-1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,c28292031.filter,tp,LOCATION_GRAVE,0,1,1,nil,event)
local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true)
Duel.GetCurrentChain=_GetCurrentChain
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
Duel.Remove(g,POS_FACEUP,REASON_COST)
e:SetProperty(te:GetProperty())
......
......@@ -24,7 +24,7 @@ function c30888983.filter(c)
return Duel.IsExistingMatchingCard(c30888983.cfilter,0,LOCATION_MZONE,LOCATION_MZONE,1,nil,c:GetRace())
end
function c30888983.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and eg:IsExists(c30888983.filter,1,nil)
return aux.NegateSummonCondition() and eg:IsExists(c30888983.filter,1,nil)
end
function c30888983.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,1000) end
......
......@@ -7,7 +7,7 @@ function s.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCountLimit(1,id)
e1:SetCondition(s.descon)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
......@@ -25,9 +25,6 @@ function s.initial_effect(c)
e3:SetOperation(s.repop)
c:RegisterEffect(e3)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function s.tgfilter(c)
return c:IsRace(RACE_FIEND) and c:IsDiscardable(REASON_EFFECT)
end
......
......@@ -5,7 +5,7 @@ function c32233746.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c32233746.condition)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c32233746.cost)
e1:SetTarget(c32233746.target)
e1:SetOperation(c32233746.activate)
......@@ -17,9 +17,6 @@ function c32233746.initial_effect(c)
e3:SetCode(EVENT_SPSUMMON)
c:RegisterEffect(e3)
end
function c32233746.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c32233746.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(REASON_COST,tp,Card.IsSetCard,1,nil,0x38) end
local g=Duel.SelectReleaseGroup(REASON_COST,tp,Card.IsSetCard,1,1,nil,0x38)
......
......@@ -15,7 +15,7 @@ function c40605147.initial_effect(c)
e2:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_SPSUMMON)
e2:SetCondition(c40605147.condition1)
e2:SetCondition(aux.NegateSummonCondition)
e2:SetCost(c40605147.cost)
e2:SetTarget(c40605147.target1)
e2:SetOperation(c40605147.activate1)
......@@ -40,9 +40,6 @@ function c40605147.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(eg,REASON_EFFECT)
end
end
function c40605147.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c40605147.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,eg:GetCount(),0,0)
......
......@@ -5,7 +5,7 @@ function c41420027.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c41420027.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c41420027.cost1)
e1:SetTarget(c41420027.target1)
e1:SetOperation(c41420027.activate1)
......@@ -27,9 +27,6 @@ function c41420027.initial_effect(c)
e4:SetOperation(c41420027.activate2)
c:RegisterEffect(e4)
end
function c41420027.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c41420027.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2))
......
......@@ -5,7 +5,7 @@ function c43340443.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c43340443.condition)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetTarget(c43340443.target)
e1:SetOperation(c43340443.activate)
c:RegisterEffect(e1)
......@@ -13,9 +13,6 @@ function c43340443.initial_effect(c)
e2:SetCode(EVENT_FLIP_SUMMON)
c:RegisterEffect(e2)
end
function c43340443.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c43340443.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,1,0,0)
......
......@@ -21,7 +21,7 @@ function c44901281.filter(c)
end
function c44901281.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c44901281.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetCurrentChain()==0
and aux.NegateSummonCondition()
end
function c44901281.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -11,7 +11,7 @@ function c50323155.initial_effect(c)
c:RegisterEffect(e1)
end
function c50323155.condition(e,tp,eg,ep,ev,re,r,rp)
return tp~=ep and eg:GetCount()==1 and Duel.GetCurrentChain()==0
return tp~=ep and eg:GetCount()==1 and aux.NegateSummonCondition()
end
function c50323155.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -15,7 +15,7 @@ function c56993276.initial_effect(c)
c:RegisterEffect(e2)
end
function c56993276.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and eg:IsExists(Card.IsControler,1,nil,1-tp)
return aux.NegateSummonCondition() and eg:IsExists(Card.IsControler,1,nil,1-tp)
end
function c56993276.cfilter(c)
return c:IsSetCard(0xe) and c:IsType(TYPE_MONSTER) and c:IsDiscardable()
......
......@@ -5,7 +5,7 @@ function c57355219.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SPSUMMON)
e1:SetCondition(c57355219.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c57355219.cost)
e1:SetTarget(c57355219.target1)
e1:SetOperation(c57355219.activate1)
......@@ -21,9 +21,6 @@ function c57355219.initial_effect(c)
e2:SetOperation(c57355219.activate2)
c:RegisterEffect(e2)
end
function c57355219.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c57355219.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsAbleToRemoveAsCost() and not c:IsStatus(STATUS_BATTLE_DESTROYED)
end
......
......@@ -5,7 +5,7 @@ function c59718521.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c59718521.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c59718521.cost)
e1:SetTarget(c59718521.target1)
e1:SetOperation(c59718521.activate1)
......@@ -24,9 +24,6 @@ function c59718521.initial_effect(c)
e3:SetOperation(c59718521.activate2)
c:RegisterEffect(e3)
end
function c59718521.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c59718521.filter(c)
return c:IsRace(RACE_PSYCHO) and not c:IsStatus(STATUS_BATTLE_DESTROYED)
end
......
......@@ -38,7 +38,7 @@ function c61459246.activate1(e,tp,eg,ep,ev,re,r,rp)
end
end
function c61459246.condition2(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and rp==1-tp and Duel.IsEnvironment(1050355,PLAYER_ALL,LOCATION_FZONE)
return aux.NegateSummonCondition() and rp==1-tp and Duel.IsEnvironment(1050355,PLAYER_ALL,LOCATION_FZONE)
end
function c61459246.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -14,7 +14,7 @@ function c68477598.cfilter(c)
return c:IsSummonType(SUMMON_TYPE_PENDULUM)
end
function c68477598.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and eg:IsExists(c68477598.cfilter,1,nil)
return aux.NegateSummonCondition() and eg:IsExists(c68477598.cfilter,1,nil)
end
function c68477598.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -18,7 +18,7 @@ function c77610503.cfilter2(c)
return c:IsSummonType(SUMMON_TYPE_SPECIAL)
end
function c77610503.discon(e,tp,eg,ep,ev,re,r,rp)
return tp~=ep and Duel.GetCurrentChain()==0
return tp~=ep and aux.NegateSummonCondition()
and Duel.IsExistingMatchingCard(c77610503.cfilter1,tp,LOCATION_MZONE,0,1,nil)
and not Duel.IsExistingMatchingCard(c77610503.cfilter2,tp,LOCATION_MZONE,0,1,nil)
end
......
......@@ -18,7 +18,7 @@ function c7811875.initial_effect(c)
c:RegisterEffect(e3)
end
function c7811875.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and eg:IsExists(Card.IsControler,1,nil,1-tp)
return aux.NegateSummonCondition() and eg:IsExists(Card.IsControler,1,nil,1-tp)
end
function c7811875.cfilter(c)
return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsAbleToGraveAsCost()
......
......@@ -29,7 +29,7 @@ function c82382815.cfilter(c)
return c:IsFaceup() and c:IsLevelAbove(7) and c:IsType(TYPE_NORMAL)
end
function c82382815.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and Duel.IsExistingMatchingCard(c82382815.cfilter,tp,LOCATION_MZONE,0,1,nil)
return aux.NegateSummonCondition() and Duel.IsExistingMatchingCard(c82382815.cfilter,tp,LOCATION_MZONE,0,1,nil)
end
function c82382815.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -5,7 +5,7 @@ function c84749824.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c84749824.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c84749824.cost1)
e1:SetTarget(c84749824.target1)
e1:SetOperation(c84749824.activate1)
......@@ -28,9 +28,6 @@ function c84749824.initial_effect(c)
e4:SetOperation(c84749824.activate2)
c:RegisterEffect(e4)
end
function c84749824.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c84749824.cost1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckLPCost(tp,2000)
else Duel.PayLPCost(tp,2000) end
......
......@@ -22,7 +22,7 @@ function c84965420.cfilter(c,tp)
end
function c84965420.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c84965420.filter,tp,LOCATION_MZONE,0,1,nil)
and Duel.GetCurrentChain()==0 and eg:IsExists(c84965420.cfilter,1,nil,tp)
and aux.NegateSummonCondition() and eg:IsExists(c84965420.cfilter,1,nil,tp)
end
function c84965420.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
......
......@@ -5,7 +5,7 @@ function c91078716.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c91078716.condition1)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c91078716.cost)
e1:SetTarget(c91078716.target1)
e1:SetOperation(c91078716.activate1)
......@@ -24,9 +24,6 @@ function c91078716.initial_effect(c)
e3:SetOperation(c91078716.activate2)
c:RegisterEffect(e3)
end
function c91078716.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c91078716.filter(c)
return c:IsRace(RACE_PLANT) and not c:IsStatus(STATUS_BATTLE_DESTROYED)
end
......
......@@ -36,7 +36,7 @@ function c92512625.condition(e,tp,eg,ep,ev,re,r,rp)
and not Duel.IsExistingMatchingCard(c92512625.cfilter,tp,LOCATION_SZONE,0,1,c)
end
function c92512625.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
return aux.NegateSummonCondition()
and c92512625.condition(e,tp,eg,ep,ev,re,r,rp)
end
function c92512625.cost(e,tp,eg,ep,ev,re,r,rp,chk)
......
......@@ -28,7 +28,7 @@ function c94662235.check(tp)
and not g:IsExists(aux.NOT(c94662235.cfilter),1,nil)
end
function c94662235.condition1(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0 and c94662235.check(tp)
return aux.NegateSummonCondition() and c94662235.check(tp)
end
function c94662235.target1(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:GetFirst():IsAbleToRemove() end
......
......@@ -5,7 +5,7 @@ function c98069388.initial_effect(c)
e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_SUMMON)
e1:SetCondition(c98069388.condition)
e1:SetCondition(aux.NegateSummonCondition)
e1:SetCost(c98069388.cost)
e1:SetTarget(c98069388.target)
e1:SetOperation(c98069388.activate)
......@@ -17,9 +17,6 @@ function c98069388.initial_effect(c)
e3:SetCode(EVENT_SPSUMMON)
c:RegisterEffect(e3)
end
function c98069388.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetCurrentChain()==0
end
function c98069388.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.CheckReleaseGroup(REASON_COST,tp,aux.TRUE,1,nil) end
local g=Duel.SelectReleaseGroup(REASON_COST,tp,aux.TRUE,1,1,nil)
......
......@@ -1471,3 +1471,7 @@ function Auxiliary.EPDestroyOperation(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tc,REASON_EFFECT,LOCATION_GRAVE)
end
end
--
function Auxiliary.NegateSummonCondition()
return Duel.GetReadyChain()==0
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