instruction
stringclasses
1 value
input
stringlengths
10
1.11k
output
stringlengths
67
7.06k
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster you control is destroyed by a battle in which you took damage, and it was in face-up Attack Position at the start of the Damage Step and when it was destroyed: Special Summon 1 "Sinister Seed Token" (Plant-Type/DARK/Level 1/ATK 100/DEF 100) for every 500 points of battle damage you took from that battle.
--デモンバルサム・シード --Sinister Seeds local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) aux.GlobalCheck(s,function() s[0]=nil s[1]=nil s[2]=nil local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_BATTLE_DAMAGE) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) aux.AddValuesReset(function() s[0]=nil s[1]=nil s[2]=nil end) end) end s.listed_names={60406592} function s.checkop(e,tp,eg,ep,ev,re,r,rp) s[0]=ep s[1]=math.floor(ev/500) s[2]=eg:GetFirst():GetBattleTarget() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return s[0]==tp and #eg==1 and eg:GetFirst()==s[2] and eg:GetFirst():GetBattlePosition()==POS_FACEUP_ATTACK end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local ct=s[1] if chk==0 then return ct>0 and (ct==1 or not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) and Duel.GetLocationCount(tp,LOCATION_MZONE)>=ct and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,100,100,1,RACE_PLANT,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,ct,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,ct,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ct=s[1] if (ct>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) or Duel.GetLocationCount(tp,LOCATION_MZONE)<ct or not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,100,100,1,RACE_PLANT,ATTRIBUTE_DARK) then return end for i=1,ct do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can change 1 face-up Attack Position monster your opponent controls to face-up Defense Position.
--ジュッテ・ナイト --Jutte Fighter local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) end function s.filter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition() end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUPATTACK) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsPosition(POS_FACEUP_ATTACK) then Duel.ChangePosition(tc,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand or GY) while you have 3 or more cards in your GY with different names that are "Temple of the Kings" and/or Traps, by placing 2 of them on the bottom of the Deck in any order. You can send this card from your hand to the GY; add 1 "The Man with the Mark" from your Deck to your hand. If a Spell/Trap(s) you control is destroyed by card effect: You can target 1 card your opponent controls; destroy it. You can only use each effect of "Anubis the Last Judge" once per turn.
--ジャッジメント・オブ・アヌビス --Anubis the Last Judge --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Must first be Special Summoned (from your hand or GY) while you have 3 or more cards in your GY with different names that are "Temple of the Kings" and/or Traps, by placing 2 of them on the bottom of the Deck in any order local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_HAND|LOCATION_GRAVE) e0:SetCondition(s.spcon) e0:SetTarget(s.sptg) e0:SetOperation(s.spop) c:RegisterEffect(e0) --Add 1 "The Man with the Mark" from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Destroy 1 card your opponent controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_names={CARD_TEMPLE_OF_THE_KINGS,97522863} --"The Man with the Mark" function s.tdfilter(c) return c:IsCode(CARD_TEMPLE_OF_THE_KINGS) or c:IsTrap() end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_GRAVE,0,nil) local rg=g:Filter(Card.IsAbleToDeckAsCost,c) return g:GetClassCount(Card.GetCode)>=3 and aux.SelectUnselectGroup(rg,e,tp,2,2,aux.dncheck,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_GRAVE,0,c):Match(Card.IsAbleToDeckAsCost,nil) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_TODECK,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_COST) g:DeleteGroup() Duel.SortDeckbottom(tp,tp,2) end function s.thfilter(c) return c:IsCode(97522863) 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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.desconfilter(c,tp) return c:IsPreviousTypeOnField(TYPE_SPELL|TYPE_TRAP) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.desconfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except by sending 1 Fiend-Type monster you control and 1 Fiend-Type monster from your hand to the Graveyard when your opponent's monster declares an attack. This card cannot be destroyed by battle. Once per turn, you can return all face-up Trap Cards you control to the hand.
--ダークネス・ネオスフィア --Darkness Neosphere local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --battle indestructable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetValue(1) c:RegisterEffect(e3) --to hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetCountLimit(1) e4:SetRange(LOCATION_MZONE) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.cfilter1(c,ft) return c:IsFaceup() and c:IsRace(RACE_FIEND) and c:IsAbleToGraveAsCost() and (ft>0 or c:GetSequence()<5) end function s.cfilter2(c) return c:IsRace(RACE_FIEND) and c:IsAbleToGraveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.IsExistingMatchingCard(s.cfilter1,tp,LOCATION_MZONE,0,1,nil,ft) and Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g1=Duel.SelectMatchingCard(tp,s.cfilter1,tp,LOCATION_MZONE,0,1,1,nil,ft) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g2=Duel.SelectMatchingCard(tp,s.cfilter2,tp,LOCATION_HAND,0,1,1,e:GetHandler()) g1:Merge(g2) Duel.SendtoGrave(g1,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 then c:CompleteProcedure() end end function s.filter(c) return c:IsFaceup() and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,0,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,0,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Punishment Dragon": Target 1 "Judgment Dragon" in your GY; add it to your hand, then send the top 4 cards of your Deck to the GY. If this card is sent from the Deck to the GY by a "Lightsworn" monster's effect: You can target 1 "Punishment Dragon" in your GY; add it to your hand, then banish the top 4 cards of your Deck.
--黄昏の双龍 --Twilight Twin Dragons local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_LIGHTSWORN} s.listed_names={19959563,57774843} function s.cfilter(c) return c:IsFaceup() and c:IsCode(19959563) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.filter(c) return c:IsCode(57774843) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsPlayerCanDiscardDeck(tp,4) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,4) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 then Duel.BreakEffect() Duel.DiscardDeck(tp,4,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) and re:IsMonsterEffect() and re:GetHandler():IsSetCard(SET_LIGHTSWORN) and (r&REASON_EFFECT)~=0 end function s.thfilter(c) return c:IsCode(19959563) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) end local rg=Duel.GetDecktopGroup(tp,4) if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) and rg:FilterCount(Card.IsAbleToRemove,nil)==4 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,rg,4,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 then Duel.BreakEffect() local rg=Duel.GetDecktopGroup(tp,4) Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Red Dragon Archfiend" monster you control battles, during damage calculation: Make that monster you control unable to be destroyed by that battle, and if you do, Special Summon this card as a Normal Monster (Fiend-Type/Tuner/FIRE/Level 1/ATK 0/DEF 0). (This card is also still a Trap Card.)
--キング・スカーレット --King Scarlet local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_RED_DRAGON_ARCHFIEND} function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end return tc and tc:IsSetCard(SET_RED_DRAGON_ARCHFIEND) and tc:IsRelateToBattle() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_NORMAL|TYPE_TUNER,0,0,1,RACE_FIEND,ATTRIBUTE_FIRE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end if not tc or not tc:IsRelateToBattle() then return end local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) tc:RegisterEffect(e1) if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_NORMAL|TYPE_TUNER,0,0,1,RACE_FIEND,ATTRIBUTE_FIRE) then return end c:AddMonsterAttribute(TYPE_NORMAL+TYPE_TUNER+TYPE_TRAP) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 card to the GY, then target 1 monster your opponent controls with DEF less than or equal to this card's ATK; destroy that target.
--魔轟神ガルバス --Fabled Gallabas local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.cost) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.costfilter(c) return c:IsDiscardable() and c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.costfilter,1,1,REASON_DISCARD|REASON_COST) end function s.filter(c,atk) return c:IsFaceup() and c:IsDefenseBelow(atk) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc,c:GetAttack()) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil,c:GetAttack()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil,c:GetAttack()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsDefenseBelow(c:GetAttack()) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This turn, cards in Pendulum Zones cannot be destroyed by your opponent's card effects, also negate any effect activated by your opponent that targeted a card(s) in the Pendulum Zones.
--ペンデュラム・モラトリアム --Pendulum Impenetrable local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetTargetRange(LOCATION_PZONE,LOCATION_PZONE) e1:SetValue(s.indval) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetCondition(s.discon) e2:SetOperation(s.disop) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.indval(e,re,tp) return tp~=e:GetHandlerPlayer() end function s.indfilter(c) return c:IsLocation(LOCATION_PZONE) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.indfilter,1,nil) and ep~=tp end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, when your opponent activates a card or effect that targets 1 "Bystial" monster you control (and no other cards), or when your opponent activates a card or effect in response to the activation of your "Bystial" monster effect: You can target 1 LIGHT or DARK monster in either GY; banish it, and if you do, negate that activated effect.
--導かれし烙印 --Branded Befallen --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Banish 1 LIGHT or DARK monster from either GY and negate an activated effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetCondition(s.negcon) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) end s.listed_series={SET_BYSTIAL} function s.negcon(e,tp,eg,ep,ev,re,r,rp) if not (ep==1-tp and Duel.IsChainDisablable(ev)) or re:GetHandler():IsDisabled() then return false end local ch=Duel.GetCurrentChain(true)-1 if ch>0 then local cplayer=Duel.GetChainInfo(ch,CHAININFO_TRIGGERING_CONTROLER) local ceff=Duel.GetChainInfo(ch,CHAININFO_TRIGGERING_EFFECT) if cplayer==tp and ceff:GetHandler():IsSetCard(SET_BYSTIAL) and ceff:IsMonsterEffect() then return true end end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if #g~=1 then return false end local tc=g:GetFirst() return tc:IsSetCard(SET_BYSTIAL) and tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() end function s.rmvfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.rmvfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmvfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmvfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 then Duel.NegateEffect(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a face-up Reptile monster(s) you control is destroyed by battle or an opponent's card effect: You can target 1 card your opponent controls; send it to the GY. If this card in the Field Zone is destroyed by your opponent's card effect: You can send cards from the top of your opponent's Deck to the GY, equal to the number of Reptile monsters with different names in your GY. You can only use each effect of "Ogdoadic Origin" once per turn.
--溟界の淵源 --Ogdoadic Origin --scripted by Hatter local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --to grave local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.gycon) e2:SetTarget(s.gytg) e2:SetOperation(s.gyop) c:RegisterEffect(e2) --mill local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DECKDES) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,{id,1}) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.mlcon) e3:SetTarget(s.mltg) e3:SetOperation(s.mlop) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:GetPreviousRaceOnField()&RACE_REPTILE==RACE_REPTILE and (c:IsReason(REASON_BATTLE) or (c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT))) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) end function s.gycon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsAbleToGrave() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) end function s.gyop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoGrave(tc,REASON_EFFECT) end end function s.mlcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_FZONE) and c:IsPreviousControler(tp) end function s.mltg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=Duel.GetMatchingGroup(Card.IsRace,tp,LOCATION_GRAVE,0,nil,RACE_REPTILE):GetClassCount(Card.GetCode) if chk==0 then return ct>0 and Duel.IsPlayerCanDiscardDeck(1-tp,ct) end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,1-tp,ct) end function s.mlop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroup(Card.IsRace,tp,LOCATION_GRAVE,0,nil,RACE_REPTILE):GetClassCount(Card.GetCode) if ct>0 and Duel.IsPlayerCanDiscardDeck(1-tp,ct) then Duel.DiscardDeck(1-tp,ct,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, or all monsters you control are "Gouki" monsters, you can Normal Summon this card without Tributing. If this card is sent from the field to the GY: You can add 1 "Gouki" card from your Deck to your hand, except "Gouki Riscorpio". You can only use this effect of "Gouki Riscorpio" once per turn.
--剛鬼ライジングスコーピオ --Gouki Riscorpio local s,id=GetID() function s.initial_effect(c) --summon with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) e1:SetValue(1) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_GOUKI} s.listed_names={id} function s.cfilter(c) return c:IsFacedown() or not c:IsSetCard(SET_GOUKI) end function s.ntcon(e,c,minc,zone) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.thfilter(c) return c:IsSetCard(SET_GOUKI) and not c:IsCode(id) 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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 6 or higher "HERO" monster + 1 "Destiny HERO" monster Monsters your opponent controls lose 200 ATK for each "HERO" card in your GY. You can only use each of the following effects of "Destiny HERO - Destroyer Phoenix Enforcer" once per turn. (Quick Effect): You can destroy both 1 card you control and 1 card on the field. If this card is destroyed by battle or card effect: You can activate this effect; Special Summon 1 "Destiny HERO" monster from your GY during the Standby Phase of the next turn.
--D-HERO デストロイフェニックスガイ --Destiny HERO - Destroyer Phoenix Enforcer local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Fusion.AddProcFun2(c,s.matfilter,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_DESTINY_HERO),true) --Decrease the ATK of monster your opponent controls local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(s.atkval) c:RegisterEffect(e1) --Destroy 2 cards on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e2:SetCountLimit(1,id) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Special summon 1 "destiny HERO" monster during the next Standby Phase local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_HERO,SET_DESTINY_HERO} s.material_setcode={SET_HERO,SET_DESTINY_HERO} function s.matfilter(c,fc,sumtype,tp) return c:IsSetCard(SET_HERO,fc,sumtype,tp) and c:IsLevelAbove(6) end function s.atkval(e,c) return Duel.GetMatchingGroupCount(Card.IsSetCard,e:GetHandler():GetControler(),LOCATION_GRAVE,0,nil,SET_HERO)*-200 end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsControler,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local rg=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if chk==0 then return aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,rg,2,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local rg=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,1,tp,HINTMSG_DESTROY) if #g==2 then Duel.HintSelection(g,true) Duel.Destroy(g,REASON_EFFECT) end end --summon during next SP function s.spcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT+REASON_BATTLE)~=0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetLabel(Duel.GetTurnCount()) e1:SetCondition(s.spcon1) e1:SetOperation(s.spop1) if Duel.IsTurnPlayer(tp) then e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN,1) else e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,1) end Duel.RegisterEffect(e1,tp) end function s.spcon1(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnCount()~=e:GetLabel() end function s.filter(c,e,tp) return c:IsSetCard(SET_DESTINY_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters While your LP are less than or equal to your opponent's, this Synchro Summoned card is unaffected by your opponent's activated effects. Once per turn: You can pay 1000 LP, then target 1 monster you control and 1 card your opponent controls; banish them. At the start of the Battle Phase: You can make this card gain ATK equal to the difference in your LP and your opponent's.
--サイコ・エンド・パニッシャー --Psychic End Punisher --Scripted by Yuno local s,id=GetID() function s.initial_effect(c) --Synchro Summon procedure c:EnableReviveLimit() Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Unaffected by the opponent's activated effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.immcon) e1:SetValue(s.immval) c:RegisterEffect(e1) --Banish 1 monster you control and 1 opponent's card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.PayLP(1000)) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --Increase ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE_START) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end --Immune function s.immcon(e) local tp=e:GetHandlerPlayer() return Duel.GetLP(tp)<=Duel.GetLP(1-tp) and e:GetHandler():IsSynchroSummoned() end function s.immval(e,te) return te:GetOwnerPlayer()~=e:GetHandlerPlayer() and te:IsActivated() end --Banish function s.rmfilter(c,e) return c:IsAbleToRemove() and c:IsCanBeEffectTarget(e) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsControler,nil,tp)==1 end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE,LOCATION_ONFIELD,nil,e) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) Duel.SetTargetCard(rg) Duel.SetOperationInfo(0,CATEGORY_REMOVE,rg,2,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end --Increase ATK function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(tp)~=Duel.GetLP(1-tp) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local atk=math.abs(Duel.GetLP(tp)-Duel.GetLP(1-tp)) --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e1:SetValue(atk) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a "Madolche" card(s) is returned from your side of the field or Graveyard to your hand or Main Deck by a card effect: Add 1 "Madolche" monster from your Deck to your hand. If you control a face-up Fairy-Type "Madolche" monster, you can Special Summon the monster from your Deck in face-up Attack Position instead of adding it to your hand. You can only use the effect of "Madolche Ticket" once per turn.
--マドルチェ・チケット --Madolche Ticket local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCode(EVENT_TO_DECK) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_TO_HAND) c:RegisterEffect(e3) end s.listed_series={SET_MADOLCHE} function s.cfilter(c,tp) return c:IsControler(tp) and c:IsPreviousControler(tp) and (c:IsPreviousLocation(LOCATION_GRAVE) or (c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP))) and c:IsSetCard(SET_MADOLCHE) and not c:IsLocation(LOCATION_EXTRA) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT)~=0 and eg:IsExists(s.cfilter,1,nil,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_DECK) end function s.mfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MADOLCHE) and c:IsRace(RACE_FAIRY) end function s.filter1(c) return c:IsSetCard(SET_MADOLCHE) and c:IsMonster() and c:IsAbleToHand() end function s.filter2(c,e,tp) return c:IsSetCard(SET_MADOLCHE) and c:IsMonster() and (c:IsAbleToHand() or c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK)) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local b=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.mfilter,tp,LOCATION_MZONE,0,1,nil) if not b then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then if not tc:IsAbleToHand() or (tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK) and Duel.SelectYesNo(tp,aux.Stringid(id,1))) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) else Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn: You can target 1 other face-up card you control; destroy it, and if you do, Set 1 "Metalfoes" Spell/Trap Card directly from your Deck. ---------------------------------------- [ Flavor Text ] Cool iron bodies meet burning metal machines and man/machine combine. Burn up the soul - Metalfoes Fusion!!
--メタルフォーゼ・スティエレン --Metalfoes Steelen local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --destroy and set local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_METALFOES} function s.desfilter(c,tp) if c:IsFacedown() then return false end local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if ft==0 and c:IsLocation(LOCATION_SZONE) and c:GetSequence()<5 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,true) else return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,false) end end function s.filter(c,ignore) return c:IsSetCard(SET_METALFOES) and c:IsSpellTrap() and c:IsSSetable(ignore) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc,tp) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler(),tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler(),tp) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,false) if #g>0 then Duel.SSet(tp,g:GetFirst()) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned (but can be Normal Set). At the start of the Damage Step, if this card attacked a face-down Defense Position monster: Destroy that monster, and if you do, you can place it on top of your opponent's Deck instead of sending it to the Graveyard.
--ミスティック・ソードマン LV6 --Mystic Swordsman LV6 local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_START) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --summon limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_LIMIT_SUMMON_PROC) e2:SetCondition(s.sumcon) c:RegisterEffect(e2) end s.LVnum=6 s.LVset=SET_MYSTIC_SWORDSMAN function s.descon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return e:GetHandler()==Duel.GetAttacker() and d and d:IsFacedown() and d:IsDefensePos() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttackTarget(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() if d:IsRelateToBattle() then if d:GetOwner()~=tp and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Destroy(d,REASON_EFFECT,LOCATION_DECK) else Duel.Destroy(d,REASON_EFFECT) end end end function s.sumcon(e,c,minc) if not c then return true end return false end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Sparkman" + "Elemental HERO Bladedge" Must be Fusion Summoned. If this card attacks a Defense Position monster, inflict piercing battle damage. You can discard 1 card, then target 1 Attack Position monster your opponent controls; destroy that target.
--E・HERO プラズマヴァイスマン --Elemental HERO Plasma Vice local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,20721928,59793705) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.fuslimit) c:RegisterEffect(e1) --pierce local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_PIERCE) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCost(s.descost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} function s.descost(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.filter(c) return c:IsAttackPos() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsAttackPos() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can inflict 600 damage to your opponent, also you cannot activate monster effects for the rest of this turn, except "Raidraptor" monsters. When this card is destroyed by battle and sent to the GY: You can Special Summon 1 "Raidraptor" monster from your Deck, but its effects are negated.
--RR-ナパーム・ドラゴニアス --Raidraptor - Napalm Dragonius local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) 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) c:RegisterEffect(e2) end s.listed_series={SET_RAIDRAPTOR} function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(600) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(s.actlimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.actlimit(e,re,rp) local rc=re:GetHandler() return re:IsMonsterEffect() and not rc:IsSetCard(SET_RAIDRAPTOR) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_RAIDRAPTOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If the turn player Summons exactly 1 monster: Destroy it, and if you do, the controller of that monster Special Summons 1 "Mask Token" (Spellcaster/DARK/Level 1/ATK ?/DEF ?) to their field, which cannot attack directly, with ATK/DEF equal to what the destroyed monster had on the field. You can only use this effect of "Ecole de Zone" once per turn. If this face-up card leaves the field, destroy all "Mask Tokens" on the field.
--エコール・ド・ゾーン --Ecole de Zone --Script by XyLeN local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Token local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.tkcon) e1:SetTarget(s.tktg) e1:SetOperation(s.tkop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Destroy "Mask Token" local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCondition(s.descon) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_names={60514626} function s.tkcon(e,tp,eg,ep,ev,re,r,rp) if #eg~=1 then return false end local tc=eg:GetFirst() return tc:IsFaceup() and tc:IsSummonPlayer(Duel.GetTurnPlayer()) end function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=eg:GetFirst() if tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) and not tc:IsImmuneToEffect(e) then local atk=tc:GetAttack() local def=tc:GetDefense() local p=tc:GetControler() if Duel.Destroy(tc,REASON_EFFECT)==0 then return end if Duel.GetLocationCount(p,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(p,id+1,0,TYPES_TOKEN,atk,def,1,RACE_SPELLCASTER,ATTRIBUTE_DARK) then local token=Duel.CreateToken(p,id+1) if Duel.SpecialSummonStep(token,0,p,p,false,false,POS_FACEUP) then --Set ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) token:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE) e2:SetValue(def) token:RegisterEffect(e2) --Cannot attack local e3=Effect.CreateEffect(c) e3:SetDescription(3207) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e3:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) token:RegisterEffect(e3) end Duel.SpecialSummonComplete() end end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCode,id+1),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,0,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 7 monsters Once per turn, you can also Xyz Summon "Poseidra Abyss, the Atlantean Dragon Lord" by using 1 "Atlantean" or "Mermail" Xyz Monster you control. (Transfer its materials to this card.) Once per turn: You can detach 2 materials from this card, then send 1 WATER monster from your hand or Deck to the GY; return up to 3 cards your opponent controls to the hand. If this Xyz Summoned card is sent to the GY: You can discard 1 card to the GY; Special Summon 3 Level 3 or lower Fish, Sea Serpent, and/or Aqua monsters from your hand and/or GY.
--海皇龍神 ポセイドラ・アビス --Poseidra Abyss, the Atlantean Dragon Lord --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 7 monsters OR 1 "Atlantean" or "Mermail" Xyz Monster you control Xyz.AddProcedure(c,nil,7,3,s.ovfilter,aux.Stringid(id,0),3,s.xyzop) --Return up to 3 cards your opponent controls to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.AND(Cost.DetachFromSelf(2),s.rthcost)) e1:SetTarget(s.rthtg) e1:SetOperation(s.rthop) c:RegisterEffect(e1) --Special Summon 3 Level 3 or lower Fish, Sea Serpent, and/or Aqua monsters from your hand and/or GY. local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ATLANTEAN,SET_MERMAIL} s.listed_names={id} function s.ovfilter(c,tp,lc) return c:IsSetCard(s.listed_series,lc,SUMMON_TYPE_XYZ,tp) and c:IsType(TYPE_XYZ,lc,SUMMON_TYPE_XYZ,tp) and c:IsFaceup() end function s.xyzop(e,tp,chk) if chk==0 then return not Duel.HasFlagEffect(tp,id) end return Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,EFFECT_FLAG_OATH,1) end function s.rthcostfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToGraveAsCost() end function s.rthcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rthcostfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.rthcostfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,1-tp,LOCATION_ONFIELD) end function s.rthop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,3,nil) if #g>0 then Duel.HintSelection(g) Duel.SendtoHand(g,nil,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsXyzSummoned() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsDiscardable,Card.IsAbleToGraveAsCost),tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,aux.AND(Card.IsDiscardable,Card.IsAbleToGraveAsCost),1,1,REASON_COST|REASON_DISCARD) end function s.spfilter(c,e,tp) return c:IsLevelBelow(3) and c:IsRace(RACE_FISH|RACE_SEASERPENT|RACE_AQUA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>=3 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,3,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<3 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,3,3,nil,e,tp) if #g==3 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Monsters on your side of the field cannot be destroyed in a battle if the monsters' ATK are equal.
--騎士道精神 --Kishido Spirit local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.indtg) e2:SetValue(s.indval) c:RegisterEffect(e2) end function s.indtg(e,c) e:SetLabel(c:GetAttack()) return true end function s.indval(e,c) return c:GetAttack()==e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only while all monsters on the field are face-up. Both players send monsters they control to the Graveyard so that they each control only 1 Attribute.
--異種闘争 --Battle of the Elements local s,id=GetID() function s.initial_effect(c) --Players send monsters to the GY until they control only 1 attribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0 and not Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_MZONE,0,1,nil) and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and not Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_MZONE,1,nil) end function s.getattr(g) local aat=0 for tc in g:Iter() do aat=(aat|tc:GetAttribute()) end return aat end function s.rmfilter(c,at) return c:GetAttribute()==at end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_MZONE,0,1,nil) or Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)==0 or Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_MZONE,1,nil) then return end local g1=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local r1=Duel.AnnounceAttribute(tp,1,s.getattr(g1)) g1:Remove(s.rmfilter,nil,r1) Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(id,0)) local r2=Duel.AnnounceAttribute(1-tp,1,s.getattr(g2)) g2:Remove(s.rmfilter,nil,r2) Duel.SendtoGrave(g1,REASON_RULE,PLAYER_NONE,tp) Duel.SendtoGrave(g2,REASON_RULE,PLAYER_NONE,1-tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when your opponent declares a direct attack and you control no monsters. Special Summon 1 Level 4 or lower Beast-Type monster from your hand, in face-up Attack Position.
--闘争本能 --Battle Instinct local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.GetAttackTarget()==nil and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g~=0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Summoned: You can add 1 "Batteryman" monster from your Deck to your hand, and if you do, this card's ATK and DEF become double its original ATK and DEF. You can only use this effect of "Batteryman 9-Volt" once per turn. During your End Phase: Destroy this card.
--電池メン-角型 --Batteryman 9-Volt local s,id=GetID() function s.initial_effect(c) --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.descon) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_series={SET_BATTERYMAN} function s.filter(c) return c:IsSetCard(SET_BATTERYMAN) 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.filter,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 c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(c:GetBaseAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE_FINAL) e2:SetValue(c:GetBaseDefense()*2) c:RegisterEffect(e2) end end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 "Infernoid" monster from your hand or Graveyard while the total Levels and Ranks of all Effect Monsters you control are 8 or lower, and cannot be Special Summoned by other ways. Once per turn: You can target 1 Set card on the field; shuffle it into the Deck. That card cannot be activated in response to this effect's activation. Once per turn, during your opponent's turn: You can Tribute 1 monster, then target 1 card in your opponent's Graveyard; banish it (this is a Quick Effect).
--インフェルノイド・シャイターン --Infernoid Pirmais local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Infernoid.RegisterSummonProcedure(c,1) --Return 1 Spell/Trap to the deck local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --Tribute 1 monster and banish local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end s.listed_series={SET_INFERNOID} function s.tdfilter(c) return c:IsFacedown() and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) local tc=g:GetFirst() Duel.SetChainLimit(function(e,lp,tp) return e:GetHandler()~=tc end) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.rmfilter(c,e) return c:IsAbleToRemove() and aux.SpElimFilter(c) and (not e or c:IsCanBeEffectTarget(e)) end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Zombie monster you control with 2000 or less ATK; it can attack directly this turn.
--威圧する魔眼 --Overpowering Eye local s,id=GetID() function s.initial_effect(c) --1 of your zombie monsters with 2000 or less ATK can attack directly local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.filter(c) return c:IsFaceup() and c:IsAttackBelow(2000) and c:IsRace(RACE_ZOMBIE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3205) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 LIGHT Machine monster that cannot be Normal Summoned/Set, or 1 "Cyber Dragon" monster, from your Deck to your hand. If the activation of this card in its owner's possession was negated by your opponent's card effect and sent to your GY: You can discard 1 card; add this card to your hand. You can only activate 1 "Cyber Emergency" per turn.
--エマージェンシー・サイバー --Cyber Emergency --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Add to your hand 1 LIGHT Machine monster that cannot be Normal Summoned/Set, or 1 "Cyber Dragon" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Add this card to hand if its activation is negated local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CHAIN_NEGATED) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.thcond) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_CYBER_DRAGON} function s.filter(c) return c:IsMonster() and c:IsAbleToHand() and (c:IsSetCard(SET_CYBER_DRAGON) or (c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and not c:IsSummonableCard())) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g1>0 then Duel.SendtoHand(g1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g1) end end function s.thcond(e,tp,eg,ep,ev,re,r,rp) local de,dp=Duel.GetChainInfo(ev,CHAININFO_DISABLE_REASON,CHAININFO_DISABLE_PLAYER) return re:GetHandler()==e:GetHandler() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp and de and dp~=tp end 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,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can choose any number of your unused Main Monster Zones, and if you do, place that number of Season Counters on this card, also those zones cannot be used while this card is on the field. Monsters you control gain 400 ATK for each Season Counter on this card. Once per turn, during your opponent's End Phase: You can take 1 Field Spell from your Deck that you can place a Season Counter on, and place it face-up on your field (but neither player can activate its effects this turn), and if you do, place all Season Counters on this card on that card.
--春 --Spring --scripted by Naim local COUNTER_SEASON=0x214 local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(COUNTER_SEASON) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Select any number of your Main Monster Zones to make them unusuable local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1) e1:SetTarget(s.countertg) e1:SetOperation(s.counterop) c:RegisterEffect(e1) --Monsters you control gain 400 ATK for each Season Counter on this card local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetValue(function(e,c) return e:GetHandler():GetCounter(COUNTER_SEASON)*400 end) c:RegisterEffect(e2) --Place 1 Field Spell from your Deck that you can place a Season Counter on face-up on your field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_COUNTER) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) e3:SetTarget(s.pltg) e3:SetOperation(s.plop) c:RegisterEffect(e3) end s.counter_place_list={COUNTER_SEASON} function s.countertg(e,tp,eg,ep,ev,re,r,rp,chk) local max_zones=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return max_zones>0 end Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,max_zones,tp,COUNTER_SEASON) end function s.counterop(e,tp,eg,ep,ev,re,r,rp) local max_zones=Duel.GetLocationCount(tp,LOCATION_MZONE) if max_zones<=0 then return end local ct=0 local selected_zones=0 repeat ct=ct+1 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISABLEZONE) local new_zone=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,selected_zones) selected_zones=selected_zones|new_zone until (ct>=max_zones or not Duel.SelectYesNo(tp,aux.Stringid(id,2))) local c=e:GetHandler() c:AddCounter(COUNTER_SEASON,ct) --Those zones cannot be used while this card is on the field local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE_FIELD) e1:SetRange(LOCATION_FZONE) e1:SetOperation(function() return selected_zones end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end function s.plfilter(c) return c:IsFieldSpell() and c:IsCanAddCounter(COUNTER_SEASON,1,false,LOCATION_ONFIELD) and not c:IsForbidden() end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,e:GetHandler():GetCounter(COUNTER_SEASON),tp,COUNTER_SEASON) end function s.plop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local sc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if not sc then return end local c=e:GetHandler() local ct=c:GetCounter(COUNTER_SEASON) local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0) if fc then Duel.SendtoGrave(fc,REASON_RULE) Duel.BreakEffect() end if Duel.MoveToField(sc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) then --Cannot activate its effects this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3302) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) sc:RegisterEffect(e1) if ct>0 then sc:AddCounter(COUNTER_SEASON,ct) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase, if this card was activated this turn: You can Special Summon 1 Level 6 or lower Insect monster from your GY. You can reveal 1 Insect monster in your hand, then target 1 face-up monster your opponent controls, and 1 Insect monster you control with less ATK than the revealed monster; switch control of those monsters, and if you do, the monster you took control of becomes an Insect monster. You can only use 1 "Giant Ballgame" effect per turn, and only once that turn.
--G・ボール・シュート --Giant Ballgame --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) e0:SetCost(s.actreg) c:RegisterEffect(e0) --Special Summon 1 Level 6 or lower Insect monster from your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Switch control of 2 targets local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_CONTROL) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.ctrltg) e2:SetOperation(s.ctrlop) c:RegisterEffect(e2) end function s.actreg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_OATH,1) end function s.spfilter(c,e,tp) return c:IsRace(RACE_INSECT) and c:IsLevelBelow(6) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.rvlfilter(c,tp) return c:IsRace(RACE_INSECT) and c:IsAttackAbove(1) and not c:IsPublic() and Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,c:GetAttack()) end function s.filter1(c,atk,e) local tp=c:GetControler() return c:GetAttack()<atk and c:IsFaceup() and c:IsRace(RACE_INSECT) and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0 and (not e or c:IsCanBeEffectTarget(e)) end function s.filter2(c,e) local tp=c:GetControler() return c:IsFaceup() and c:IsAbleToChangeControler() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_CONTROL)>0 and (not e or c:IsCanBeEffectTarget(e)) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsControler,nil,tp)==1 end function s.ctrltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingMatchingCard(s.rvlfilter,tp,LOCATION_HAND,0,1,nil,tp) and Duel.IsExistingTarget(s.filter2,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.rvlfilter,tp,LOCATION_HAND,0,1,1,nil,tp) local atk=g:GetFirst():GetAttack() Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) local g1=Duel.GetMatchingGroup(s.filter1,tp,LOCATION_MZONE,0,nil,atk,e) local g2=Duel.GetMatchingGroup(s.filter2,tp,0,LOCATION_MZONE,nil,e) local tg=aux.SelectUnselectGroup(g1+g2,e,tp,2,2,s.rescon,1,tp,HINTMSG_CONTROL) Duel.SetTargetCard(tg) e:SetLabelObject(tg:Filter(Card.IsControler,nil,1-tp):GetFirst()) Duel.SetOperationInfo(0,CATEGORY_CONTROL,tg,2,0,0) end function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g~=2 then return end local a=g:GetFirst() local b=g:GetNext() if Duel.SwapControl(a,b) then local tc=e:GetLabelObject() if tc:IsControler(tp) and not tc:IsRace(RACE_INSECT) and tc:IsFaceup() then --Monster becomes Insect local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) e1:SetValue(RACE_INSECT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent Special Summoned a monster this turn: Activate this card by targeting 1 monster in your opponent's Graveyard; Special Summon it to your side of the field in Defense Position. When this card leaves the field, banish that monster. When that monster leaves the field, destroy this card.
--横取りボーン --Monster Rebone local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_LEAVE_FIELD_P) e2:SetOperation(s.checkop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetOperation(s.remop) e3:SetLabelObject(e2) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCondition(s.descon) e4:SetOperation(s.desop) c:RegisterEffect(e4) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SPSUMMON_SUCCESS) ge1:SetOperation(s.spcheckop) Duel.RegisterEffect(ge1,0) end) end function s.spcheckop(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() local p1=false local p2=false for tc in aux.Next(eg) do if tc:GetSummonPlayer()==0 then p1=true else p2=true end end if p1 then Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end if p2 then Duel.RegisterFlagEffect(1,id,RESET_PHASE|PHASE_END,0,1) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(1-tp,id)~=0 end function s.filter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then c:SetCardTarget(tc) Duel.SpecialSummonComplete() end end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.remop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Declare a Level from 1 to 12, then target 2 face-up monsters on the field, including 1 monster you control; they become the declared Level (until the end of this turn), also, for the rest of this turn after this card resolves, you cannot Special Summon monsters from the Extra Deck, except monsters with the same Type as a targeted monster. You can only activate 1 "Xyz Align" per turn.
--エクシーズ・アライン --Xyz Align --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Change Levels of 2 targets to a declared Level local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c,e) return c:IsFaceup() and c:HasLevel() and c:IsCanBeEffectTarget(e) end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsControler,1,nil,tp) end s.nlvfilter=aux.NOT(Card.IsLevel) function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g1=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil,e) local g2=Duel.GetMatchingGroup(s.cfilter,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return #g1>0 and (#g1+#g2)>=2 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK) local lv=Duel.AnnounceNumber(tp,s.get_declarable_levels(g1,g2)) local g=(g1+g2):Match(s.nlvfilter,nil,lv) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TARGET) Duel.SetTargetCard(sg) e:SetLabel(lv) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil) if #g==0 then return end local c=e:GetHandler() local lv=e:GetLabel() for tc in g:Iter() do if not tc:IsLevel(lv) then --Change level to the declared level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end local races=g:GetBitwiseOr(Card.GetRace) --Cannot Special Summon from the Extra Deck, except monster with the same Type as the targets if e:IsHasType(EFFECT_TYPE_ACTIVATE) then local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(races) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.get_declarable_levels(g1,g2) local opts={} for lv=1,12 do local ct=g1:FilterCount(s.nlvfilter,nil,lv) if ct>1 or (ct>0 and g2:IsExists(s.nlvfilter,1,nil,lv)) then table.insert(opts,lv) end end return table.unpack(opts) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control any other Spell or Trap Cards, destroy this card. Face-down Spell and Trap Cards cannot be activated. Destroy this card during your 2nd Standby Phase after activation.
--血の沼地 --Sanguine Swamp local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_SELF_DESTROY) e2:SetCondition(s.sdescon) c:RegisterEffect(e2) --disable spsummon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e3:SetCode(EFFECT_CANNOT_TRIGGER) e3:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e3:SetTarget(s.acttg) c:RegisterEffect(e3) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() c:SetTurnCounter(0) --destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,2) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() ct=ct+1 c:SetTurnCounter(ct) if ct==2 then Duel.Destroy(c,REASON_EFFECT) end end function s.sdescon(e) return Duel.IsExistingMatchingCard(Card.IsSpellTrap,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,e:GetHandler()) end function s.acttg(e,c) return c:IsFacedown() and c:GetSequence()~=5 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Reptilianne" Tuner + 1+ non-Tuner monsters If this card is Synchro Summoned: Destroy as many monsters your opponent controls with 0 ATK as possible, and if you do, draw 1 card for each monster destroyed.
--レプティレス・ラミア --Reptilianne Hydra local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_REPTILIANNE),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.listed_series={SET_REPTILIANNE} function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.desfilter(c) return c:IsFaceup() and c:GetAttack()==0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,#g) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) local ct=Duel.Destroy(g,REASON_EFFECT) Duel.Draw(tp,ct,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either turn, except the End Phase (Quick Effect): You can discard this card; apply this effect this turn. You can only use this effect of "Ghost Sister & Spooky Dogwood" once per turn. ● Each time your opponent Special Summons an Effect Monster(s) during the Main Phase or Battle Phase, you gain LP equal to that monster's ATK. If you did not gain LP by this effect, your LP are halved during the End Phase.
--儚無みずき --Ghost Sister & Spooky Dogwood --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfDiscard) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase() < PHASE_END end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e0:SetCode(EVENT_PHASE+PHASE_END) e0:SetProperty(EFFECT_FLAG_CLIENT_HINT) e0:SetCountLimit(1,{id,1}) e0:SetCondition(s.damcon) e0:SetOperation(s.damop) e0:SetReset(RESET_PHASE|PHASE_END) e0:SetLabelObject(e0) Duel.RegisterEffect(e0,tp) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.reccon1) e1:SetOperation(s.recop1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --sp_summon effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.regcon) e2:SetOperation(s.regop) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetCondition(s.reccon2) e3:SetOperation(s.recop2) e3:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e3,tp) e2:SetLabelObject(e3) end function s.filter(c,sp) if c:IsLocation(LOCATION_MZONE) then return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsLocation(LOCATION_MZONE) and c:GetSummonPlayer()==sp else return c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousTypeOnField()&TYPE_EFFECT ~= 0 and c:IsPreviousLocation(LOCATION_MZONE) and c:GetSummonPlayer()==sp end end function s.reccon1(e,tp,eg,ep,ev,re,r,rp) local ph = Duel.GetCurrentPhase() return eg:IsExists(s.filter,1,nil,1-tp) and (not re:IsHasType(EFFECT_TYPE_ACTIONS) or re:IsHasType(EFFECT_TYPE_CONTINUOUS)) and ph >= PHASE_MAIN1 and ph <= PHASE_MAIN2 end function s.sum(c) if c:IsLocation(LOCATION_MZONE) then return c:GetAttack() else return c:GetPreviousAttackOnField() end end function s.recop1(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.filter,nil,1-tp) if #g>0 then local sum=g:GetSum(s.sum) Duel.Hint(HINT_CARD,0,id) if Duel.Recover(tp,sum,REASON_EFFECT)~=0 then Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) end end end function s.regcon(e,tp,eg,ep,ev,re,r,rp) local ph = Duel.GetCurrentPhase() return eg:IsExists(s.filter,1,nil,1-tp) and re:IsHasType(EFFECT_TYPE_ACTIONS) and not re:IsHasType(EFFECT_TYPE_CONTINUOUS) and ph >= PHASE_MAIN1 and ph <= PHASE_MAIN2 end function s.regop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.filter,nil,1-tp) Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) e:GetLabelObject():SetLabel(g:GetSum(s.sum)+e:GetLabelObject():GetLabel()) end function s.reccon2(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id)>0 end function s.recop2(e,tp,eg,ep,ev,re,r,rp) Duel.ResetFlagEffect(tp,id) local rec=e:GetLabel() e:SetLabel(0) Duel.Hint(HINT_CARD,0,id) if Duel.Recover(tp,rec,REASON_EFFECT)~=0 then Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id+1)==0 end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) local lp=Duel.GetLP(tp) Duel.SetLP(tp,lp/2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 Warrior monsters Once per turn: You can detach 2 materials from this card; this card's ATK becomes double its original ATK until the end of your opponent's turn.
--H-C エクスカリバー --Heroic Champion - Excalibur local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WARRIOR),4,2) c:EnableReviveLimit() --attack up local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(2)) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(c:GetBaseAttack()*2) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END,2) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Nefarious Archfiend Eater of Nefariousness". If you control a Spellcaster monster, you can Special Summon this card (from your hand). Once per turn, during your opponent's End Phase, if this card is in your GY: You can target 1 face-up monster you control; destroy it, and if you do, Special Summon this card.
--デーモン・イーター --Nefarious Archfiend Eater of Nefariousness local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --spsummon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.cfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.filter(c,ft) return c:IsFaceup() and (ft>0 or c:GetSequence()<5) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc,ft) end if chk==0 then return ft>-1 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,ft) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent from your field to your GY by an opponent's card: You can Special Summon up to 2 "Naturia Cherries" from your Deck in face-down Defense Position.
--ナチュル・チェリー --Naturia Cherries local s,id=GetID() function s.initial_effect(c) --Special Summon up to 2 "Naturia Cherries" from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.spfilter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetLocationCount(tp,LOCATION_MZONE) if ct==0 then return end ct=math.min(ct,2) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ct=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,ct,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can place 1 or 2 "Dinomist" Pendulum Monster(s) from your Deck in your Pendulum Zone, but you cannot Pendulum Summon monsters until the end of the next turn, except "Dinomist" monsters (even if this card leaves the field). Once per turn, if this card is already face-up in your Spell & Trap Zone: You can Tribute 1 "Dinomist" monster, then target 1 card your opponent controls; return it to the hand.
--ダイナミスト・ハウリング --Dinomists Howling local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetOperation(s.activate) c:RegisterEffect(e1) --return local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1) e2:SetRange(LOCATION_SZONE) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_DINOMIST} function s.filter(c) return c:IsType(TYPE_PENDULUM) and c:IsSetCard(SET_DINOMIST) and not c:IsForbidden() end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) local ct=0 if Duel.CheckLocation(tp,LOCATION_PZONE,0) then ct=ct+1 end if Duel.CheckLocation(tp,LOCATION_PZONE,1) then ct=ct+1 end if ct>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local sg=g:Select(tp,1,ct,nil) local sc=sg:GetFirst() for sc in sg:Iter() do Duel.MoveToField(sc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetDescription(aux.Stringid(id,2)) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) end end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsSetCard(SET_DINOMIST) and (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function s.thcfilter(c) return c:IsSetCard(SET_DINOMIST) end function s.thfilter(c,e) return c:IsAbleToHand() and (not e or c:IsCanBeEffectTarget(e)) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.thfilter,tp,0,LOCATION_ONFIELD,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.thcfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.thcfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if e:GetHandler():IsRelateToEffect(e) and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned from the Graveyard: You can target 1 monster your opponent controls or in their Graveyard; banish it, and if you do, this card gains ATK and DEF equal to the banished monster's original Level/Rank x 100. If this card destroys an opponent's monster by battle: You can target 1 Level 7 or 8 Dragon-Type monster in the Graveyard, except "Divine Dragon Lord Felgrand"; Special Summon it to your field.
--巨神竜フェルグラント --Divine Dragon Lord Felgrand local s,id=GetID() function s.initial_effect(c) --remove local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCondition(s.rmcon) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(aux.bdocon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonLocation(LOCATION_GRAVE) end function s.rmfilter(c) return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c,false,true) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() local atk=0 if tc and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then if tc:IsType(TYPE_XYZ) then atk=tc:GetRank() else atk=tc:GetLevel() end if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk*100) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end end end function s.filter(c,e,tp) return c:IsRace(RACE_DRAGON) and (c:GetLevel()==7 or c:GetLevel()==8) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can only be activated at the start of Main Phase 1. Until your next turn, you and your opponent cannot play or Set any Spell or Trap Cards.
--大寒波 --Cold Wave local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_MAIN1) and not Duel.CheckPhaseActivity() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,1) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) --cannot set local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SSET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetTarget(aux.TRUE) e2:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e3:SetDescription(aux.Stringid(id,1)) e3:SetReset(RESET_PHASE|PHASE_END,2) e3:SetTargetRange(1,1) Duel.RegisterEffect(e3,tp) end function s.aclimit(e,re,tp) return re:IsSpellTrapEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Draw 1 card.
--スケルエンジェル --Skelengel local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Dark Magician": Special Summon 1 "Dark Magician Girl" from your hand, Deck, or GY, then, you can Set 1 "Dark Magic Attack", "Dark Burning Attack", "Dark Burning Magic", or "Dark Magic Twin Burst" directly from your Deck. You can only activate 1 "Bond Between Teacher and Student" per turn.
--師弟の絆 --Bond Between Teacher and Student --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_DARK_MAGICIAN_GIRL,CARD_DARK_MAGICIAN} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_DARK_MAGICIAN),tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c,e,tp) return c:IsCode(CARD_DARK_MAGICIAN_GIRL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.setfilter(c) return c:IsCode(2314238,75190122,49702428,70168345) and c:IsSSetable() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 then local g=Duel.GetMatchingGroup(s.setfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local tc=g:Select(tp,1,1,nil) Duel.SSet(tp,tc) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card is activated: Banish 1 FIRE monster with 200 DEF from your GY; negate the activation, and if you do, destroy it.
--フレムベルカウンター --Flamvell Counter local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) 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) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:GetDefense()==200 and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only while you control a face-up "Venom" monster, "Vennominaga the Deity of Poisonous Snakes", or "Vennominon the King of Poisonous Snakes". Send 1 Reptile-Type monster from your Deck to the Graveyard and place 2 Venom Counters on 1 face-up monster your opponent controls.
--ヴェノム・ショット --Venom Shot local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DECKDES) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_VENOM} s.counter_place_list={COUNTER_VENOM} function s.cfilter(c) return c:IsFaceup() and (c:IsCode(72677437,8062132) or c:IsSetCard(SET_VENOM)) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.tgfilter(c) return c:IsRace(RACE_REPTILE) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsCanAddCounter(COUNTER_VENOM,2) end if chk==0 then return Duel.IsExistingTarget(Card.IsCanAddCounter,tp,0,LOCATION_MZONE,1,nil,COUNTER_VENOM,2) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,Card.IsCanAddCounter,tp,0,LOCATION_MZONE,1,1,nil,COUNTER_VENOM,2) Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsCanAddCounter(COUNTER_VENOM,2) and g:GetFirst():IsLocation(LOCATION_GRAVE) then local atk=tc:GetAttack() tc:AddCounter(COUNTER_VENOM,2) if atk>0 and tc:GetAttack()==0 then Duel.RaiseEvent(tc,EVENT_CUSTOM+54306223,e,0,0,0,0) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your opponent's turn, when your opponent activates a card or effect that would inflict damage, you can remove from play this card in your Graveyard to change that effect so it increases Life Points by the same amount instead.
--ダメージ・イーター --Damage Eater local s,id=GetID() function s.initial_effect(c) -- local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_GRAVE) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfBanish) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) if rp==tp or Duel.IsTurnPlayer(tp) then return false end local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE) if ex then return true end ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER) if not ex then return false end if cp~=PLAYER_ALL then return Duel.IsPlayerAffectedByEffect(cp,EFFECT_REVERSE_RECOVER) else return Duel.IsPlayerAffectedByEffect(0,EFFECT_REVERSE_RECOVER) or Duel.IsPlayerAffectedByEffect(1,EFFECT_REVERSE_RECOVER) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) --damage conversion local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_REVERSE_DAMAGE) e1:SetTargetRange(1,1) e1:SetValue(s.rev) e1:SetReset(RESET_CHAIN) e1:SetLabel(cid) Duel.RegisterEffect(e1,tp) end function s.rev(e,re,r,rp,rc) local cc=Duel.GetCurrentChain() if cc==0 or (r&REASON_EFFECT)==0 then return false end local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) return cid==e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 monster in your opponent's GY; shuffle it into the Deck, then you can send 1 Fiend monster from your Deck to the GY.
--悪魔の嘆き --Fiend Griefing local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsMonster() and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgfilter(c) return c:IsRace(RACE_FIEND) and c:IsAbleToGrave() end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=g:Select(tp,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Ki-sikil" monster and control a "Lil-la" monster: Activate 1 of these effects; ● Target 1 "Ki-sikil" monster or 1 "Lil-la" monster you control and 1 face-up monster your opponent controls; switch control of those monsters. ● Target 1 Set Spell/Trap your opponent controls; shuffle it into the Deck. You can only activate 1 "Evil★Twin Present" per turn.
--Evil★Twin プレゼント --Evil★Twin Present --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Switch control of 1 "Ki-sikil" monster or 1 "Lil-la" monster you control and 1 face-up monster your opponent controls local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_END_PHASE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.conttg) e1:SetOperation(s.contop) c:RegisterEffect(e1) --Shuffle 1 Set Spell/Trap into the Deck local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end s.listed_series={SET_KI_SIKIL,SET_LIL_LA} function s.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0):Filter(Card.IsFaceup,nil) return g:IsExists(Card.IsSetCard,1,nil,SET_KI_SIKIL) and g:IsExists(Card.IsSetCard,1,nil,SET_LIL_LA) end function s.filter1(c) return c:IsFaceup() and (c:IsSetCard(SET_KI_SIKIL) or c:IsSetCard(SET_LIL_LA)) and c:IsAbleToChangeControler() end function s.filter2(c) return c:IsFaceup() and c:IsAbleToChangeControler() end function s.conttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.filter2,tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g1=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g2=Duel.SelectTarget(tp,s.filter2,tp,0,LOCATION_MZONE,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g1,2,0,0) end function s.contop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g~=2 then return end local a=g:GetFirst() local b=g:GetNext() if a:IsRelateToEffect(e) and b:IsRelateToEffect(e) then Duel.SwapControl(a,b) end end function s.filter3(c) return c:IsFacedown() and c:IsSpellTrap() and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and s.filter3(chkc) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(s.filter3,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter3,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 2 "Lamb Tokens" (Beast/EARTH/Level 1/ATK 0/DEF 0) in Defense Position. You cannot Summon other monsters the turn you activate this card (but you can Set).
--迷える仔羊 --Stray Lambs local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={60764582} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 and Duel.GetActivityCount(tp,ACTIVITY_FLIPSUMMON)==0 and Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetLabelObject(e) e1:SetTarget(s.sumlimit) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e2:SetCode(EFFECT_CANNOT_SUMMON) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetTargetRange(1,0) Duel.RegisterEffect(e2,tp) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_FLIP_SUMMON) Duel.RegisterEffect(e3,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return e:GetLabelObject()~=se end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_BEAST,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_BEAST,ATTRIBUTE_EARTH) then for i=1,2 do local token=Duel.CreateToken(tp,id+i) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard this card; add 1 "Fiendsmith" Spell/Trap from your Deck to your hand. You can target 1 "Fiendsmith" Equip Card you control and 1 monster on the field; send them to the GY. If this card is in your GY: You can shuffle 1 other LIGHT Fiend monster from your GY into the Deck/Extra Deck; Special Summon this card. You can only use each effect of "Fiendsmith Engraver" once per turn.
--魔を刻むデモンスミス --Fiendsmith Engraver --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Add 1 "Fiendsmith" Spell/Trap from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Send 1 Equip Card you control and 1 monster on the field to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --Special Summon this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,2}) e3:SetCost(s.spcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_FIENDSMITH} function s.thfilter(c) return c:IsSetCard(SET_FIENDSMITH) and c:IsSpellTrap() 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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.tgfilter(c,tp,e) return (c:IsMonster() or (c:IsSetCard(SET_FIENDSMITH) and c:IsEquipCard() and c:IsFaceup() and c:IsControler(tp))) and c:IsAbleToGrave() and c:IsCanBeEffectTarget(e) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsEquipCard,nil)==1 end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_ONFIELD,LOCATION_MZONE,nil,tp,e) if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TOGRAVE) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,tg,2,tp,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.SendtoGrave(tg,REASON_EFFECT) end end function s.spcostfilter(c,tp) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FIEND) and c:IsAbleToDeckOrExtraAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_GRAVE,0,1,1,c) Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Junk Synchron" + 1+ non-Tuner monsters If this card is Synchro Summoned: It gains ATK equal to the total ATK of all Level 2 or lower monsters you currently control.
--ジャンク・ウォリアー --Junk Warrior local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: "Junk Synchron" + 1+ non-Tuner monsters Synchro.AddProcedure(c,s.tunerfilter,1,1,Synchro.NonTuner(nil),1,99) --Make this card gain ATK equal to the total ATK of all Level 2 or lower monsters you currently control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end s.material={CARD_JUNK_SYNCHRON} s.listed_names={CARD_JUNK_SYNCHRON} s.material_setcode=SET_SYNCHRON function s.tunerfilter(c,lc,stype,tp) return c:IsSummonCode(lc,stype,tp,CARD_JUNK_SYNCHRON) or c:IsHasEffect(20932152) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup()) then return end local atk=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsLevelBelow,2),tp,LOCATION_MZONE,0,nil):GetSum(Card.GetAttack) if atk>0 then --It gains ATK equal to the total ATK of all Level 2 or lower monsters you currently control c:UpdateAttack(atk) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the GY: You can Special Summon 1 FIRE monster with 1500 or less ATK from your Deck, in Attack Position.
--UFOタートル --UFO Turtle local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function s.filter(c,e,tp) return c:IsAttackBelow(1500) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned (except during the Damage Step): You can pay 500 LP; Fusion Summon 1 Warrior Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. During your opponent's turn, if this card is in your GY and you control a Level 5 or higher Warrior monster whose current ATK is different from its original ATK (Quick Effect): You can Special Summon this card. You can only use each effect of "Kaiki the Unity Star" once per turn.
--天融星カイキ --Kaiki the Unity Star local s,id=GetID() function s.initial_effect(c) --Fusion Summon 1 Warrior Fusion Monster from your Extra Deck, using monsters from your hand or field as material local params={aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR)} local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e1:SetCost(Cost.PayLP(500)) e1:SetTarget(Fusion.SummonEffTG(table.unpack(params))) e1:SetOperation(Fusion.SummonEffOP(table.unpack(params))) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.spconfilter(c) return c:IsLevelAbove(5) and c:IsRace(RACE_WARRIOR) and not c:IsAttack(c:GetBaseAttack()) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Shinobird's Calling". This card's name becomes "Shinobaron Peacock" while in the hand or on the field. You can Tribute this Ritual Summoned card; add 1 Spirit monster and 1 Ritual Spell from your Deck to your hand. You can only use this effect of "Shinobaron Shade Peacock" once per turn. Once per turn, during the Standby Phase of the next turn after this card was banished: Special Summon this banished card. Once per turn, during the End Phase, if this card was Special Summoned this turn: Return this card to the hand.
--霊魂鳥影-彦孔雀 --Shinobaron Shade Peacock --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Return this card to the hand during the End Phase of the turn it was Special Summoned Spirit.AddProcedure(c,EVENT_SPSUMMON_SUCCESS) --This card's name become "Shinobaron Peacock" local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_HAND) e1:SetValue(52900000) c:RegisterEffect(e1) --Search 1 Spirit monster and 1 Ritual Spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsRitualSummoned() end) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Special Summon itself after being banished local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetRange(LOCATION_REMOVED) e3:SetCountLimit(1) e3:SetCondition(function(e) return Duel.GetTurnCount()==e:GetHandler():GetTurnID()+1 end) e3:SetTarget(s.selfsptg) e3:SetOperation(s.selfspop) c:RegisterEffect(e3) end s.listed_names={73055622,52900000} --Shinobird's Calling, Shinobaron Peacock s.listed_card_types={TYPE_SPIRIT} function s.thfilter(c) return (c:IsType(TYPE_SPIRIT) or c:IsRitualSpell()) and c:IsAbleToHand() end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsRitualSpell,nil)==1 end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g<2 then return end local thg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_ATOHAND) if #thg==2 then Duel.SendtoHand(thg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,thg) end end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,tp,LOCATION_REMOVED) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 "Infernoid" monster or 1 "Void" Spell/Trap in your hand; discard your entire hand, then draw the same number of cards you discarded. If you control no monsters, or all monsters you control are Fiend monsters, except the turn this card was sent to the GY: You can banish this card from your GY, then target up to 11 of your banished "Infernoid" monsters with different names; return them to the GY. You can only use this effect of "Void Reignition" once per Duel.
--熾動する煉獄 --Void Reignition --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Discard entire hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.dccost) e1:SetTarget(s.dctg) e1:SetOperation(s.dcop) c:RegisterEffect(e1) --Return up to 11 banished "Infernoid" monsters to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_DUEL) e2:SetCondition(s.tgcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_series={SET_INFERNOID,SET_VOID} function s.dccostfilter(c) return not c:IsPublic() and ((c:IsSetCard(SET_INFERNOID) and c:IsMonster()) or (c:IsSetCard(SET_VOID) and c:IsSpellTrap())) end function s.dccost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.dccostfilter,tp,LOCATION_HAND,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.dccostfilter,tp,LOCATION_HAND,0,1,1,c) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.dctg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0)-e:GetHandler() local ct=#g if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end Duel.SetOperationInfo(0,CATEGORY_HANDES,g,ct,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) end function s.dcop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0) if #g==0 then return end local ct=Duel.SendtoGrave(g,REASON_EFFECT|REASON_DISCARD) if ct>0 and Duel.IsPlayerCanDraw(tp) then Duel.BreakEffect() Duel.Draw(tp,ct,REASON_EFFECT) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return aux.exccon(e,tp,eg,ep,ev,re,r,rp) and not Duel.IsExistingMatchingCard(aux.NOT(aux.FaceupFilter(Card.IsRace,RACE_FIEND)),tp,LOCATION_MZONE,0,1,nil) end function s.tgfilter(c,e) return c:IsFaceup() and c:IsMonster() and c:IsSetCard(SET_INFERNOID) and c:IsCanBeEffectTarget(e) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_REMOVED,0,nil,e) if chk==0 then return #g>0 end local tg=aux.SelectUnselectGroup(g,e,tp,1,11,aux.dncheck,1,tp,aux.Stringid(id,2)) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,tg,#tg,0,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT|REASON_RETURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can target 1 face-up monster on the field; that target is treated as a Tuner this turn. You can banish this card from your GY, then target 1 Fiend monster you control; that Fiend monster is treated as a Tuner this turn. You can only use this effect of "Double Resonator" once per turn.
--ダブル・リゾネーター --Double Resonator local s,id=GetID() function s.initial_effect(c) --tuner (summon) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetTarget(s.target1) e1:SetOperation(s.operation1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --tuner (banish) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,id) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.target2) e3:SetOperation(s.operation2) c:RegisterEffect(e3) end function s.filter1(c) return c:IsFaceup() and not c:IsType(TYPE_TUNER) end function s.target1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter1(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.operation1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(TYPE_TUNER) tc:RegisterEffect(e1) end end function s.filter2(c) return s.filter1(c) and c:IsRace(RACE_FIEND) end function s.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter2(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter2,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter2,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRace(RACE_FIEND) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(TYPE_TUNER) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 2 Monster Card Attributes. Your opponent then selects 1 of the 2 Attributes and destroys all face-up monsters with that Attribute on the field.
--地殻変動 --Earthshaker local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.desfilter(c,att) return c:IsFaceup() and c:IsAttribute(att) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then if #g==0 then return false end local tc=g:GetFirst() local att=0 for tc in aux.Next(g) do att=(att|tc:GetAttribute()) end return (att&att-1)~=0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #sg==0 then return false end local tc=sg:GetFirst() local att=0 for tc in aux.Next(sg) do att=(att|tc:GetAttribute()) end if (att&att-1)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) local att1=Duel.AnnounceAttribute(tp,2,att) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATTRIBUTE) local att2=Duel.AnnounceAttribute(1-tp,1,att1) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,att2) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control 2 or more "Crystal Beast" cards in your Spell & Trap Zone: Your opponent chooses 1 "Crystal Beast" card in your Spell & Trap Zone, you send it to the GY, and if you do, you draw 2 cards.
--レア・ヴァリュー --Rare Value local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_CRYSTAL_BEAST} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_CRYSTAL_BEAST) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_SZONE,0,2,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_SZONE,0,nil) if #g>0 then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=g:Select(1-tp,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT) if sg:GetFirst():IsLocation(LOCATION_GRAVE) then Duel.Draw(tp,2,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Must be equipped to an EARTH Machine monster, by banishing 2 Level 10 or higher Machine monsters from your GY. The equipped monster's ATK becomes double its original ATK, also if it attacks a Defense Position monster, inflict piercing battle damage to your opponent. Other monsters you control cannot attack.
--機関連結 --Train Connection local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,s.filter,s.eqlimit,s.cost) --Atk Change local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(s.value) c:RegisterEffect(e1) --Pierce local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_PIERCE) c:RegisterEffect(e2) --cannot attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ATTACK) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(s.ftarget) c:RegisterEffect(e3) end function s.eqlimit(e,c) return e:GetHandler():GetEquipTarget()==c and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) end function s.rmfilter(c) return c:IsRace(RACE_MACHINE) and c:IsLevelAbove(10) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.rescon(sg,e,tp,mg) return Duel.IsExistingTarget(s.filter,0,LOCATION_MZONE,LOCATION_MZONE,1,sg) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.value(e,c) return c:GetBaseAttack()*2 end function s.ftarget(e,c) return e:GetHandler():GetEquipTarget()~=c end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a monster effect that targets a monster(s) you control, while you control a "Rikka" monster (Quick Effect): You can Tribute this card from your hand or face-up field; negate that effect. If this card is in your GY: You can Tribute 1 Plant monster; Special Summon this card in Defense Position, but banish it when it leaves the field. You can only use each effect of "Hellebore the Rikka Fairy" once per turn.
--六花精ヘレボラス --Hellebore the Rikka Fairy --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Negate opponent's activated monster effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE|LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.discon) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --Special summon itself from GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_RIKKA} function s.cfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if not (rp==1-tp and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET)) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.cfilter,1,nil,tp) and Duel.IsChainDisablable(ev) and re:IsMonsterEffect() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_RIKKA),tp,LOCATION_MZONE,0,1,nil) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not re:GetHandler():IsStatus(STATUS_DISABLED) end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end function s.cfilter2(c,tp) return c:IsRikkaReleasable(tp) and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter2,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter2,1,1,false,nil,nil,tp) Duel.Release(g,tp,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal up to 1 each of DARK, EARTH, and FIRE monsters in your hand; apply the following effect(s) in sequence, based on the number revealed. ● 1+: Inflict 400 damage to your opponent, then you can Special Summon 1 "Vanquish Soul" monster from your hand. ● 2+: Inflict 600 damage to your opponent, also this turn, "Vanquish Soul" monsters you control cannot be destroyed by card effects. ● 3: Inflict 800 damage to your opponent, then you can destroy all monsters on the field. You can only activate 1 "Vanquish Soul Snow Devil" per turn.
--VS 裏螺旋流雪風 --Vanquish Soul Snow Devil --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Reveal up to 3 monsters and apply effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE+CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_VANQUISH_SOUL} function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_DARK|ATTRIBUTE_EARTH|ATTRIBUTE_FIRE) and not c:IsPublic() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(-100) local rvg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil) if chk==0 then return #rvg>0 end local g=aux.SelectUnselectGroup(rvg,e,tp,1,3,aux.dpcheck(Card.GetAttribute),1,tp,HINTMSG_CONFIRM) e:SetLabel(#g) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local res=e:GetLabel()~=0 e:SetLabel(0) return res end local ct=e:GetLabel() local dam=400 if ct>=1 then Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end if ct>=2 then dam=dam+600 end if ct==3 then dam=dam+800 local dg=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_VANQUISH_SOUL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ct=e:GetLabel() local break_eff=false if ct>=1 and Duel.Damage(1-tp,400,REASON_EFFECT)>0 then break_eff=true if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end if ct>=2 then if break_eff then Duel.BreakEffect() end Duel.Damage(1-tp,600,REASON_EFFECT) local c=e:GetHandler() --"Vanquish Soul" monsters cannot be destroyed by effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c:IsSetCard(SET_VANQUISH_SOUL) end) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,2)) break_eff=true end if ct==3 then if break_eff then Duel.BreakEffect() end if Duel.Damage(1-tp,800,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then local dg=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.BreakEffect() Duel.Destroy(dg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "Springans" Xyz Monsters on the field gain 1000 ATK. You can only use each of the following effects of "Great Sand Sea - Gold Golgonda" once per turn. If you control no "Springans" Xyz Monsters: You can discard 1 "Springans" card; Special Summon 1 "Springans" Xyz Monster from your Extra Deck. If a face-up Xyz Monster you control leaves the field by card effect (except during the Damage Step): You can target 1 monster your opponent controls; it cannot attack for the rest of this turn (even if this card leaves the field).
--大砂海ゴールド・ゴルゴンダ --Great Sand Sea - Gold Golgonda --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --All "Sprigguns" Xyz monsters gain 1000 ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.attg) e2:SetValue(1000) c:RegisterEffect(e2) --Special summon 1 "Sprigguns" Xyz monster from extra deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCountLimit(1,id) e3:SetRange(LOCATION_FZONE) e3:SetCondition(s.spcon) e3:SetCost(s.spcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --Make 1 of opponent's monsters unable to attack local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetRange(LOCATION_FZONE) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.cacon) e4:SetTarget(s.catg) e4:SetOperation(s.caop) c:RegisterEffect(e4) end s.listed_series={SET_SPRINGANS} function s.attg(e,c) return c:IsSetCard(SET_SPRINGANS) and c:IsType(TYPE_XYZ) end function s.isfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SPRINGANS) and c:IsType(TYPE_XYZ) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.isfilter,tp,LOCATION_MZONE,0,1,nil) end function s.cfilter(c) return c:IsSetCard(SET_SPRINGANS) and c:IsDiscardable() 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,0,1,nil) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c,e,tp) return c:IsSetCard(SET_SPRINGANS) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.atrfilter(c,tp,rp) return c:IsPreviousPosition(POS_FACEUP) and c:IsType(TYPE_XYZ) and c:GetPreviousControler()==tp and c:IsReason(REASON_EFFECT) end function s.cacon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.atrfilter,1,nil,tp,rp) end function s.catg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.caop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then --Cannot attack this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While there are no Spells in your GY, neither player can conduct their Battle Phase.
--異次元の境界線 --D.D. Borderline local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --cannot bp local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BP) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.bpcon) c:RegisterEffect(e2) end function s.bpcon(e) return not Duel.IsExistingMatchingCard(Card.IsSpell,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be used to Ritual Summon any "Dogmatika" Ritual Monster from your hand or GY. You must also Tribute monsters from your hand or field, and/or banish Fusion or Synchro Monsters from your GY, whose total Levels equal or exceed the Level of the Ritual Monster you Ritual Summon, then, if both "White Knight of Dogmatika" and "White Relic of Dogmatika" are on the field, you can look at either your Extra Deck or your opponent's, and send 1 monster from it to the GY. You can only activate 1 "Dogmatikamacabre" per turn.
--凶導の葬列 --Dogmatikamacabre --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Ritual Summon local e1=Ritual.AddProcGreater({ handler=c, filter=aux.FilterBoolFunction(Card.IsSetCard,SET_DOGMATIKA), location=LOCATION_HAND|LOCATION_GRAVE, extrafil=s.extramat, extratg=s.extratg, stage2=s.stage2 }) e1:SetCategory(e1:GetCategory()+CATEGORY_TOGRAVE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) end s.listed_names={40352445,48654323} s.listed_series={SET_DOGMATIKA} function s.matfilter(c) return c:HasLevel() and c:IsType(TYPE_FUSION|TYPE_SYNCHRO) and c:IsAbleToRemove() end function s.extramat(e,tp,eg,ep,ev,re,r,rp,chk) return Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and Group.NewGroup() or Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_GRAVE,0,nil) end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_GRAVE) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,PLAYER_EITHER,LOCATION_EXTRA) end function s.onfield(code) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,code),0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end function s.stage2(mat,e,tp,eg,ep,ev,re,r,rp,tc) if not (s.onfield(40352445) and s.onfield(48654323)) then return end local g1=Duel.GetFieldGroup(tp,LOCATION_EXTRA,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_EXTRA) if (#g1<1 and #g2<1) or not Duel.SelectYesNo(tp,aux.Stringid(id,0)) then return end local op=Duel.SelectEffect(tp, {#g1>0,aux.Stringid(id,1)}, {#g2>0,aux.Stringid(id,2)}) local g=(op==1) and g1 or g2 if op==2 then Duel.ConfirmCards(tp,g) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tg=g:FilterSelect(tp,aux.AND(Card.IsMonster,Card.IsAbleToGrave),1,1,nil) if #tg>0 then Duel.BreakEffect() Duel.SendtoGrave(tg,REASON_EFFECT) if op==2 then Duel.ShuffleExtra(1-tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when a Defense Position monster you control, whose DEF is higher than its ATK, is destroyed by battle. Special Summon up to 2 monsters with the same name as that monster from your Deck in face-up Defense Position.
--ブロークン・ブロッカー --Broken Blocker local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_BATTLED) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local t=Duel.GetAttackTarget() if a and a:IsDefensePos() and a:GetDefense()>a:GetAttack() and a:IsStatus(STATUS_BATTLE_DESTROYED) then a:RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE,0,1) end if t and t:IsDefensePos() and t:GetDefense()>t:GetAttack() and t:IsStatus(STATUS_BATTLE_DESTROYED) then t:RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE,0,1) end end function s.filter(c,e,tp) if c:GetFlagEffect(id)~=0 and c:IsPreviousControler(tp) then e:SetLabel(c:GetCode()) return true else return false end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil,e,tp) end function s.spfilter(c,e,tp,code) return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,e:GetLabel()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if ft>2 then ft=2 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,ft,nil,e,tp,e:GetLabel()) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no Effect Monsters: You can Special Summon this card from your hand. When your opponent activates a card or effect that targets a face-up non-Effect Monster(s) you control (Quick Effect): You can banish this card from your hand or GY; negate the activation, and if you do, destroy that card. You can only use each effect of "Tenyi Spirit - Mapura" once per turn.
--天威龍-アーダラ --Tenyi Spirit - Mapura --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_HAND|LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.negcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.negfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsNonEffectMonster() and c:IsControler(tp) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) if not (rp==1-tp and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET)) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.negfilter,1,nil,tp) and Duel.IsChainNegatable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters: Target 1 "Number" Xyz Monster in your GY; Special Summon it, then draw 1 card. You can banish this card from your GY, then target 1 "Number" Xyz Monster you control; attach 1 card from your hand to it as material. You can only use each effect of "Glorious Numbers" once per turn.
--グローリアス・ナンバーズ --Glorious Numbers --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.mattg) e2:SetOperation(s.matop) c:RegisterEffect(e2) end s.listed_series={SET_NUMBER} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.filter(c,e,tp) return c:IsSetCard(SET_NUMBER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function s.matfilter(c) return c:IsFaceup() and c:IsSetCard(SET_NUMBER) and c:IsType(TYPE_XYZ) end function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.matfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.matfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.matfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.matop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.Overlay(tc,g) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The first time this card would be destroyed by battle each turn, it is not destroyed. You can only use each of the following effects of "Artmage Graflare" once per turn. If you control an "Artmage" card: You can Special Summon this card from your hand, then you can Set 1 "Artmage" Spell from your Deck. You can target 1 Spell/Trap your opponent controls; destroy it. This is a Quick Effect if you have 3 or more different Monster Types on your field.
--神芸学徒 グラフレア --Artmage Graflare --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --The first time this card would be destroyed by battle each turn, it is not destroyed local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetValue(function(e,re,r) return (r&REASON_BATTLE)==REASON_BATTLE end) c:RegisterEffect(e1) --Special Summon this card from your hand, then you can Set 1 "Artmage" Spell from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_ARTMAGE),tp,LOCATION_ONFIELD,0,1,nil) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Destroy 1 Spell/Trap your opponent controls local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(aux.NOT(s.quickdescon)) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) --This is a Quick Effect if you control 3 or more Monster Types local e3a=e3:Clone() e3a:SetType(EFFECT_TYPE_QUICK_O) e3a:SetCode(EVENT_FREE_CHAIN) e3a:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e3a:SetCondition(s.quickdescon) c:RegisterEffect(e3a) end s.listed_series={SET_ARTMAGE} function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.setfilter(c) return c:IsSetCard(SET_ARTMAGE) and c:IsSpell() and c:IsSSetable() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end local g=Duel.GetMatchingGroup(s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SSet(tp,sg) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.quickdescon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil):GetBinClassCount(Card.GetRace)>=3 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent's monster battles an "Alien" monster you control, the opponent's monster loses 300 ATK and DEF during damage calculation only.
--異界空間-Aゾーン --Otherworld - The "A" Zone local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.adcon) e2:SetTarget(s.adtg) e2:SetValue(-300) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) end s.listed_series={SET_ALIEN} function s.adcon(e) if Duel.GetCurrentPhase()~=PHASE_DAMAGE_CAL then return false end local d=Duel.GetAttackTarget() if not d then return false end local tp=e:GetHandlerPlayer() if d:IsControler(1-tp) then d=Duel.GetAttacker() end return d:IsSetCard(SET_ALIEN) end function s.adtg(e,c) return c==Duel.GetAttacker() or c==Duel.GetAttackTarget() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) with 2500 original ATK or DEF is Normal or Special Summoned to your field (except during the Damage Step): You can Special Summon this card from your hand in Defense Position. If this card is Special Summoned: You can target 1 "Dark Magician" or "Blue-Eyes White Dragon" in your Monster Zone; it gains 2500 ATK/DEF until the end of this turn. You can only use each effect of "Chronicle Magician" once per turn.
--クロニクル・マジシャン --Chronicle Magician --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,{id,1}) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Increase ATK/DEF local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_names={CARD_DARK_MAGICIAN,CARD_BLUEEYES_W_DRAGON} function s.spcfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and (c:GetBaseAttack()==2500 or c:GetBaseDefense()==2500) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spcfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.atkfilter(c) return c:IsCode(CARD_DARK_MAGICIAN,CARD_BLUEEYES_W_DRAGON) and c:IsFaceup() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Increase ATK/DEF local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(2500) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, if this card was Normal or Special Summoned this turn: You can target 1 face-up Attack Position monster on the field; change it to face-up Defense Position. During your Main Phase 2, if this card attacked this turn: You can target 1 "Raidraptor" monster in your Graveyard; Special Summon it. You can only use this effect of "Raidraptor - Sharp Lanius" once per turn.
--RR-インペイル・レイニアス --Raidraptor - Sharp Lanius local s,id=GetID() function s.initial_effect(c) --pos local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.poscon) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SUMMON_SUCCESS) ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) ge1:SetLabel(id) ge1:SetOperation(aux.sumreg) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_SPSUMMON_SUCCESS) ge2:SetLabel(id) Duel.RegisterEffect(ge2,0) end) end s.listed_series={SET_RAIDRAPTOR} function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.filter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition() end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEUP_DEFENSE) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackedCount()>0 and Duel.IsPhase(PHASE_MAIN2) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_RAIDRAPTOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, in either player's turn: You can discard this card; you take no Battle Damage from that battle. When this card is Summoned: Toss a coin and apply this effect. The effect lasts while this card is face-up on the field. ● Heads: Halve all Battle Damage you take. ● Tails: Halve all Battle Damage your opponent takes.
--アルカナフォースⅩⅣ-TEMPERANCE --Arcana Force XIV - Temperance local s,id=GetID() function s.initial_effect(c) --Discard to prevent battle damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCondition(s.damcon) e1:SetCost(Cost.SelfDiscard) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Toss a coin and apply the appropriate effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_COIN) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.cointg) e2:SetOperation(s.coinop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) local e4=e2:Clone() e4:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e4) end s.toss_coin=true function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetBattleDamage(tp)>0 end function s.damop(e,tp,eg,ep,ev,re,r,rp) --Prevent Battle Damage local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) Duel.RegisterEffect(e1,tp) end function s.cointg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function s.coinop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end s.arcanareg(c,Arcana.TossCoin(c,tp)) end function s.arcanareg(c,coin) --Heads: Halve all Battle Damage you take local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,0) e1:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e1:SetCondition(s.rdcon1) e1:SetValue(HALF_DAMAGE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Tails: Halve all Battle Damage your opponent take local e2=e1:Clone() e2:SetTargetRange(0,1) e2:SetCondition(s.rdcon2) c:RegisterEffect(e2) Arcana.RegisterCoinResult(c,coin) end function s.rdcon1(e,tp,eg,ep,ev,re,r,rp) return Arcana.GetCoinResult(e:GetHandler())==COIN_HEADS end function s.rdcon2(e,tp,eg,ep,ev,re,r,rp) return Arcana.GetCoinResult(e:GetHandler())==COIN_TAILS end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is added from the Deck or Graveyard to your hand, except by drawing it: You can add 1 EARTH Machine-Type monster with 500 ATK and/or DEF from your Deck to your hand, except "Ancient Gear Box". You can only use this effect of "Ancient Gear Box" once per turn.
--古代の機械箱 --Ancient Gear Box local s,id=GetID() function s.initial_effect(c) --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsReason(REASON_DRAW) and e:GetHandler():IsPreviousLocation(LOCATION_DECK|LOCATION_GRAVE) end function s.filter(c) return (c:GetAttack()==500 or c:GetDefense()==500) and c:GetCode()~=id and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Winged Beast monster: You can Special Summon both this card and 1 Level 1 Winged Beast monster from your hand. You can only use this effect of "Lyrilusc - Sapphire Swallow" once per turn. A WIND Xyz Monster that was Summoned using this card on the field as material gains this effect. ● If it is Xyz Summoned: You can target 1 "Lyrilusc" monster in your GY; attach it to this card as material.
--LL-サファイア・スワロー --Lyrilusc - Sapphire Swallow local s,id=GetID() function s.initial_effect(c) --Special Summon itself and a Level 1 Winged Beast monster from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Provide an effect to a WIND Xyz monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BE_MATERIAL) e2:SetProperty(EFFECT_FLAG_EVENT_PLAYER) e2:SetCondition(s.efcon) e2:SetOperation(s.efop) c:RegisterEffect(e2) end s.listed_series={SET_LYRILUSC} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_WINGEDBEAST),tp,LOCATION_MZONE,0,1,nil) end function s.spfilter(c,e,tp) return c:IsRace(RACE_WINGEDBEAST) and c:GetLevel()==1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,c,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,c,e,tp) if #g>0 then g:AddCard(c) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.efcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return r==REASON_XYZ and c:GetReasonCard():IsAttribute(ATTRIBUTE_WIND) end function s.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.xyzcon) e1:SetTarget(s.xyztg) e1:SetOperation(s.xyzop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e2,true) end end function s.xyzcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsXyzSummoned() end function s.xyzfilter(c) return c:IsSetCard(SET_LYRILUSC) and c:IsMonster() end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.xyzfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACH) local g=Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then Duel.Overlay(c,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you activate this card: You can take 1 Level 4 or lower "Myutant" monster from your Deck, and either add it to your hand or Special Summon it. If a Level 8 or higher "Myutant" monster(s) you control would be destroyed by card effect, you can banish this card you control instead. You can only activate 1 "Myutant Expansion" per turn.
--ミュートリア超個体系 --Myutant Expansion --Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Banish this card you control instead of a Level 8 or higher "Myutant" monster(s) you control being destroyed by a card effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_SZONE) e2:SetTarget(s.reptg) e2:SetOperation(function(e) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT|REASON_REPLACE) end) e2:SetValue(function(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end) c:RegisterEffect(e2) end s.listed_series={SET_MYUTANT} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.thspfilter(c,e,tp,ft) return c:IsSetCard(SET_MYUTANT) and c:IsLevelBelow(4) and (c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetMatchingGroup(s.thspfilter,tp,LOCATION_DECK,0,nil,e,tp,ft) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local sc=g:Select(tp,1,1,nil):GetFirst() if not sc then return end aux.ToHandOrElse(sc,tp, function(sc) return ft>0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, function(sc) return Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,3) ) end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_MYUTANT) and c:IsLocation(LOCATION_MZONE) and c:IsLevelAbove(8) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and not c:IsStatus(STATUS_DESTROY_CONFIRMED) and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,96) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your opponent's turn (Quick Effect): You can banish this card from the GY; excavate the top card of your Deck, and if it is a Normal Trap, Set it to your field. Otherwise, send it to the GY. That Set card can be activated during this turn. If this card is sent to the GY: You can look at 3 cards from the top of your Deck, then place them on the top of the Deck in any order. You can only use each effect of "Absolute King Back Jack" once per turn.
--絶対王 バック・ジャック --Absolute King Back Jack local s,id=GetID() function s.initial_effect(c) --Excavate the top card of your Deck and set it if it is a Normal Trap local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_GRAVE) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Excavate the top 3 cards of your Deck local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sdtg) e2:SetOperation(s.sdop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.CanPlayerSetSpellTrap(tp) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) or not Duel.CanPlayerSetSpellTrap(tp) then return end Duel.ConfirmDecktop(tp,1) local tc=Duel.GetDecktopGroup(tp,1):GetFirst() Duel.DisableShuffleCheck() if tc:IsNormalTrap() and tc:IsSSetable() then Duel.SSet(tp,tc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetDescription(aux.Stringid(id,0)) tc:RegisterEffect(e1) else Duel.SendtoGrave(tc,REASON_EFFECT|REASON_EXCAVATE) end end function s.sdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>2 end end function s.sdop(e,tp,eg,ep,ev,re,r,rp) Duel.SortDecktop(tp,tp,3) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner monsters Once per turn, when you take damage: You can send up to 5 cards from the top of your Deck to the Graveyard, then if any monsters were sent to the Graveyard by this effect, this card gains 400 ATK.
--玄翼竜 ブラック・フェザー --Blackfeather Darkrage Dragon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Send up to 5 cards from the top of your Deck to the GY, then if any monsters were sent to the GY by this effect, this card gains 400 ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DAMAGE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==tp end) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1) end function s.monfilter(c) return c:IsMonster() and c:IsLocation(LOCATION_GRAVE) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end local c=e:GetHandler() local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0) if ct>5 then ct=5 end local ac=ct==1 and 1 or Duel.AnnounceNumberRange(tp,1,ct) if Duel.DiscardDeck(tp,ac,REASON_EFFECT)==0 then return end local og=Duel.GetOperatedGroup() if og:IsExists(s.monfilter,1,nil) and c:IsFaceup() and c:IsRelateToEffect(e) then Duel.BreakEffect() --This card gains 400 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(400) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 monsters Cannot attack directly. Once per turn: You can detach 1 material from this card; add 1 "ZW -" monster from your Deck to your hand. You can target 1 "Utopia" monster you control; equip this monster on the field to that target. It gains 3000 ATK. During your Battle Phase, if the equipped monster attacked this turn: You can send this Equip Card to the GY; the equipped monster can make a second attack on an opponent's monster during this Battle Phase.
--ZW-獣王獅子武装 --ZW - Leo Arms local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz summon procedure Xyz.AddProcedure(c,nil,5,2) --Cannot attack directly local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) c:RegisterEffect(e1) --Add 1 "ZW -" monster from deck local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --Equip this card on the field to 1 "Utopia" monster local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_EQUIP) e3:SetRange(LOCATION_MZONE) e3:SetTarget(s.eqtg) e3:SetOperation(s.eqop) c:RegisterEffect(e3) aux.AddZWEquipLimit(c,nil,function(tc,c,tp) return s.filter(tc) and tc:IsControler(tp) end,s.equipop,e3) --Send this equip card to GY, the monster it was equipped to can make a second attack on monsters local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_SZONE) e4:SetCondition(s.atcon) e4:SetCost(s.atcost) e4:SetTarget(s.attg) e4:SetOperation(s.atop) c:RegisterEffect(e4) end s.listed_series={SET_ZW,SET_UTOPIA} function s.thfilter(c) return c:IsSetCard(SET_ZW) and c:IsMonster() and c:IsAbleToHand() end function s.target(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.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_UTOPIA) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or tc:IsFacedown() or tc:GetControler()~=tp then Duel.SendtoGrave(c,REASON_EFFECT) return end s.equipop(c,e,tp,tc) end function s.equipop(c,e,tp,tc) if not aux.EquipAndLimitRegister(c,e,tp,tc) then return end --atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(3000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end function s.atcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and Duel.IsBattlePhase() and Duel.GetCurrentChain()==0 end function s.atcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end e:SetLabelObject(e:GetHandler():GetEquipTarget()) Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.attg(e,tp,eg,ep,ev,re,r,rp,chk) local eqc=e:GetHandler():GetEquipTarget() if chk==0 then return eqc and eqc:GetAttackedCount()==1 and eqc:GetEffectCount(EFFECT_EXTRA_ATTACK)==0 end Duel.SetTargetCard(e:GetLabelObject()) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Can make a second attack on monsters local e1=Effect.CreateEffect(c) e1:SetDescription(3202) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned while you control no other monsters: You can Special Summon 1 "Machina" monster from your hand, except "Machina Soldier".
--マシンナーズ・ソルジャー --Machina Soldier local s,id=GetID() function s.initial_effect(c) --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.sumcon) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) end s.listed_series={SET_MACHINA} function s.sumcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==1 end function s.filter(c,e,tp) return c:IsSetCard(SET_MACHINA) and c:GetCode()~=id and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Wind-Up" monster in your Graveyard; Special Summon it in face-up Defense Position. Its effect(s) is negated, and it cannot be Tributed or used as a Synchro Material Monster.
--巻きすぎた発条 --Zenmailfunction local s,id=GetID() function s.initial_effect(c) --Special summon 1 "Wind-Up" monster from GY local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_WIND_UP} function s.filter(c,e,tp) return c:IsSetCard(SET_WIND_UP) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2,true) --Cannot be tributed local e3=Effect.CreateEffect(c) e3:SetDescription(3303) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_UNRELEASABLE_SUM) e3:SetValue(1) e3:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e3,true) local e4=e3:Clone() e4:SetCode(EFFECT_UNRELEASABLE_NONSUM) tc:RegisterEffect(e4,true) --Cannot be used as synchro material local e5=Effect.CreateEffect(c) e5:SetDescription(3310) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e5:SetValue(1) e5:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e5,true) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as a "Gem-Knight" card.) You can discard 1 "Gem-Knight" or "Melodious" card; Special Summon this card from your hand. You can only use this effect of "Brilliant Rose" once per turn. Once per turn: You can send 1 "Gem-Knight" or "Melodious" monster from your Extra Deck to the GY; until the End Phase, this card's name/Type/Attribute become the same as the original name/Type/Attribute of the monster sent to the GY to activate this effect.
--ブリリアント・ローズ --Brilliant Rose --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Copy name, type, and attribute local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.cpcost) e2:SetOperation(s.cpop) c:RegisterEffect(e2) end s.listed_series={SET_GEM_KNIGHT,SET_MELODIOUS} function s.spcostfilter(c) return (c:IsSetCard(SET_GEM_KNIGHT) or c:IsSetCard(SET_MELODIOUS)) and c:IsDiscardable() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,c) end Duel.DiscardHand(tp,s.spcostfilter,1,1,REASON_COST|REASON_DISCARD,c) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function s.cpcostfilter(c) return (c:IsSetCard(SET_GEM_KNIGHT) or c:IsSetCard(SET_MELODIOUS)) and c:IsAbleToGraveAsCost() end function s.cpcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cpcostfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cpcostfilter,tp,LOCATION_EXTRA,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) e:SetLabelObject(g:GetFirst()) end function s.cpop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=e:GetLabelObject() if not (tc and c:IsRelateToEffect(e) and c:IsFaceup()) then return end --Change properties local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(tc:GetOriginalCode()) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_ATTRIBUTE) e2:SetValue(tc:GetOriginalAttribute()) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_CHANGE_RACE) e3:SetValue(tc:GetOriginalRace()) c:RegisterEffect(e3) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be used as material for a Fusion, Synchro, or Xyz Summon. You can only control 1 "Red Duston". While this card is face-up on the field, it cannot be Tributed. If this card on the field is destroyed: Its controller takes 500 damage. * The above text is unofficial and describes the card's functionality in the OCG.
--レッド・ダストン --Red Duston local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --cannot release local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UNRELEASABLE_NONSUM) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_CANNOT_BE_MATERIAL) e3:SetValue(aux.cannotmatfilter(SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ)) c:RegisterEffect(e3) --damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(s.dmcon) e4:SetTarget(s.dmtg) e4:SetOperation(s.dmop) c:RegisterEffect(e4) end function s.dmcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.dmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() Duel.SetTargetPlayer(c:GetPreviousControler()) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,c:GetPreviousControler(),500) end function s.dmop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Gunkan Suship Shari", you can Special Summon this card (from your hand). You can only Special Summon "Gunkan Suship Ikura" once per turn this way. During your Main Phase: You can excavate the top 3 cards from your Deck, and if you do, you can either add to your hand or Special Summon 1 excavated "Gunkan Suship Shari", also shuffle the rest into your Deck. You can only use this effect of "Gunkan Suship Ikura" once per turn.
--いくらの軍貫 --Gunkan Suship Ikura --Coded by V.J.Wilson local s,id=GetID() function s.initial_effect(c) --Special Summon procedure (from hand) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Excavate and either Special Summon or add to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.exctg) e2:SetOperation(s.excop) c:RegisterEffect(e2) end s.listed_names={CARD_SUSHIP_SHARI} function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_SUSHIP_SHARI),c:GetControler(),LOCATION_ONFIELD,0,1,nil) end function s.exctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>2 end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.excfilter(c,e,tp) return c:IsCode(CARD_SUSHIP_SHARI) and (c:IsAbleToHand() or c:IsCanBeSpecialSummoned(e,0,tp,false,false)) end function s.excop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return end Duel.ConfirmDecktop(tp,3) local g=Duel.GetDecktopGroup(tp,3):Filter(s.excfilter,nil,e,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) local tc=sg:GetFirst() aux.ToHandOrElse(tc,tp,function(c) return tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end, function(c) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,3)) else Duel.ShuffleDeck(tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time you Synchro Summon a Synchro Monster: Inflict 500 damage to your opponent.
--コモンメンタルワールド --Synch Realm local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst():IsSynchroSummoned() and eg:GetFirst():IsControler(tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,500) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only activate this card if 7 or more of your cards are currently removed from play. Destroy all Monster Cards on the field.
--カオス・エンド --Chaos End local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_REMOVED,0)>=7 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent can only activate 1 Spell/Trap Card each turn.
--ナチュル・ローズウィップ --Naturia Rosewhip local s,id=GetID() function s.initial_effect(c) --activate limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.aclimit1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_CHAIN_NEGATED) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.aclimit2) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,1) e3:SetCondition(s.econ) e3:SetValue(s.elimit) c:RegisterEffect(e3) end function s.aclimit1(e,tp,eg,ep,ev,re,r,rp) if ep==tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return end e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_CONTROL|RESET_PHASE|PHASE_END,0,1) end function s.aclimit2(e,tp,eg,ep,ev,re,r,rp) if ep==tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return end e:GetHandler():ResetFlagEffect(id) end function s.econ(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.elimit(e,te,tp) return te:IsHasType(EFFECT_TYPE_ACTIVATE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your opponent's Main Phase, if you control a "Genex" monster (Quick Effect): You can Special Summon this card from your hand, then, immediately after this effect resolves, you can Synchro Summon 1 "Genex" Synchro Monster. You can only use this effect of "R-Genex Turing" once per turn. This card on the field can be treated as a Level 1 or 3 monster when used for a Synchro Summon of a "Genex" Synchro Monster.
--レアル・ジェネクス・チューリング --R-Genex Turing --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Can be treated as a Level 1 or 3 monster for the Synchro Summon of a "Genex" Synchro monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.synop) c:RegisterEffect(e2) end s.listed_series={SET_GENEX} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_GENEX),tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.scfilter(c) return c:IsSetCard(SET_GENEX) and c:IsSynchroSummonable() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end local g=Duel.GetMatchingGroup(s.scfilter,tp,LOCATION_EXTRA,0,nil) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=g:Select(tp,1,1,nil):GetFirst() if sc then Duel.BreakEffect() Duel.SynchroSummon(tp,sc,nil) end end function s.synop(e,tg,ntg,sg,lv,sc,tp) local c=e:GetHandler() local sum=(sg-c):GetSum(Card.GetSynchroLevel,sc) if sum+c:GetSynchroLevel(sc)==lv then return true,true end return sc:IsSetCard(SET_GENEX) and ((sum+1==lv) or (sum+3==lv)),true end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when there are 3 or more cards in your opponent's Spell & Trap Card Zone. Destroy 1 card in your opponent's Spell & Trap Card Zone.
--トルネード --Tornado local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:GetSequence()<5 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,0,LOCATION_SZONE,3,nil) end function s.filter(c) return c:GetSequence()<5 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_SZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 Fusion Monster in your Extra Deck, and Special Summon 1 of the Fusion Materials whose name is mentioned on that monster from your Extra Deck or GY, but until the end of your opponent's turn, it cannot attack and its effects (if any) are negated. You can only activate 1 "Fusion Armament" per turn.
--融合強兵 --Fusion Armament --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon listed Fusion material local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.exfilter(c,e,tp,filter_func) return c.material and c:IsType(TYPE_FUSION) and not c:IsPublic() and Duel.IsExistingMatchingCard(filter_func,tp,LOCATION_EXTRA|LOCATION_GRAVE,0,1,nil,e,tp,c) end function s.spfilter(c,e,tp,fc) if not (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsCode(table.unpack(fc.material))) then return false end if c:IsLocation(LOCATION_GRAVE) then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 elseif c:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local filter_func=s.spfilter if chk==0 then return Duel.IsExistingMatchingCard(s.exfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,filter_func) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local filter_func=aux.NecroValleyFilter(s.spfilter) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.exfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,filter_func):GetFirst() if not rc then return end Duel.ConfirmCards(1-tp,rc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA|LOCATION_GRAVE,0,1,1,rc,e,tp,rc):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then local c=e:GetHandler() local ct=Duel.IsTurnPlayer(tp) and 2 or 1 --Cannot attack local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END,ct) sc:RegisterEffect(e1) --Its effects are negated local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESETS_STANDARD_PHASE_END,ct) sc:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetValue(RESET_TURN_SET) sc:RegisterEffect(e3) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned, except with the effect of a "Myutant" card. Your opponent cannot target this card with Spell effects. You can only use each of the following effects of "Myutant Mist" once per turn. When your opponent activates a Trap Card or effect (Quick Effect): You can banish 1 card from your hand or field; draw 2 cards. If this card in its owner's possession is destroyed by an opponent's card: You can target 1 of your banished "Myutant" monsters; add it to your hand.
--ミュートリアル・ミスト --Myutant Mist --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Must special summoned by a "Myutant" effect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --Cannot be targeted by opponent's spell effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.tgval) c:RegisterEffect(e2) --Draw 2 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DRAW) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCountLimit(1,{id,1}) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.drcon) e3:SetCost(s.drcost) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) --Add 1 of your banished "Myutant" monsters local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_DESTROYED) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e4:SetCountLimit(1,{id,2}) e4:SetCondition(s.thcon) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end s.listed_series={SET_MYUTANT} --Must special summoned by a "Myutant" effect function s.splimit(e,se,sp,st) return se:GetHandler():IsSetCard(SET_MYUTANT) end --Cannot be targeted by opponent's trap effects function s.tgval(e,re,rp) return aux.tgoval(e,re,rp) and re:IsSpellEffect() end --Opponent activates a trap effect function s.drcon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsTrapEffect() end --Banish 1 card from your hand or field as cost function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end --Activation legality function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end --Draw 2 function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end --If destroyed by opponent's card function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT) and c:GetPreviousControler()==tp) end --Check for 1 of your face-up banished "Myutant" monsters function s.thfilter(c) return c:IsSetCard(SET_MYUTANT) and c:IsMonster() and c:IsFaceup() and c:IsAbleToHand() end --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,LOCATION_REMOVED) end --Add 1 of your banished "Myutant" monsters to hand function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can add 1 "Ghost Fusion" from your Deck to your hand. During the End Phase, if this card is currently banished, and was banished this turn: You can take 1 Level 2 or lower Zombie Tuner from your Deck, and either add it to your hand or send it to the GY. You can only use each effect of "Ghost Wyvern, the Underworld Dragon" once per turn.
--劫火の翼竜 ゴースト・ワイバーン --Ghost Wyvern, the Underworld Dragon local s,id=GetID() function s.initial_effect(c) --Search 1 "Ghost Fusion" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,{id,1}) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Register the fact it was banished this turn local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_REMOVE) e3:SetOperation(s.regop) c:RegisterEffect(e3) --Search or send to the GY 1 Level 2 or lower Zombie Tuner local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TOGRAVE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_REMOVED) e4:SetCountLimit(1,{id,2}) e4:SetCondition(s.thgcon) e4:SetTarget(s.thgtg) e4:SetOperation(s.thgop) c:RegisterEffect(e4) end s.listed_names={35705817} function s.thfilter(c) return c:IsCode(35705817) 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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() then return end c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.thgcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.thgfilter(c) return c:IsLevelBelow(2) and c:IsRace(RACE_ZOMBIE) and c:IsType(TYPE_TUNER) and (c:IsAbleToHand() or c:IsAbleToGrave()) end function s.thgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thgfilter,tp,LOCATION_DECK,0,1,nil) end end function s.thgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local tc=Duel.SelectMatchingCard(tp,s.thgfilter,tp,LOCATION_DECK,0,1,1,nil) aux.ToHandOrElse(tc,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by shuffling 1 "Ryzeal" monster from your hand or GY into the Deck/Extra Deck. You cannot Special Summon from the Extra Deck, except Rank 4 Xyz Monsters. Once per turn, during damage calculation, if this card battles an opponent's monster: You can send 1 Level 4 monster from your hand or Deck to the GY, and if you do, this card gains ATK equal to that monster's ATK, until the end of the Battle Phase.
--パルマ・ライゼオル --Palm Ryzeal --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon this card (from your hand) local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_HAND) e0:SetCondition(s.spcon) e0:SetTarget(s.sptg) e0:SetOperation(s.spop) c:RegisterEffect(e0) --You cannot Special Summon from the Extra Deck, except Rank 4 Xyz Monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not (c:IsType(TYPE_XYZ) and c:IsRank(4)) end) c:RegisterEffect(e1) aux.addContinuousLizardCheck(c,LOCATION_MZONE,function(e,c) return not (c:IsOriginalType(TYPE_XYZ) and c:IsOriginalRank(4)) end) --Send 1 Level 4 monster from your hand/Deck to the GY and this card gains ATK equal to that monster's, until the end of the Battle Phase local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.atkcon) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_RYZEAL} function s.spconfilter(c) return c:IsSetCard(SET_RYZEAL) and c:IsMonster() and c:IsAbleToDeckOrExtraAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,c) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.spconfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,c) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,nil,1,tp,HINTMSG_TODECK,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end if g:IsExists(Card.IsLocation,1,nil,LOCATION_HAND) then Duel.ConfirmCards(1-tp,g) else Duel.HintSelection(g) end Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) g:DeleteGroup() end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() return bc and bc:IsControler(1-tp) end function s.tgfilter(c) return c:IsLevel(4) and c:IsAbleToGrave() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,0) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil):GetFirst() if sc and Duel.SendtoGrave(sc,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_GRAVE) and sc:GetAttack()>0 and c:IsRelateToEffect(e) and c:IsFaceup() then --Gains ATK equal to the ATK of the monster sent to the GY until the end of the Battle Phase local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(sc:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_BATTLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The equipped monster gains 400 ATK. If the equipped monster attacks a Defense Position monster, inflict piercing battle damage to your opponent. When this card leaves the field, banish the equipped monster.
--ビッグバン・シュート --Big Bang Shot local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Atk down local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(400) c:RegisterEffect(e2) --Pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) --Remove local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_LEAVE_FIELD) e5:SetOperation(s.rmop) c:RegisterEffect(e5) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=e:GetHandler():GetEquipTarget() if tc then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks a Defense Position monster your opponent controls, before damage calculation: You can destroy that monster.
--H・C 夜襲のカンテラ --Heroic Challenger - Night Watchman local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_CONFIRM) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local d=Duel.GetAttackTarget() if chk==0 then return Duel.GetAttacker()==e:GetHandler() and d and d:IsDefensePos() and d:IsRelateToBattle() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,d,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() if d~=nil and d:IsRelateToBattle() and d:IsDefensePos() then Duel.Destroy(d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can place 1 counter on this card. You can send this card with 2 or more counters to the Graveyard; Special Summon 1 EARTH monster from your Deck. If this card would be destroyed by battle or card effect, you can remove 1 counter from this card instead.
--BOXサー --BOXer local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x34) --Add counter local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(aux.bdogcon) e1:SetOperation(s.ctop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --destroy replace local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetTarget(s.reptg) e3:SetOperation(s.repop) c:RegisterEffect(e3) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then c:AddCounter(0x34,1) end end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() and e:GetHandler():GetCounter(0x34)>1 end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.filter(c,e,tp) return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsCanRemoveCounter(tp,0x34,1,REASON_EFFECT) end return Duel.SelectEffectYesNo(tp,c,96) end function s.repop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RemoveCounter(tp,0x34,1,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The first time each "Magistus" monster equipped with an Equip Card would be destroyed by battle each turn, it is not destroyed. You can only use 1 of the following effects of "Trismagistus" per turn, and only once that turn. ● During your Main Phase: You can Special Summon 1 Level 4 Spellcaster monster from your hand. ● You can send this face-up card to the GY; Special Summon any number of "Magistus" monsters with different names from your hand.
--三賢者の書 --Trismagistus --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Prevent the destruction by battle once local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetValue(s.indvalue) e2:SetTarget(s.indfilter) c:RegisterEffect(e2) --Special Summon 1 Level 4 Spellcaster from hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCountLimit(1,id) e3:SetRange(LOCATION_SZONE) e3:SetTarget(s.sptg1) e3:SetOperation(s.spop1) c:RegisterEffect(e3) --Special Summon any number of "Magistus" from hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetCountLimit(1,id) e4:SetRange(LOCATION_SZONE) e4:SetCost(Cost.SelfToGrave) e4:SetTarget(s.sptg2) e4:SetOperation(s.spop2) c:RegisterEffect(e4) end s.listed_series={SET_MAGISTUS} function s.indvalue(e,re,r,rp) return r&REASON_BATTLE==REASON_BATTLE end function s.indfilter(e,c) return c:IsSetCard(SET_MAGISTUS) and c:GetEquipCount()>0 end function s.spfilter1(c,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsLevel(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.spfilter2(c,e,tp) return c:IsSetCard(SET_MAGISTUS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if ft>5 then ft=5 end local sg=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_HAND,0,nil,e,tp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=aux.SelectUnselectGroup(sg,e,tp,1,ft,aux.dncheck,1,tp,HINTMSG_SPSUMMON) if #g>0 then local ct=Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your GY: You can Tribute 2 monsters; Special Summon this card. If a monster(s) is Special Summoned from your opponent's GY (except during the Damage Step): You can send 1 card they control to the GY. If a monster(s) is sent from your opponent's hand or Deck to the GY (except during the Damage Step): You can Special Summon 1 LIGHT or DARK Reptile monster from your GY, except "Amunessia, the Ogdoadic Queen". You can only use each effect of "Amunessia, the Ogdoadic Queen" once per turn.
--溟界妃-アミュネシア --Amunessia, the Ogdoadic Queen --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Special Summon itself from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Send 1 card the opponent controls to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.tgcon) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --Special Summon 1 LIGHT or DARK Reptile monster from GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,2,false,aux.ReleaseCheckMMZ,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,2,2,false,aux.ReleaseCheckMMZ,nil) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.filter(c,tp) return c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,e:GetHandler(),1-tp) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,tp,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,0,LOCATION_ONFIELD,nil) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=g:Select(tp,1,1,nil) Duel.HintSelection(sg,true) Duel.SendtoGrave(sg,REASON_EFFECT) end end function s.lhdfilter(c,tp) return c:IsMonster() and (c:IsPreviousLocation(LOCATION_HAND) or c:IsPreviousLocation(LOCATION_DECK)) and c:IsPreviousControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.lhdfilter,1,nil,1-tp) end function s.spfilter(c,e,tp) return c:IsRace(RACE_REPTILE) and (c:IsAttribute(ATTRIBUTE_LIGHT) or c:IsAttribute(ATTRIBUTE_DARK)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Beast or Beast-Warrior monster; it gains ATK equal to its current DEF (until the End Phase), and if it does, it is destroyed during the End Phase.
--野性解放 --Wild Nature's Release local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:HasNonZeroDefense() and c:IsRace(RACE_BEAST|RACE_BEASTWARRIOR) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(tc:GetDefense()) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetCountLimit(1) e2:SetOperation(s.desop) tc:RegisterEffect(e2) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Cyberse monster you control would be used as Link Material for an "@Ignister" monster, this card in your hand can also be used as material. If this card is sent to the GY as Link Material: You can discard 1 card, then target 1 Spell/Trap on the field, or you can target 2 if this card on the field was used as material; destroy that card(s). You can only use each effect of "Linkslayer @Ignister" once per turn.
--リンクスレイヤー@イグニスター --Linkslayer @Ignister local s,id=GetID() function s.initial_effect(c) --If a Cyberse monster you control would be used as Link Material for an "@Ignister" Link Monster, this card in your hand can also be used as material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_EXTRA_MATERIAL) e1:SetRange(LOCATION_HAND) e1:SetTargetRange(1,0) e1:SetOperation(s.extracon) e1:SetValue(s.extraval) c:RegisterEffect(e1) if s.flagmap==nil then s.flagmap={} end if s.flagmap[c]==nil then s.flagmap[c] = {} end --Destroy 1 Spell/Trap on the field, or 2 if this card on the field was used as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetCost(Cost.Discard()) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_IGNISTER} function s.extrafilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) end function s.extracon(c,e,tp,sg,mg,lc,og,chk) return (sg+mg):Filter(s.extrafilter,nil,e:GetHandlerPlayer()):IsExists(Card.IsRace,1,og,RACE_CYBERSE) and sg:FilterCount(Card.HasFlagEffect,nil,id)<2 end function s.extraval(chk,summon_type,e,...) local c=e:GetHandler() if chk==0 then local tp,sc=... if summon_type~=SUMMON_TYPE_LINK or not sc:IsSetCard(SET_IGNISTER) or Duel.HasFlagEffect(tp,id) then return Group.CreateGroup() else table.insert(s.flagmap[c],c:RegisterFlagEffect(id,0,0,1)) return Group.FromCards(c) end elseif chk==1 then local sg,sc,tp=... if summon_type&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK and #sg>0 then Duel.Hint(HINT_CARD,tp,id) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end elseif chk==2 then for _,eff in ipairs(s.flagmap[c]) do eff:Reset() end s.flagmap[c]={} end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() e:SetLabel(c:IsPreviousLocation(LOCATION_ONFIELD) and 1 or 0) return c:IsLocation(LOCATION_GRAVE) and r==REASON_LINK end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1+e:GetLabel(),nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card declares an attack: You can add 1 "Edge Imp Chain" from your Deck to your hand. If this card is sent from the hand or field to the Graveyard: You can add 1 "Frightfur" card from your Deck to your hand. You can only use 1 "Edge Imp Chain" effect per turn, and only once that turn.
--エッジインプ・チェーン --Edge Imp Chain local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_FRIGHTFUR} s.listed_names={id} function s.filter(c) return c:IsCode(id) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.GetFirstMatchingCard(s.filter,tp,LOCATION_DECK,0,nil) if tc then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND|LOCATION_ONFIELD) end function s.thfilter(c) return c:IsSetCard(SET_FRIGHTFUR) 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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Summoned, toss a coin: ● Heads: All "Arcana Force" monsters you control gain 500 ATK. ● Tails: All "Arcana Force" monsters you control lose 500 ATK.
--アルカナフォースⅣ-THE EMPEROR --Arcana Force IV - The Emperor local s,id=GetID() function s.initial_effect(c) --Toss a coin and apply the appropriate effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COIN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.cointg) e1:SetOperation(s.coinop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_ARCANA_FORCE} s.toss_coin=true function s.cointg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function s.coinop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end s.arcanareg(c,Arcana.TossCoin(c,tp)) end function s.arcanareg(c,coin) --coin effect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_ARCANA_FORCE)) e1:SetValue(s.atkval) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) -- Arcana.RegisterCoinResult(c,coin) end function s.atkval(e,c) local coin=Arcana.GetCoinResult(e:GetHandler()) if coin==COIN_HEADS then return 500 elseif coin==COIN_TAILS then return -500 else return 0 end end