Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Auxiliary.AddPlaceToPZoneIfDestroyEffect #2536

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 1 addition & 22 deletions c13331639.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,7 @@ function c13331639.initial_effect(c)
e7:SetOperation(c13331639.spop)
c:RegisterEffect(e7)
--pendulum
local e8=Effect.CreateEffect(c)
e8:SetDescription(aux.Stringid(13331639,3))
e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e8:SetCode(EVENT_DESTROYED)
e8:SetProperty(EFFECT_FLAG_DELAY)
e8:SetCondition(c13331639.pencon)
e8:SetTarget(c13331639.pentg)
e8:SetOperation(c13331639.penop)
c:RegisterEffect(e8)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
c13331639.material_type=TYPE_SYNCHRO
function c13331639.fusfilter1(c)
Expand Down Expand Up @@ -135,16 +127,3 @@ function c13331639.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function c13331639.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c13331639.pentg(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
end
function c13331639.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c18897163.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ function c18897163.initial_effect(c)
e4:SetOperation(c18897163.desop)
c:RegisterEffect(e4)
--pendulum
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(18897163,3))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e6:SetCode(EVENT_DESTROYED)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetCondition(c18897163.pencon)
e6:SetTarget(c18897163.pentg)
e6:SetOperation(c18897163.penop)
c:RegisterEffect(e6)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c18897163.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_PZONE,0,1,e:GetHandler(),0xaf)
Expand Down Expand Up @@ -113,16 +105,3 @@ function c18897163.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(g,REASON_EFFECT)
end
end
function c18897163.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c18897163.pentg(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
end
function c18897163.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c22070401.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,7 @@ function c22070401.initial_effect(c)
e5:SetOperation(c22070401.operation)
c:RegisterEffect(e5)
--pendulum
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(22070401,2))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e6:SetCode(EVENT_DESTROYED)
e6:SetProperty(EFFECT_FLAG_DELAY)
e6:SetCondition(c22070401.pencon)
e6:SetTarget(c22070401.pentg)
e6:SetOperation(c22070401.penop)
c:RegisterEffect(e6)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c22070401.ffilter(c)
return c:IsFusionAttribute(ATTRIBUTE_DARK) and c:IsFusionType(TYPE_PENDULUM)
Expand Down Expand Up @@ -110,16 +102,3 @@ function c22070401.operation(e,tp,eg,ep,ev,re,r,rp)
tc=g:GetNext()
end
end
function c22070401.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return bit.band(r,REASON_EFFECT+REASON_BATTLE)~=0 and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c22070401.pentg(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
end
function c22070401.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c22211622.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,7 @@ function c22211622.initial_effect(c)
e3:SetOperation(c22211622.spop)
c:RegisterEffect(e3)
--pendulum
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(22211622,2))
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_DESTROYED)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCondition(c22211622.pencon)
e4:SetTarget(c22211622.pentg)
e4:SetOperation(c22211622.penop)
c:RegisterEffect(e4)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c22211622.splimcon(e)
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_MZONE,0)>0
Expand Down Expand Up @@ -133,16 +125,3 @@ function c22211622.spop(e,tp,eg,ep,ev,re,r,rp)
Duel.SpecialSummonComplete()
end
end
function c22211622.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c22211622.pentg(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
end
function c22211622.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c24070330.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,7 @@ function c24070330.initial_effect(c)
e4:SetOperation(c24070330.desop)
c:RegisterEffect(e4)
--pendulum
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(24070330,4))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(c24070330.pencon)
e5:SetTarget(c24070330.pentg)
e5:SetOperation(c24070330.penop)
c:RegisterEffect(e5)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c24070330.thfilter(c)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsAbleToHand()
Expand Down Expand Up @@ -109,16 +101,3 @@ function c24070330.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(g,REASON_EFFECT)
end
end
function c24070330.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c24070330.pentg(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
end
function c24070330.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
26 changes: 2 additions & 24 deletions c24087580.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ function c24087580.initial_effect(c)
e2:SetOperation(c24087580.thop)
c:RegisterEffect(e2)
--pendulum
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCountLimit(1,24087581)
e3:SetCondition(c24087580.pencon)
e3:SetTarget(c24087580.pentg)
e3:SetOperation(c24087580.penop)
c:RegisterEffect(e3)
--pendulem
aux.AddPlaceToPZoneIfDestroyEffect(c)
--pendulum
local e4=Effect.CreateEffect(c)
e4:SetCategory(CATEGORY_LEAVE_GRAVE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
Expand Down Expand Up @@ -69,20 +61,6 @@ function c24087580.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
function c24087580.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_BATTLE+REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c24087580.pentg(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
end
function c24087580.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 end
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
function c24087580.penfilter(c,tp)
return c:IsSetCard(0x4) and c:IsControler(tp)
end
Expand Down
23 changes: 1 addition & 22 deletions c26435595.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ function c26435595.initial_effect(c)
e1:SetOperation(c26435595.pcop)
c:RegisterEffect(e1)
--pendulum
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(26435595,1))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_DESTROYED)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCondition(c26435595.pencon)
e2:SetTarget(c26435595.pentg)
e2:SetOperation(c26435595.penop)
c:RegisterEffect(e2)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c26435595.pcfilter(c,tp)
return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() and c:CheckUniqueOnField(tp,LOCATION_SZONE)
Expand All @@ -38,16 +30,3 @@ function c26435595.pcop(e,tp,eg,ep,ev,re,r,rp)
Duel.MoveToField(g:GetFirst(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
function c26435595.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c26435595.pentg(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
end
function c26435595.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c30095833.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ function c30095833.initial_effect(c)
e2:SetOperation(c30095833.desop)
c:RegisterEffect(e2)
--pendulum move
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(30095833,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_DESTROYED)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(c30095833.pencon)
e3:SetTarget(c30095833.pentg)
e3:SetOperation(c30095833.penop)
c:RegisterEffect(e3)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
c30095833.pendulum_level=7
function c30095833.xyzcon(e)
Expand Down Expand Up @@ -90,16 +82,3 @@ function c30095833.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tg,REASON_EFFECT)
end
end
function c30095833.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c30095833.pentg(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
end
function c30095833.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c37491810.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,7 @@ function c37491810.initial_effect(c)
e2:SetOperation(c37491810.desmop)
c:RegisterEffect(e2)
--pendulum
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(98452268,2))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(c37491810.pencon)
e5:SetTarget(c37491810.pentg)
e5:SetOperation(c37491810.penop)
c:RegisterEffect(e5)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
function c37491810.filter(c,tp)
return c:IsReason(REASON_EFFECT) and c:IsPreviousSetCard(0xe1)
Expand Down Expand Up @@ -82,16 +74,3 @@ function c37491810.desmop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(tc,REASON_EFFECT)
end
end
function c37491810.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c37491810.pentg(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
end
function c37491810.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
23 changes: 1 addition & 22 deletions c6218704.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@ function c6218704.initial_effect(c)
e4:SetOperation(c6218704.setop)
c:RegisterEffect(e4)
--pendulum
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(6218704,4))
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e5:SetCode(EVENT_DESTROYED)
e5:SetProperty(EFFECT_FLAG_DELAY)
e5:SetCondition(c6218704.pencon)
e5:SetTarget(c6218704.pentg)
e5:SetOperation(c6218704.penop)
c:RegisterEffect(e5)
aux.AddPlaceToPZoneIfDestroyEffect(c)
end
c6218704.material_type=TYPE_SYNCHRO
function c6218704.fusfilter1(c)
Expand Down Expand Up @@ -139,16 +131,3 @@ function c6218704.setop(e,tp,eg,ep,ev,re,r,rp)
tc:SetStatus(STATUS_EFFECT_ENABLED,true)
end
end
function c6218704.pencon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
end
function c6218704.pentg(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
end
function c6218704.penop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end
34 changes: 34 additions & 0 deletions utility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1598,3 +1598,37 @@ end
function Auxiliary.BanishRedirectCondition(e)
return e:GetHandler():IsFaceup()
end
---If this card in the Monster Zone is destroyed by battle or card effect: You can place this card in your Pendulum Zone.
function Auxiliary.AddPlaceToPZoneIfDestroyEffect(c)
local e1=Effect.CreateEffect(c)
e1:SetDescription(1170)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_DESTROYED)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCondition(Auxiliary.PlaceToPZoneCondition)
e1:SetTarget(Auxiliary.PlaceToPZoneTarget)
e1:SetOperation(Auxiliary.PlaceToPZoneOperation)
c:RegisterEffect(e1)
return e1
end
---Check whether the player has a Pendulum Zone available
function Auxiliary.CheckPendulumLocation(tp)
return Duel.CheckLocation(tp,LOCATION_PZONE,0) or Duel.CheckLocation(tp,LOCATION_PZONE,1)
end
function Auxiliary.PlaceToPZoneCondition(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsReason(REASON_BATTLE+REASON_EFFECT)
end
function Auxiliary.PlaceToPZoneTarget(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Auxiliary.CheckPendulumLocation(tp) end
local c=e:GetHandler()
if c:IsLocation(LOCATION_GRAVE) then
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0)
end
end
function Auxiliary.PlaceToPZoneOperation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
end
end