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

add aux.AddThisCardInGraveAlreadyCheck (#1870)

parent e0f7efaf
--アマゾネスペット仔虎
function c10928224.initial_effect(c)
--same effect send this card to grave and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(10928224,0))
......@@ -9,6 +11,7 @@ function c10928224.initial_effect(c)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,10928224)
e1:SetLabelObject(e0)
e1:SetCondition(c10928224.spcon)
e1:SetTarget(c10928224.sptg)
e1:SetOperation(c10928224.spop)
......@@ -27,11 +30,13 @@ function c10928224.initial_effect(c)
e4:SetValue(c10928224.val)
c:RegisterEffect(e4)
end
function c10928224.cfilter(c,tp)
function c10928224.cfilter(c,tp,se)
return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x4)
and (se==nil or c:GetReasonEffect()~=se)
end
function c10928224.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c10928224.cfilter,1,nil,tp)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c10928224.cfilter,1,nil,tp,se)
end
function c10928224.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -3,6 +3,8 @@ function c23732205.initial_effect(c)
--link summon
aux.AddLinkProcedure(c,c23732205.mfilter,2)
c:EnableReviveLimit()
--same effect send this card to grave and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--to deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(23732205,0))
......@@ -25,6 +27,7 @@ function c23732205.initial_effect(c)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,23732206)
e2:SetLabelObject(e0)
e2:SetCondition(c23732205.spcon)
e2:SetTarget(c23732205.sptg)
e2:SetOperation(c23732205.spop)
......@@ -59,11 +62,13 @@ function c23732205.desop(e,tp,eg,ep,ev,re,r,rp)
end
end
end
function c23732205.cfilter(c,tp)
function c23732205.cfilter(c,tp,se)
return c:IsFaceup() and c:IsControler(tp) and c:IsSetCard(0x102)
and (se==nil or c:GetReasonEffect()~=se)
end
function c23732205.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c23732205.cfilter,1,nil,tp)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c23732205.cfilter,1,nil,tp,se)
end
function c23732205.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -2,6 +2,8 @@
function c43266605.initial_effect(c)
--change name
aux.EnableChangeCode(c,49036338,LOCATION_HAND+LOCATION_GRAVE)
--same effect send this card to grave and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
......@@ -20,6 +22,7 @@ function c43266605.initial_effect(c)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1,43266605)
e3:SetLabelObject(e0)
e3:SetCondition(c43266605.spcon)
e3:SetTarget(c43266605.sptg)
e3:SetOperation(c43266605.spop)
......@@ -40,11 +43,13 @@ end
function c43266605.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT+REASON_DISCARD+REASON_REPLACE)
end
function c43266605.cfilter(c,tp)
function c43266605.cfilter(c,tp,se)
return c:IsSetCard(0xc1) and c:IsType(TYPE_TUNER) and c:IsControler(tp)
and (se==nil or c:GetReasonEffect()~=se)
end
function c43266605.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c43266605.cfilter,1,nil,tp)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c43266605.cfilter,1,nil,tp,se)
end
function c43266605.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
--シーアーカイバー
function c53309998.initial_effect(c)
--same effect send this card to grave and summon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(53309998,0))
......@@ -9,6 +11,7 @@ function c53309998.initial_effect(c)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetRange(LOCATION_HAND+LOCATION_GRAVE)
e1:SetCountLimit(1,53309998)
e1:SetLabelObject(e0)
e1:SetCondition(c53309998.spcon)
e1:SetTarget(c53309998.sptg)
e1:SetOperation(c53309998.spop)
......@@ -17,7 +20,7 @@ function c53309998.initial_effect(c)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e2)
end
function c53309998.cfilter(c,zone)
function c53309998.cfilter(c,zone,se)
local seq=c:GetSequence()
if c:IsLocation(LOCATION_MZONE) then
if c:IsControler(1) then seq=seq+16 end
......@@ -25,11 +28,12 @@ function c53309998.cfilter(c,zone)
seq=c:GetPreviousSequence()
if c:IsPreviousControler(1) then seq=seq+16 end
end
return bit.extract(zone,seq)~=0
return bit.extract(zone,seq)~=0 and (se==nil or c:GetReasonEffect()~=se)
end
function c53309998.spcon(e,tp,eg,ep,ev,re,r,rp)
local se=e:GetLabelObject():GetLabelObject()
local zone=Duel.GetLinkedZone(0)+(Duel.GetLinkedZone(1)<<0x10)
return eg:IsExists(c53309998.cfilter,1,nil,zone)
return eg:IsExists(c53309998.cfilter,1,nil,zone,se)
end
function c53309998.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
--エクシーズ・スライドルフィン
function c7850740.initial_effect(c)
--same effect send this card to grave and spsummon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--special summon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(7850740,0))
......@@ -21,6 +23,7 @@ function c7850740.initial_effect(c)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,7850741)
e2:SetLabelObject(e0)
e2:SetCondition(c7850740.matcon)
e2:SetTarget(c7850740.mattg)
e2:SetOperation(c7850740.matop)
......@@ -43,11 +46,13 @@ function c7850740.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function c7850740.cfilter1(c,e,tp)
function c7850740.cfilter1(c,e,tp,se)
return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsControler(tp) and c:IsCanBeEffectTarget(e)
and (se==nil or c:GetReasonEffect()~=se)
end
function c7850740.matcon(e,tp,eg,ep,ev,re,r,rp)
return aux.exccon(e) and eg:IsExists(c7850740.cfilter1,1,nil,e,tp)
local se=e:GetLabelObject():GetLabelObject()
return aux.exccon(e) and eg:IsExists(c7850740.cfilter1,1,nil,e,tp,se)
end
function c7850740.tgfilter(c,tp,eg)
return eg:IsContains(c) and c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsControler(tp)
......
--電脳堺姫-娘々
function c8736823.initial_effect(c)
--same effect send this card to grave and spsummon another card check
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_TO_GRAVE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetOperation(c8736823.checkop)
c:RegisterEffect(e0)
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(8736823,0))
......@@ -36,35 +31,6 @@ function c8736823.initial_effect(c)
e3:SetOperation(c8736823.tdop)
c:RegisterEffect(e3)
end
function c8736823.checkop(e,tp,eg,ep,ev,re,r,rp)
if (r&REASON_EFFECT)>0 then
e:SetLabelObject(re)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(c8736823.resetop)
e1:SetLabelObject(e)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_BREAK_EFFECT)
e2:SetOperation(c8736823.resetop2)
e2:SetReset(RESET_CHAIN)
e2:SetLabelObject(e1)
Duel.RegisterEffect(e2,tp)
end
end
function c8736823.resetop(e,tp,eg,ep,ev,re,r,rp)
--this will run after EVENT_SPSUMMON_SUCCESS
e:GetLabelObject():SetLabelObject(nil)
e:Reset()
end
function c8736823.resetop2(e,tp,eg,ep,ev,re,r,rp)
local e1=e:GetLabelObject()
e1:GetLabelObject():SetLabelObject(nil)
e1:Reset()
e:Reset()
end
function c8736823.cfilter(c,tp,se)
return c:IsFaceup() and c:IsLevel(3) and c:IsControler(tp) and (se==nil or c:GetReasonEffect()~=se)
end
......
--ティンダングル・イントルーダー
function c94142993.initial_effect(c)
--same effect send this card to grave and spsummon another card check
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e0:SetCode(EVENT_TO_GRAVE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e0:SetOperation(c94142993.checkop)
c:RegisterEffect(e0)
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--flip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(94142993,0))
......@@ -41,35 +36,6 @@ function c94142993.initial_effect(c)
e3:SetOperation(c94142993.spop)
c:RegisterEffect(e3)
end
function c94142993.checkop(e,tp,eg,ep,ev,re,r,rp)
if (r&REASON_EFFECT)>0 then
e:SetLabelObject(re)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(c94142993.resetop)
e1:SetLabelObject(e)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_BREAK_EFFECT)
e2:SetOperation(c94142993.resetop2)
e2:SetReset(RESET_CHAIN)
e2:SetLabelObject(e1)
Duel.RegisterEffect(e2,tp)
end
end
function c94142993.resetop(e,tp,eg,ep,ev,re,r,rp)
--this will run after EVENT_SPSUMMON_SUCCESS
e:GetLabelObject():SetLabelObject(nil)
e:Reset()
end
function c94142993.resetop2(e,tp,eg,ep,ev,re,r,rp)
local e1=e:GetLabelObject()
e1:GetLabelObject():SetLabelObject(nil)
e1:Reset()
e:Reset()
end
function c94142993.thfilter(c)
return c:IsSetCard(0x10b) and c:IsAbleToHand()
end
......
--ブンボーグ001
function c94693857.initial_effect(c)
--same effect send this card to grave and summon another card check
local e0=aux.AddThisCardInGraveAlreadyCheck(c)
--atk/def
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
......@@ -19,19 +21,21 @@ function c94693857.initial_effect(c)
e3:SetRange(LOCATION_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetLabelObject(e0)
e3:SetCondition(c94693857.spcon)
e3:SetTarget(c94693857.sptg)
e3:SetOperation(c94693857.spop)
c:RegisterEffect(e3)
end
function c94693857.filter(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE)
function c94693857.filter(c,se)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) and (se==nil or c:GetReasonEffect()~=se)
end
function c94693857.atkval(e,c)
return Duel.GetMatchingGroupCount(c94693857.filter,c:GetControler(),LOCATION_MZONE,0,nil)*500
end
function c94693857.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(c94693857.filter,2,nil)
local se=e:GetLabelObject():GetLabelObject()
return eg:IsExists(c94693857.filter,2,nil,se)
end
function c94693857.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
......
......@@ -2887,3 +2887,44 @@ function Auxiliary.GetCappedAttack(c)
return x
end
end
--when this card is sent to grave, record the reason effect
--to check whether the reason effect do something simultaneously
--so the "while this card is in your GY" condition isn't met
function Auxiliary.AddThisCardInGraveAlreadyCheck(c)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(Auxiliary.ThisCardInGraveAlreadyCheckOperation)
c:RegisterEffect(e1)
return e1
end
function Auxiliary.ThisCardInGraveAlreadyCheckOperation(e,tp,eg,ep,ev,re,r,rp)
if (r&REASON_EFFECT)>0 then
e:SetLabelObject(re)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_CHAIN_END)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(Auxiliary.ThisCardInGraveAlreadyReset1)
e1:SetLabelObject(e)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EVENT_BREAK_EFFECT)
e2:SetOperation(Auxiliary.ThisCardInGraveAlreadyReset2)
e2:SetReset(RESET_CHAIN)
e2:SetLabelObject(e1)
Duel.RegisterEffect(e2,tp)
end
end
function Auxiliary.ThisCardInGraveAlreadyReset1(e)
--this will run after EVENT_SPSUMMON_SUCCESS
e:GetLabelObject():SetLabelObject(nil)
e:Reset()
end
function Auxiliary.ThisCardInGraveAlreadyReset2(e)
local e1=e:GetLabelObject()
e1:GetLabelObject():SetLabelObject(nil)
e1:Reset()
e:Reset()
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