Commit b5261a3a authored by mercury233's avatar mercury233 Committed by GitHub

fix negate and banish effects (#1874)

parent 7689a96f
......@@ -37,7 +37,7 @@ function c14799437.initial_effect(c)
e4:SetCountLimit(1)
e4:SetCondition(c14799437.negcon)
e4:SetCost(c14799437.negcost)
e4:SetTarget(c14799437.negtg)
e4:SetTarget(aux.nbtg)
e4:SetOperation(c14799437.negop)
c:RegisterEffect(e4)
end
......@@ -101,13 +101,6 @@ function c14799437.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectReleaseGroup(tp,c14799437.cfilter,1,1,nil)
Duel.Release(g,REASON_COST)
end
function c14799437.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c14799437.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -35,7 +35,7 @@ function c23440231.initial_effect(c)
e4:SetCountLimit(1)
e4:SetCondition(c23440231.negcon)
e4:SetCost(c23440231.negcost)
e4:SetTarget(c23440231.negtg)
e4:SetTarget(aux.nbtg)
e4:SetOperation(c23440231.negop)
c:RegisterEffect(e4)
end
......@@ -102,13 +102,6 @@ function c23440231.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectReleaseGroup(tp,c23440231.cfilter,1,1,nil)
Duel.Release(g,REASON_COST)
end
function c23440231.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c23440231.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -45,6 +45,11 @@ function c24842059.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
if re:GetActivateLocation()==LOCATION_GRAVE then
e:SetCategory(e:GetCategory()|CATEGORY_GRAVE_ACTION)
else
e:SetCategory(e:GetCategory()&~CATEGORY_GRAVE_ACTION)
end
end
function c24842059.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then
......
......@@ -34,7 +34,7 @@ function c32617464.initial_effect(c)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(c32617464.negcon)
e3:SetTarget(c32617464.negtg)
e3:SetTarget(aux.nbtg)
e3:SetOperation(c32617464.negop)
c:RegisterEffect(e3)
end
......@@ -65,13 +65,6 @@ function c32617464.negcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) and c:GetMutualLinkedGroupCount()>=3
end
function c32617464.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c32617464.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -25,7 +25,7 @@ function c34695290.initial_effect(c)
e3:SetCountLimit(1,34695290)
e3:SetCondition(c34695290.negcon)
e3:SetCost(c34695290.negcost)
e3:SetTarget(c34695290.negtg)
e3:SetTarget(aux.nbtg)
e3:SetOperation(c34695290.negop)
c:RegisterEffect(e3)
--special summon
......@@ -56,13 +56,6 @@ function c34695290.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c34695290.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c34695290.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -30,7 +30,7 @@ function c39468724.initial_effect(c)
e3:SetCountLimit(1,39468725)
e3:SetCondition(c39468724.negcon)
e3:SetCost(c39468724.negcost)
e3:SetTarget(c39468724.negtg)
e3:SetTarget(aux.nbtg)
e3:SetOperation(c39468724.negop)
c:RegisterEffect(e3)
end
......@@ -77,13 +77,6 @@ function c39468724.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectReleaseGroupEx(tp,c39468724.negfilter,1,1,nil,tp)
Duel.Release(g,REASON_COST)
end
function c39468724.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c39468724.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -100,6 +100,11 @@ function c40939228.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=eg:Clone()+c
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
if re:GetActivateLocation()==LOCATION_GRAVE then
e:SetCategory(e:GetCategory()|CATEGORY_GRAVE_ACTION)
else
e:SetCategory(e:GetCategory()&~CATEGORY_GRAVE_ACTION)
end
end
function c40939228.negop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
......
......@@ -7,7 +7,7 @@ function c51849216.initial_effect(c)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,51849216+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c51849216.condition)
e1:SetTarget(c51849216.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c51849216.activate)
c:RegisterEffect(e1)
end
......@@ -18,13 +18,6 @@ function c51849216.condition(e,tp,eg,ep,ev,re,r,rp)
return ep==1-tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
and Duel.IsExistingMatchingCard(c51849216.filter,tp,LOCATION_MZONE,0,1,nil)
end
function c51849216.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c51849216.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(0x29)
end
......
......@@ -29,7 +29,7 @@ function c55063751.initial_effect(c)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(c55063751.negcon)
e3:SetCost(c55063751.negcost)
e3:SetTarget(c55063751.negtg)
e3:SetTarget(aux.nbtg)
e3:SetOperation(c55063751.negop)
c:RegisterEffect(e3)
end
......@@ -63,13 +63,6 @@ function c55063751.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,0x37,2,REASON_COST) end
Duel.RemoveCounter(tp,1,1,0x37,2,REASON_COST)
end
function c55063751.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c55063751.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -14,7 +14,7 @@ function c6182103.initial_effect(c)
e1:SetCountLimit(1,6182103)
e1:SetCondition(c6182103.negcon)
e1:SetCost(c6182103.negcost)
e1:SetTarget(c6182103.negtg)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c6182103.negop)
c:RegisterEffect(e1)
--tohand
......@@ -48,13 +48,6 @@ function c6182103.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c6182103.cfilter,tp,LOCATION_GRAVE+LOCATION_HAND+LOCATION_ONFIELD,0,1,1,nil,rtype)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c6182103.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c6182103.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -6,7 +6,7 @@ function c65703851.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c65703851.condition)
e1:SetTarget(c65703851.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c65703851.activate)
c:RegisterEffect(e1)
end
......@@ -14,13 +14,6 @@ function c65703851.condition(e,tp,eg,ep,ev,re,r,rp)
local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)
return (loc==LOCATION_HAND or loc==LOCATION_GRAVE) and re:IsActiveType(TYPE_MONSTER) and Duel.IsChainNegatable(ev)
end
function c65703851.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c65703851.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -7,7 +7,7 @@ function c703897.initial_effect(c)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,703897)
e1:SetCondition(c703897.condition)
e1:SetTarget(c703897.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c703897.activate)
c:RegisterEffect(e1)
--to hand
......@@ -33,13 +33,6 @@ function c703897.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c703897.cfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsChainNegatable(ev) and (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE))
end
function c703897.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c703897.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -7,7 +7,7 @@ function c72648810.initial_effect(c)
e1:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetCondition(c72648810.condition)
e1:SetTarget(c72648810.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c72648810.activate)
c:RegisterEffect(e1)
end
......@@ -18,13 +18,6 @@ function c72648810.condition(e,tp,eg,ep,ev,re,r,rp)
or (atype==TYPE_PENDULUM+TYPE_SPELL and bit.band(loc,LOCATION_PZONE)~=0 and not re:IsHasType(EFFECT_TYPE_ACTIVATE)))
and Duel.IsChainNegatable(ev)
end
function c72648810.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c72648810.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -7,7 +7,7 @@ function c7403341.initial_effect(c)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,7403341+EFFECT_COUNT_CODE_OATH)
e1:SetCondition(c7403341.condition)
e1:SetTarget(c7403341.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c7403341.activate)
c:RegisterEffect(e1)
end
......@@ -18,13 +18,6 @@ function c7403341.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(c7403341.cfilter,tp,LOCATION_MZONE,0,1,nil)
and (re:IsActiveType(TYPE_MONSTER) or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev)
end
function c7403341.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c7403341.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=re:GetHandler()
if Duel.NegateActivation(ev) and tc:IsRelateToEffect(re) and Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_REMOVED) then
......
......@@ -14,7 +14,7 @@ function c75286621.initial_effect(c)
e1:SetCountLimit(1)
e1:SetCondition(c75286621.negcon)
e1:SetCost(c75286621.negcost)
e1:SetTarget(c75286621.negtg)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c75286621.negop)
c:RegisterEffect(e1)
end
......@@ -30,13 +30,6 @@ function c75286621.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(c75286621.cfilter,tp,LOCATION_HAND,0,1,nil,rtype) end
Duel.DiscardHand(tp,c75286621.cfilter,1,1,REASON_COST,nil,rtype)
end
function c75286621.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c75286621.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -14,7 +14,7 @@ function c88234821.initial_effect(c)
e1:SetCountLimit(1,88234821)
e1:SetCondition(c88234821.negcon)
e1:SetCost(c88234821.negcost)
e1:SetTarget(c88234821.negtg)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c88234821.negop)
c:RegisterEffect(e1)
--remove
......@@ -53,13 +53,6 @@ function c88234821.negcost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.SelectMatchingCard(tp,c88234821.cfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function c88234821.negtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c88234821.negop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)
......
......@@ -15,7 +15,7 @@ function c94662235.initial_effect(c)
e2:SetType(EFFECT_TYPE_ACTIVATE)
e2:SetCode(EVENT_CHAINING)
e2:SetCondition(c94662235.condition2)
e2:SetTarget(c94662235.target2)
e2:SetTarget(aux.nbtg)
e2:SetOperation(c94662235.activate2)
c:RegisterEffect(e2)
end
......@@ -54,13 +54,6 @@ end
function c94662235.condition2(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and c94662235.check(tp)
end
function c94662235.target2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c94662235.activate2(e,tp,eg,ep,ev,re,r,rp)
local ec=eg:GetFirst()
if Duel.NegateActivation(ev) and ec:IsRelateToEffect(re) then
......
......@@ -6,7 +6,7 @@ function c99188141.initial_effect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(c99188141.condition)
e1:SetTarget(c99188141.target)
e1:SetTarget(aux.nbtg)
e1:SetOperation(c99188141.activate)
c:RegisterEffect(e1)
end
......@@ -16,13 +16,6 @@ function c99188141.condition(e,tp,eg,ep,ev,re,r,rp)
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY)
return ex and tg~=nil and tc+tg:FilterCount(Card.IsOnField,nil)-tg:GetCount()>1
end
function c99188141.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function c99188141.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Remove(re:GetHandler(),POS_FACEUP,REASON_EFFECT)
......
......@@ -2838,6 +2838,18 @@ function Auxiliary.nbcon(tp,re)
return Duel.IsPlayerCanRemove(tp)
and (not rc:IsRelateToEffect(re) or rc:IsAbleToRemove())
end
function Auxiliary.nbtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return aux.nbcon(tp,re) end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
if re:GetActivateLocation()==LOCATION_GRAVE then
e:SetCategory(e:GetCategory()|CATEGORY_GRAVE_ACTION)
else
e:SetCategory(e:GetCategory()&~CATEGORY_GRAVE_ACTION)
end
end
--condition of "negate activation and return to deck"
function Auxiliary.ndcon(tp,re)
local rc=re:GetHandler()
......
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