create a lua script for these custom yugioh cards in edopro. The id for "phoeniverse" archtype is "a72": "Phoeniverse Flamecycle (spell continuous card): You can only control 1 "Phoeniverse Flamecycle." Once per turn: You can discard 1 card; add 1 "Phoeniverse" monster from your Deck to your hand. During your Main Phase: You can banish 1 "Phoeniverse" monster from your GY; send 1 "Phoeniverse" monster with a different name from your Deck to the GY, and if you do, draw 1 card. If this card is sent from the field to the GY: You can target up to 3 of your banished "Phoeniverse" monsters; shuffle them into the Deck." "Phoeniverse Rebirth Cry (normal trap): When an opponent's monster declares an attack: You can Special Summon 1 "Phoeniverse" monster from your hand or GY, and if you do, banish the attacking monster. If this card is in your GY, except the turn it was sent there: You can banish 1 other "Phoeniverse" card from your GY; set this card, but banish it when it leaves the field. You can only activate 1 "Phoeniverse Rebirth Cry" per turn." "Phoeniverse Nova Shield (counter trap): When a Spell/Trap Card, or monster effect, is activated while you control a "Phoeniverse" monster: Banish 1 "Phoeniverse" monster from your hand or field; negate the activation, and if you do, banish that card. If you have 3 or more "Phoeniverse" monsters banished, your opponent cannot activate cards or effects in response to this card's activation. You can only activate 1 "Phoeniverse Nova Shield" per turn." "Phoeniverse Inferno Wing (monster effect): Phoeniverse Inferno Wing" "Phoeniverse Ashension (quick play spell): Banish 2 "Phoeniverse" monsters from your hand and/or GY; Special Summon 1 "Phoeniverse" monster from your Deck or GY with a Level equal to or lower than the total Levels of the banished monsters. During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY; add 1 of your banished "Phoeniverse" monsters to your hand. You can only activate 1 "Phoeniverse Ashension" per turn." "Phoeniverse Starfire Dragon (xyz monster): 2 Level 4 "Phoeniverse" monsters
You can also Xyz Summon this card by using a Rank 3 "Phoeniverse" Xyz Monster you control as material. (Transfer its materials to this card.) Once per turn (Quick Effect): You can detach 1 material from this card; banish 1 card on the field. If this Xyz Summoned card you control is destroyed by battle with an opponent's attacking monster or by an opponent's card effect, and sent to your GY: You can banish this card; Special Summon 1 "Phoeniverse" Xyz Monster from your Extra Deck, except "Phoeniverse Starfire Dragon." You can only use this effect of "Phoeniverse Starfire Dragon" once per turn."
Assistant
Certainly! Below are the Lua scripts for the custom "Phoeniverse" cards for EDOPro. Each script corresponds to the card effects you've provided. Please ensure that the card IDs are unique and adjust them if necessary. The archetype code "0xa72" is used for "Phoeniverse" cards.
1. Phoeniverse Flamecycle
Card ID: 10000000 (Replace with an unused ID)
lua
--Phoeniverse Flamecycle
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
--Discard to add 1 "Phoeniverse" monster
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DISCARD)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_SZONE)
e1:SetCountLimit(1)
e1:SetCost(s.thcost)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
--Banish 1, send 1, draw 1
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DRAW)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.tgcon)
e2:SetCost(s.tgcost)
e2:SetTarget(s.tgtg)
e2:SetOperation(s.tgop)
c:RegisterEffect(e2)
--Recycle banished "Phoeniverse" monsters
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,2))
e3:SetCategory(CATEGORY_TODECK)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCondition(s.tdcon)
e3:SetTarget(s.tdtg)
e3:SetOperation(s.tdop)
c:RegisterEffect(e3)
end
s.listed_series={0xa72}
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD)
end
function s.thfilter(c)
return c:IsSetCard(0xa72) and c:IsMonster() and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,tc)
end
end
function s.tgcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase()
end
function s.tgcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end
local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil):GetFirst()
e:SetLabel(tc:GetCode())
Duel.Remove(tc,POS_FACEUP,REASON_COST)
end
function s.cfilter(c)
return c:IsSetCard(0xa72) and c:IsAbleToRemoveAsCost()
end
function s.tgfilter(c,code)
return c:IsSetCard(0xa72) and not c:IsCode(code) and c:IsAbleToGrave()
end
function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local code=e:GetLabel()
return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil,code)
and Duel.IsPlayerCanDraw(tp,1)
end
Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function s.tgop(e,tp,eg,ep,ev,re,r,rp)
local code=e:GetLabel()
local tc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil,code):GetFirst()
if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 then
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousLocation(LOCATION_ONFIELD)
end
function s.tdfilter(c)
return c:IsSetCard(0xa72) and c:IsFaceup() and c:IsAbleToDeck()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) end
local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,math.min(3,g:GetCount()),tp,LOCATION_REMOVED)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil)
if #g==0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local sg=g:Select(tp,1,3,nil)
Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
2. Phoeniverse Rebirth Cry
Card ID: 10000001 (Replace with an unused ID)
lua
--Phoeniverse Rebirth Cry
local s,id=GetID()
function s.initial_effect(c)
--Activate effect
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
--Set itself from GY
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(s.setcon)
e2:SetCost(s.setcost)
e2:SetTarget(s.settg)
e2:SetOperation(s.setop)
c:RegisterEffect(e2)
end
s.listed_series={0xa72}
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetAttacker():GetControler()~=tp
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0xa72) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttacker()
if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp)
and at:IsAbleToRemove() end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND+LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,at,1,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttacker()
if at:IsRelateToBattle() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,nil,e,tp) then
if Duel.SpecialSummon(Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,1,1,nil,e,tp),0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.Remove(at,POS_FACEUP,REASON_EFFECT)
end
end
end
function s.setcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetTurnPlayer()~=tp and aux.exccon(e)
end
function s.cfilter(c)
return c:IsSetCard(0xa72) and c:IsAbleToRemoveAsCost()
end
function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end
local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()):GetFirst()
Duel.Remove(tc,POS_FACEUP,REASON_COST)
end
function s.settg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end
end
function s.setop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local c=e:GetHandler()
Duel.SSet(tp,c)
--Banish when leaves field
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT)
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
e1:SetValue(LOCATION_REMOVED)
c:RegisterEffect(e1)
end
3. Phoeniverse Nova Shield
Card ID: 10000002 (Replace with an unused ID)
lua
--Phoeniverse Nova Shield
local s,id=GetID()
function s.initial_effect(c)
--Negate activation
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
end
s.listed_series={0xa72}
function s.cfilter(c)
return c:IsSetCard(0xa72) and c:IsAbleToRemoveAsCost()
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return re:IsActiveType(TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP) and Duel.IsChainNegatable(ev)
and Duel.IsExistingMatchingCard(aux.FilterFaceupFunction(Card.IsSetCard,0xa72),tp,LOCATION_MZONE,0,1,nil)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,nil) end
local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND+LOCATION_MZONE,0,1,1,nil):GetFirst()
Duel.Remove(tc,POS_FACEUP,REASON_COST)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local b1=Duel.IsExistingMatchingCard(s.banfilter,tp,LOCATION_GRAVE,0,3,nil)
if b1 then
Duel.SetChainLimit(aux.FALSE)
end
Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0)
if re:GetHandler():IsAbleToRemove() then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,1,0,0)
end
end
function s.banfilter(c)
return c:IsSetCard(0xa72) and c:IsFaceup()
end
function s.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)
end
end
4. Phoeniverse Ashension
Card ID: 10000003 (Replace with an unused ID)
lua
--Phoeniverse Ashension
local s,id=GetID()
function s.initial_effect(c)
--Special Summon 1 "Phoeniverse" monster
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
e1:SetCountLimit(1,id+EFFECT_COUNT_CODE_OATH)
c:RegisterEffect(e1)
--Add 1 banished "Phoeniverse" monster to hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_GRAVE)
e2:SetCondition(aux.exccon)
e2:SetCost(aux.bfgcost)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
end
s.listed_series={0xa72}
function s.cfilter(c)
return c:IsSetCard(0xa72) and c:IsAbleToRemoveAsCost()
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,2,nil) end
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND+LOCATION_GRAVE,0,2,2,nil)
e:SetLabel(g:GetSum(Card.GetLevel))
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function s.spfilter(c,e,tp,lv)
return c:IsSetCard(0xa72) and c:IsLevelBelow(lv) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local lv=e:GetLabel()
if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,nil,e,tp,lv)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK+LOCATION_GRAVE)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local lv=e:GetLabel()
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK+LOCATION_GRAVE,0,1,1,nil,e,tp,lv):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
tc:CompleteProcedure()
end
end
function s.thfilter(c)
return c:IsSetCard(0xa72) and c:IsFaceup() and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_REMOVED)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil):GetFirst()
if tc then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
5. Phoeniverse Starfire Dragon
Card ID: 10000004 (Replace with an unused ID)
lua
Note:
Card IDs: Replace the IDs (10000000, 10000001, etc.) with unique IDs that do not conflict with existing cards in your database.
Setcode: The setcode 0xa72 is used for the "Phoeniverse" archetype. Ensure this setcode is correctly added to your strings and script files.
Artwork and Card Data: Remember to create or update the corresponding card data .cdb (or equivalent) files with the card properties (name, type, attribute, ATK/DEF, levels, etc.).
Testing: After adding the scripts and card data to your EDOPro installation, test the cards thoroughly to ensure all effects work as intended.
If you need scripts for "Phoeniverse Inferno Wing" or any other cards, please provide the full effect descriptions for those cards so I can assist further.
--Phoeniverse Starfire Dragon
local s,id=GetID()
function s.initial_effect(c)
--Xyz Summon procedure
Xyz.AddProcedure(c,s.mfilter,4,2)
c:EnableReviveLimit()
--Alternative Xyz Summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_XYZ_LEVEL)
e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e0:SetRange(LOCATION_EXTRA)
e0:SetCondition(s.xycon)
c:RegisterEffect(e0)
--Banish 1 card on the field
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_END_PHASE)
e1:SetCountLimit(1)
e1:SetCost(s.rmcost)
e1:SetTarget(s.rmtg)
e1:SetOperation(s.rmop)
c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT)
--Special Summon 1 "Phoeniverse" Xyz Monster from Extra Deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
e2:SetCountLimit(1,id)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(s.spcon2)
c:RegisterEffect(e3)
end
s.listed_series={0xa72}
function s.mfilter(c,lc,stype)
return c:IsSetCard(0xa72,lc,stype)
end
function s.xycon(e)
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,0xa72),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
end
function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsAbleToRemove() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local tc=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,tc,1,0,0)
end
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then
--Additional effects can be added here if needed
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsPreviousPosition(POS_FACEUP_ATTACK) and c:IsReason(REASON_BATTLE)
end
function s.spcon2(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) and rp==1-tp and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.spfilter(c,e,tp)
return c:IsSetCard(0xa72) and c:IsType(TYPE_XYZ) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_XYZ)<=0 then return end
local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
if tc then
Duel.SpecialSummon(tc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
tc:CompleteProcedure()
end
end