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:
Destroy all face-up Fish-Type monsters on the field.
--永遠の渇水 --Eternal Drought 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsRace(RACE_FISH) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(sg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 2 "Artifact" monsters you control; immediately after this effect resolves, Xyz Summon 1 Xyz Monster using those 2 monsters only, also for the rest of this turn after this card resolves, monsters you control cannot attack, except "Artifact" monsters. If this card in your possession is destroyed by your opponent: You can reveal 1 Level 5 LIGHT monster from your hand; draw 1 card. * The above text is unofficial and describes the card's functionality in the OCG.
--アーティファクトの解放 --Artifacts Unleashed local s,id=GetID() function s.initial_effect(c) --Special Summon an Xyz Summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) 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) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.drcon) e2:SetCost(s.drcost) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end s.listed_series={SET_ARTIFACT} function s.filter(c,e) return c:IsFaceup() and c:IsSetCard(SET_ARTIFACT) and c:IsCanBeEffectTarget(e) end function s.xyzfilter(c,mg,tp) return c:IsXyzSummonable(nil,mg,2,2) end function s.rescon(exg) return function(sg) return #sg==2 and exg:IsExists(Card.IsXyzSummonable,1,nil,nil,sg,2,2) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local mg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil,e) local exg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,mg) if chk==0 then return #exg>0 end local sg=aux.SelectUnselectGroup(mg,e,tp,2,2,s.rescon(exg),1,tp,HINTMSG_XMATERIAL) Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if e:IsHasType(EFFECT_TYPE_ACTIVATE) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.attg) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end local g=Duel.GetTargetCards(e):Match(Card.IsFaceup,nil) if #g<2 then return end local xyzg=Duel.GetMatchingGroup(s.xyzfilter,tp,LOCATION_EXTRA,0,nil,g,tp) if #xyzg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyz=xyzg:Select(tp,1,1,nil):GetFirst() Duel.XyzSummon(tp,xyz,g,nil,2,2) end end function s.attg(e,c) return not c:IsSetCard(SET_ARTIFACT) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.cffilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(5) and not c:IsPublic() end function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cffilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.cffilter,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand: You can Tribute 1 Dragon-Type monster and 1 other Fiend-Type monster from your hand and/or your side of the field; Special Summon this card. Once per turn: You can discard 1 card; this card gains 500 ATK, then you can destroy 1 Spell/Trap Card on the field. This ATK increase lasts until the end of this turn.
--DDD覇龍王ペンドラゴン --D/D/D Dragon King Pendragon 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_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atk up/destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.cost) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.spcheck(sg,tp) return aux.ReleaseCheckMMZ(sg,tp) and sg:IsExists(s.chk,1,nil,sg) end function s.chk(c,sg) return c:IsRace(RACE_DRAGON) and sg:IsExists(Card.IsRace,1,c,RACE_FIEND) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsRace,2,true,s.spcheck,e:GetHandler(),RACE_DRAGON|RACE_FIEND) end local sg=Duel.SelectReleaseGroupCost(tp,Card.IsRace,2,2,true,s.spcheck,e:GetHandler(),RACE_DRAGON|RACE_FIEND) Duel.Release(sg,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.cost(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,e) return c:IsSpellTrap() and c:IsDestructable(e) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=g:Select(tp,1,1,nil) Duel.HintSelection(dg) Duel.Destroy(dg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Lyrilusc" monster: Negate the effects of all face-up monsters your opponent currently controls, until the end of this turn. You can only activate 1 "Lyrilusc - Bird Strike" per turn.
--LL-バード・ストライク --Lyrilusc - Bird Strike --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Negate all of opponent's current monsters local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp)return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_LYRILUSC),tp,LOCATION_MZONE,0,1,nil)end) e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk)if chk==0 then return Duel.IsExistingMatchingCard(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil)end end) e1:SetOperation(s.activate) c:RegisterEffect(e1) end --Lists "Lyrilusc" archetype s.listed_series={SET_LYRILUSC} --Negate all of opponent's current monsters function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,nil) for tc in aux.Next(g) do local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 4 monsters While this card has Xyz Material, your opponent cannot activate cards or effects when you Normal or Special Summon a monster(s). Once per turn: You can detach 1 Xyz Material from this card, then target 1 card on the field; destroy it. If this card is sent from the field to the Graveyard: You can Special Summon 1 "tellarknight" monster from your hand or Deck.
--星輝士 デルタテロス --Stellarknight Delteros local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,4,3) c:EnableReviveLimit() --act limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.limcon) e1:SetOperation(s.limop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_CHAIN_END) e3:SetOperation(s.limop2) c:RegisterEffect(e3) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetCost(Cost.DetachFromSelf(1)) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_TELLARKNIGHT} function s.limcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayCount()>0 and eg:IsExists(Card.IsSummonPlayer,1,nil,tp) end function s.limop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetCurrentChain()==0 then Duel.SetChainLimitTillChainEnd(s.chainlm) elseif Duel.GetCurrentChain()==1 then e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end end function s.limop2(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():GetOverlayCount()>0 and e:GetHandler():GetFlagEffect(id)~=0 then Duel.SetChainLimitTillChainEnd(s.chainlm) end e:GetHandler():ResetFlagEffect(id) end function s.chainlm(e,rp,tp) return tp==rp end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,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:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_TELLARKNIGHT) 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_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|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_HAND|LOCATION_DECK,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:
Activate by Tributing 1 face-up "Chrysalis" monster. This turn, any damage to a player caused by an effect becomes 0. Special Summon 1 "Neo-Spacian" monster written on the "Chrysalis" monster you Tributed from your hand, Deck or from either player's Graveyard.
--コクーン・ヴェール --Cocoon Veil local s,id=GetID() function s.initial_effect(c) --Activate 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_CHRYSALIS} function s.cfilter(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_CHRYSALIS) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,LOCATION_GRAVE,1,nil,c,e,tp) end function s.spfilter(c,tc,e,tp) return tc:ListsCode(c:GetCode()) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==0 then return false end e:SetLabel(0) return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckMMZ,nil,e,tp) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckMMZ,nil,e,tp) Duel.Release(rg,REASON_COST) Duel.SetTargetCard(rg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(s.damval) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_NO_EFFECT_DAMAGE) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,tc,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.damval(e,re,val,r,rp,rc) if r&REASON_EFFECT~=0 then return 0 else return val end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot activate Quick-Play Spell Cards.
--暗黒の侵略者 --Invader of Darkness local s,id=GetID() function s.initial_effect(c) --act limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,1) e1:SetValue(s.aclimit) c:RegisterEffect(e1) end function s.aclimit(e,re,tp) return re:GetHandler():IsQuickPlaySpell() and re:IsHasType(EFFECT_TYPE_ACTIVATE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Ritual Beast Ulti" monster + 1 "Ritual Beast Tamer" monster + 1 "Spiritual Beast" monster Must be Special Summoned (from your Extra Deck) by banishing the above cards you control. (You do not use "Polymerization".) If Summoned this way, this card gains this effect. ● When a Spell/Trap Card, or another monster's effect, is activated: You can banish 1 "Ritual Beast" card from your hand; negate the activation, and if you do, destroy it. * The above text is unofficial and describes the card's functionality in the OCG.
--聖霊獣騎 ガイアペライオ --Ritual Beast Ulti-Gaiapelio local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_RITUAL_BEAST_ULTI),aux.FilterBoolFunctionEx(Card.IsSetCard,SET_RITUAL_BEAST_TAMER),aux.FilterBoolFunctionEx(Card.IsSetCard,SET_SPIRITUAL_BEAST)) Fusion.AddContactProc(c,s.contactfil,s.contactop,true,aux.TRUE,1) --negate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.listed_series={SET_RITUAL_BEAST,SET_RITUAL_BEAST_ULTI,SET_RITUAL_BEAST_TAMER,SET_SPIRITUAL_BEAST} s.material_setcode={SET_RITUAL_BEAST,SET_RITUAL_BEAST_TAMER,SET_SPIRITUAL_BEAST,SET_RITUAL_BEAST_ULTI} function s.contactfil(tp) return Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil) end function s.contactop(g) Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_MATERIAL) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.discon) e1:SetCost(s.discost) e1:SetTarget(s.distg) e1:SetOperation(s.disop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e:GetHandler():RegisterEffect(e1) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return re~=e and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) end function s.filter(c) return c:IsSetCard(SET_RITUAL_BEAST) and c:IsAbleToRemoveAsCost() end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.distg(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():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(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 other monsters: You can Tribute this card; take 2 different monsters from your Deck among "Queen's Knight", "King's Knight", and/or "Jack's Knight", and either add to your hand or Special Summon each monster. You can only use this effect of "Imperial Bower" once per turn.
--インペリアル・バウアー --Imperial Bower --Scripted by fiftyfour local s,id=GetID() function s.initial_effect(c) --Special summon 2 face card monsters from deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcond) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={CARD_JACK_KNIGHT,CARD_KING_KNIGHT,CARD_QUEEN_KNIGHT} function s.spcond(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)<=1 end function s.spfilter(c,e,tp,ft) return c:IsCode(CARD_JACK_KNIGHT,CARD_KING_KNIGHT,CARD_QUEEN_KNIGHT) and ((c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and ft>0) or c:IsAbleToHand()) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp,ft) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp,ft) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SPSUMMON) if #sg==2 then local tc=sg:Select(tp,1,1,nil):GetFirst() aux.ToHandOrElse(tc,tp,function(c) return tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0 end, function(c) Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,1)) tc=(sg-tc):Select(tp,1,1,nil):GetFirst() aux.ToHandOrElse(tc,tp,function(c) return tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0 end, function(c) Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,1)) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: Both players lose 1000 LP, and if they do, each draws 1 card. All cards that are drawn while this card's effect is applied must remain revealed. While a player's Spell Card in their hand is revealed by this effect, that player cannot Normal Summon/Set monsters. You can only activate 1 "Contract with Don Thousand" per turn.
--ドン・サウザンドの契約 --Contract with Don Thousand local s,id=GetID() function s.initial_effect(c) --When this card is activated: Both players lose 1000 LP, and if they do, each draws 1 card local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) 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) local g=Group.CreateGroup() --All cards that are drawn while this card's effect is applied must remain revealed local e2a=Effect.CreateEffect(c) e2a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2a:SetCode(EVENT_DRAW) e2a:SetRange(LOCATION_SZONE) e2a:SetCondition(s.drop) e2a:SetLabelObject(g) c:RegisterEffect(e2a) local e2b=Effect.CreateEffect(c) e2b:SetType(EFFECT_TYPE_FIELD) e2b:SetCode(EFFECT_PUBLIC) e2b:SetRange(LOCATION_SZONE) e2b:SetTargetRange(LOCATION_HAND,LOCATION_HAND) e2b:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end) e2b:SetTarget(function(e,c) return g:IsContains(c) and c:HasFlagEffect(id+1) end) c:RegisterEffect(e2b) --While a player's Spell Card in their hand is revealed by this effect, that player cannot Normal Summon/Set monsters local e3a=Effect.CreateEffect(c) e3a:SetType(EFFECT_TYPE_FIELD) e3a:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3a:SetCode(EFFECT_CANNOT_SUMMON) e3a:SetRange(LOCATION_SZONE) e3a:SetTargetRange(1,0) e3a:SetCondition(function(e) return Duel.IsExistingMatchingCard(s.cannotsumfilter,e:GetHandlerPlayer(),LOCATION_HAND,0,1,nil,g) end) c:RegisterEffect(e3a) local e3b=e3a:Clone() e3b:SetCode(EFFECT_CANNOT_MSET) c:RegisterEffect(e3b) local e3c=e3a:Clone() e3c:SetTargetRange(0,1) e3c:SetCondition(function(e) return Duel.IsExistingMatchingCard(s.cannotsumfilter,e:GetHandlerPlayer(),0,LOCATION_HAND,1,nil,g) end) c:RegisterEffect(e3c) local e3d=e3c:Clone() e3d:SetCode(EFFECT_CANNOT_MSET) c:RegisterEffect(e3d) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(tp,Duel.GetLP(tp)-1000) Duel.SetLP(1-tp,Duel.GetLP(1-tp)-1000) Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(1-tp,1,REASON_EFFECT) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local pg=e:GetLabelObject() if not c:HasFlagEffect(id) then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE,0,1) pg:Clear() end for dc in eg:Iter() do pg:AddCard(dc) dc:RegisterFlagEffect(id+1,RESET_EVENT|RESETS_STANDARD,0,1) end end function s.cannotsumfilter(c,pg) return c:IsPublic() and c:IsSpell() and pg:IsContains(c) and c:HasFlagEffect(id+1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn, if you control a "Performapal", "Magician", or "Odd-Eyes" card in your other Pendulum Zone, except "Performapal Parrotrio": You can make this card's Pendulum Scale become 7 until the end of this turn. ---------------------------------------- [ Monster Effect ] When this card is destroyed by battle: You can Special Summon 1 "Performapal" monster from your Deck, except a Pendulum Monster.
--EMインコーラス --Performapal Parrotrio local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --scale change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCondition(s.sccon) e1:SetTarget(s.sctg) e1:SetOperation(s.scop) 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:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_MAGICIAN,SET_ODD_EYES,SET_PERFORMAPAL} s.listed_names={id} function s.scfilter(c) return (c:IsSetCard(SET_MAGICIAN) or c:IsSetCard(SET_ODD_EYES) or c:IsSetCard(SET_PERFORMAPAL)) and not c:IsCode(id) end function s.sccon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_PZONE,0,1,e:GetHandler()) end function s.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLeftScale()~=7 end end function s.scop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:GetLeftScale()==7 then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LSCALE) e1:SetValue(7) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_RSCALE) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_PERFORMAPAL) and not c:IsType(TYPE_PENDULUM) 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) 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:
[ Pendulum Effect ] Once per turn, when an opponent's monster declares an attack: You can add 1 "Odd-Eyes" Pendulum Monster from your GY to the Extra Deck face-up, and if you do, negate the attack, then you can gain LP equal to that Pendulum Monster's ATK. ---------------------------------------- [ Monster Effect ] If this card is in your hand or GY: You can target 1 "Performapal" or "Odd-Eyes" Monster Card you control, except "Performapal Odd-Eyes Butler"; Special Summon this card, then destroy that card. You can only use this effect of "Performapal Odd-Eyes Butler" once per turn. If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone.
--EMオッドアイズ・バトラー --Performapal Odd-Eyes Butler --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Pendulum Summon Pendulum.AddProcedure(c) --Negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOEXTRA+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCondition(s.texcon) e1:SetTarget(s.textg) e1:SetOperation(s.texop) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND|LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Place itself in your Pendulum Zone local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.pencon) e3:SetTarget(s.pentg) e3:SetOperation(s.penop) c:RegisterEffect(e3) end s.listed_series={SET_ODD_EYES,SET_PERFORMAPAL} s.listed_names={id} function s.texcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.cfilter(c) return c:IsType(TYPE_PENDULUM) and c:IsSetCard(SET_ODD_EYES) and not c:IsForbidden() end function s.textg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) end function s.texop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil):GetFirst() if tc and Duel.SendtoExtraP(tc,tp,REASON_EFFECT)>0 and Duel.NegateAttack() and tc:GetAttack()>0 and Duel.SelectYesNo(tp,aux.Stringid(id,4)) then Duel.BreakEffect() Duel.Recover(tp,tc:GetAttack(),REASON_EFFECT) end end function s.spcfilter(c) return c:IsFaceup() and c:IsOriginalType(TYPE_MONSTER) and (c:IsSetCard(SET_ODD_EYES) or c:IsSetCard(SET_PERFORMAPAL)) and not c:IsCode(id) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.spcfilter(chkc) end local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spcfilter,tp,LOCATION_ONFIELD,0,1,nil) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.spcfilter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) 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() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and tc:IsRelateToEffect(e) and s.spcfilter(tc) then Duel.BreakEffect() Duel.Destroy(tc,REASON_EFFECT) end end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 Level 4 or lower Normal Monster from your hand in Defense Position.
--魔装戦士 テライガー --Terratiger, the Empowered Warrior local s,id=GetID() function s.initial_effect(c) --spsummon 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:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_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.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) 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_HAND,0,1,1,nil,e,tp) 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:
You can pay 500 LP; reveal 3 "Purrely" cards from your Deck, except "My Friend Purrely", and your opponent randomly picks 1 for you to add to your hand, also shuffle the rest into your Deck. If your opponent causes a face-up "Purrely" Xyz Monster(s) you control to leave the field, even during the Damage Step: You can add up to 3 "Purrely" Quick-Play Spells with different names from your GY to your hand. You can only use each effect of "My Friend Purrely" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--ピュアリィ・マイフレンド --My Friend Purrely --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) --Reveal 3 "Purrely" cards and add 1 to the hand 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_SZONE) e2:SetCountLimit(1,id) e2:SetCost(Cost.PayLP(500)) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Add up to 3 "Purrely" Quick-Play Spells to the hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.rthcond) e3:SetTarget(s.rthtg) e3:SetOperation(s.rthop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_PURRELY} function s.thfilter(c) return c:IsSetCard(SET_PURRELY) and c:IsAbleToHand() and not c:IsCode(id) 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,3,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 g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil,SET_PURRELY) if #g>=3 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,3,3,nil) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleDeck(tp) local tg=sg:RandomSelect(1-tp,1) Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ShuffleDeck(tp) end end function s.xyzfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsType(TYPE_XYZ) and c:IsPreviousSetCard(SET_PURRELY) and c:IsPreviousControler(tp) and c:GetReasonPlayer()==1-tp end function s.rthcond(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.xyzfilter,1,nil,tp) end function s.qpfilter(c) return c:IsSetCard(SET_PURRELY) and c:IsSpell() and c:IsType(TYPE_QUICKPLAY) and c:IsAbleToHand() end function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.qpfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.rthop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.GetMatchingGroup(s.qpfilter,tp,LOCATION_GRAVE,0,nil) local sg=aux.SelectUnselectGroup(g,e,tp,1,3,aux.dncheck,1,tp,HINTMSG_ATOHAND) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once while face-up on the field: You can discard 1 card and declare 1 Attribute; monsters with that declared Attribute cannot target this card for attacks.
--氷結界の風水師 --Geomancer of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --Make this card untargetable for attacks local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(aux.IceBarrierDiscardCost(nil,true)) 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 local attr=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL) e:SetLabel(attr) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end local attr=e:GetLabel() c:SetHint(CHINT_ATTRIBUTE,attr) --Cannot be targeted for attacks local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e1:SetLabel(attr) e1:SetValue(s.tgval) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end function s.tgval(e,c) return c:IsAttribute(e:GetLabel()) and not c:IsImmuneToEffect(e) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(Quick Effect): You can discard this card; add 1 "Thunder Dragondark" from your Deck to your hand. If this card is banished, or sent from the field to the GY: You can add 1 "Thunder Dragon" card from your Deck to your hand, except "Thunder Dragondark". You can only use 1 "Thunder Dragondark" effect per turn, and only once that turn.
--雷電龍-サンダー・ドラゴン --Thunder Dragondark --scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Add 1 "Thunder Dragondark" from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.thtg(s.dragondarkfilter)) e1:SetOperation(s.thop(s.dragondarkfilter)) c:RegisterEffect(e1) --Add 1 "Thunder Dragon" card from your Deck to your hand, except "Thunder Dragondark" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_REMOVE) e2:SetCountLimit(1,id) e2:SetTarget(s.thtg(s.thundrafilter)) e2:SetOperation(s.thop(s.thundrafilter)) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) c:RegisterEffect(e3) end s.listed_series={SET_THUNDER_DRAGON} s.listed_names={id} function s.dragondarkfilter(c) return c:IsCode(id) and c:IsAbleToHand() end function s.thundrafilter(c) return c:IsSetCard(SET_THUNDER_DRAGON) and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(filter) return function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end end function s.thop(filter) return function(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 "Superheavy Samurai" monster you control; equip this card from your hand or field to that monster you control. The equipped monster is treated as a Tuner. If you have no Spells/Traps in your GY and this card was equipped to a monster by this card's effect: You can Special Summon this equipped card. You can only use this effect of "Superheavy Samurai Soulgaia Booster" once per turn.
--超重武者装留ガイア・ブースター --Superheavy Samurai Soulgaia Booster --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Equip this card to a "Superheavy Samurai" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) --Special Summon this card that was equipped to a monster by its own effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(function(e,tp) return e:GetHandler():HasFlagEffect(id) and not Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_GRAVE,0,1,nil) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SUPERHEAVY_SAMURAI} function s.eqtg(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(tp) and c~=chkc and chkc:IsFaceup() and chkc:IsSetCard(SET_SUPERHEAVY_SAMURAI) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_SUPERHEAVY_SAMURAI),tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_SUPERHEAVY_SAMURAI),tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,0,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if not (Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsControler(tp) and Duel.Equip(tp,c,tc,true)) then Duel.SendtoGrave(c,REASON_RULE) end c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) --Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetValue(function(_,c) return c==tc end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Equipped monster is treated as a tuner local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_TUNER) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) 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:
"Elemental HERO Neos" + 1 "Wingman" Fusion Monster Must be Fusion Summoned. Gains 300 ATK for each monster in your GY, also cannot be destroyed by card effects. If this card is Special Summoned: You can destroy cards your opponent controls up to the number of different Attributes among the monsters on the field. You can only use this effect of "Elemental HERO Shining Neos Wingman" once per turn. If this card destroys a monster by battle: Inflict damage to your opponent equal to that monster's original ATK.
--E・HERO シャイニング・ネオス・ウィングマン --Elemental HERO Shining Neos Wingman local s,id=GetID() function s.initial_effect(c) --Fusion Materials c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,CARD_NEOS,s.ffilter) --Must be Fusion Summoned local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(aux.fuslimit) c:RegisterEffect(e0) --Destroy opponent's cards up to the number of different Attributes 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:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Increase ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.atkval) c:RegisterEffect(e2) --Cannot be destroyed by card effects local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(1) c:RegisterEffect(e3) --Inflict damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EVENT_BATTLE_DESTROYING) e4:SetCondition(aux.bdcon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end s.listed_names={CARD_NEOS} s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO,SET_NEOS,SET_WINGMAN} function s.ffilter(c,fc,sumtype,tp) return c:IsType(TYPE_FUSION,fc,sumtype,tp) and c:IsSetCard(SET_WINGMAN,fc,sumtype,tp) end --Destroy opponent's cards up to the number of different Attributes function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local attg=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local ct=attg:GetClassCount(Card.GetAttribute) local dg=Duel.GetMatchingGroup(nil,tp,0,LOCATION_ONFIELD,nil) if chk==0 then return ct>0 and #dg>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local attg=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #attg==0 then return end local ct=attg:GetClassCount(Card.GetAttribute) if ct>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_ONFIELD,1,ct,nil) if #dg==0 then return end Duel.HintSelection(dg,true) Duel.Destroy(dg,REASON_EFFECT) end end --Gains 300 ATK for each monster in your GY function s.atkval(e,c) return Duel.GetMatchingGroupCount(Card.IsMonster,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil)*300 end --Inflict damage function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dam=e:GetHandler():GetBattleTarget():GetBaseAttack() if dam<0 then dam=0 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) 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) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters, including a Link Monster Must first be Link Summoned. If this card is Special Summoned: You can banish 1 Spell from your hand or GY, then target 1 monster your opponent controls with 2500 or less ATK; equip that face-up monster to this card as an Equip Spell. You can only use this effect of "Sky Striker Ace - Azalea Temperance" once per turn. When this card is destroyed by battle: You can Special Summon 1 other "Sky Striker" monster from your hand or GY.
--閃刀姫-アザレア・テンペランス --Sky Striker Ace - Azalea Temperance --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,nil,2,4,s.lcheck) --Must first be Link Summoned local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetRange(LOCATION_EXTRA) e0:SetValue(aux.lnklimit) c:RegisterEffect(e0) --Equip an opponent's monster with 2500 or less ATK to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(s.eqcost) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,function(ec,c,tp) return ec:IsAttackBelow(2500) and ec:IsFaceup() end,Card.EquipByEffectAndLimitRegister,e1) --Special Summon 1 other "Sky Striker" monster from your hand or GY 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:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SKY_STRIKER} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_LINK,lc,sumtype,tp) end function s.eqcostfilter(c) return c:IsSpell() and c:IsAbleToRemoveAsCost() end function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.eqcostfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.eqcostfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.eqfilter(c) return c:IsAttackBelow(2500) and c:IsFaceup() and c:IsAbleToChangeControler() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.eqfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then e:GetHandler():EquipByEffectAndLimitRegister(e,tp,tc) end end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SKY_STRIKER) 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_HAND|LOCATION_GRAVE,0,1,e:GetHandler(),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)<=0 then return end local c=e:GetHandler() local exc=c:IsRelateToEffect(e) and c or nil Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,exc,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:
Cannot be used as Synchro Material, except for the Synchro Summon of a "Scrap" monster, and all other materials must be "Scrap" monsters. When this card is Normal Summoned: You can target 1 "Scrap" Tuner in your GY; Special Summon that target.
--スクラップ・キマイラ --Scrap Chimera local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Scrap" Tuner monster from your GY 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_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) --Cannot be used as Synchro Material for non-"Scrap" Synchro Monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e2:SetValue(s.synlimit) c:RegisterEffect(e2) --Other Synchro Materials when using this card must be "Scrap" monsters local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetCode(EFFECT_SYNCHRO_MAT_RESTRICTION) e4:SetValue(aux.TargetBoolFunction(Card.IsSetCard,SET_SCRAP)) c:RegisterEffect(e4) end s.listed_series={SET_SCRAP} function s.spfilter(c,e,tp) return c:IsSetCard(SET_SCRAP) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sumtg(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.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,tp,0) end function s.sumop(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 function s.synlimit(e,c) if not c then return false end return not c:IsSetCard(SET_SCRAP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The equipped monster gains 800 ATK/DEF for each face-up monster you control.
--団結の力 --United We Stand local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Atk,def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(s.value) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_DEFENSE) e3:SetValue(s.value) c:RegisterEffect(e3) end function s.value(e,c) return Duel.GetMatchingGroupCount(Card.IsFaceup,e:GetHandler():GetControler(),LOCATION_MZONE,0,nil)*800 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Vylon" Tuner + 1 or more non-Tuner monsters When this card is Synchro Summoned: You can target 1 Equip Spell Card in your Graveyard; equip that target to this card. While this card is equipped with an Equip Card, it cannot be destroyed by Spell/Trap effects, except for Equip Cards.
--ヴァイロン・アルファ --Vylon Alpha local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_VYLON),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetCondition(s.indcon) e2:SetValue(s.indval) c:RegisterEffect(e2) end s.listed_series={SET_VYLON} function s.eqcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.filter(c,ec) return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(ec) end function s.eqtg(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:GetHandler()) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Equip(tp,tc,c) end end function s.indcon(e) return e:GetHandler():GetEquipCount()>0 end function s.indval(e,re) if not re then return false end local ty=re:GetActiveType() return (ty&TYPE_SPELL+TYPE_TRAP)~=0 and (ty&TYPE_EQUIP)==0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate by declaring 1 monster Attribute. All face-up monsters become that Attribute.
--DNA移植手術 --DNA Transplant 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,TIMINGS_CHECK_MONSTER|TIMING_DRAW_PHASE) e1:SetTarget(s.target) c:RegisterEffect(e1) --race local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetCode(EFFECT_CHANGE_ATTRIBUTE) e2:SetValue(s.value) c:RegisterEffect(e2) e1:SetLabelObject(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) local rc=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL) e:GetLabelObject():SetLabel(rc) e:GetHandler():SetHint(CHINT_ATTRIBUTE,rc) end function s.value(e,c) return e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While a "Gravekeeper's" monster(s) and "Necrovalley" are both on the field, monsters your opponent controls lose 500 ATK/DEF. Once per turn, during the Main Phase, if you control no card in your Field Zone: You can activate 1 "Necrovalley" directly from your hand or GY. If this card in your possession is destroyed by an opponent's effect and sent to your GY: You can Set 1 "Necrovalley" Spell/Trap directly from your Deck, except "Necrovalley Temple".
--ネクロバレーの神殿 --Necrovalley Temple 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) --Decrease ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.atkcon) e2:SetValue(-500) c:RegisterEffect(e2) --Decrease DEF local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --Activate "Necrovalley" local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_FREE_CHAIN) e4:SetCountLimit(1) e4:SetCondition(s.accon) e4:SetOperation(s.acop) c:RegisterEffect(e4) --Set 1 "Necrovalley" Spell/Trap local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_TO_GRAVE) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetCondition(s.setcon) e5:SetTarget(s.settg) e5:SetOperation(s.setop) c:RegisterEffect(e5) end s.listed_series={SET_GRAVEKEEPERS,SET_NECROVALLEY} s.listed_names={CARD_NECROVALLEY} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_GRAVEKEEPERS),e:GetHandlerPlayer(),LOCATION_MZONE,LOCATION_MZONE,1,nil) and Duel.IsEnvironment(CARD_NECROVALLEY) end function s.accon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,tp) and not Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_FZONE,0,1,nil) end function s.filter(c,tp) return c:IsCode(CARD_NECROVALLEY) and c:GetActivateEffect() and c:GetActivateEffect():IsActivatable(tp,true,true) end function s.acop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() Duel.ActivateFieldSpell(tc,e,tp,eg,ep,ev,re,r,rp) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_DESTROY) and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) end function s.setfilter(c) return c:IsSetCard(SET_NECROVALLEY) and not c:IsCode(id) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local tc=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.SSet(tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Tribute Summoned face-up, it gains this effect. ● Neither player can activate monster effects. * The above text is unofficial and describes the card's functionality in the OCG.
--エンジェルO7 --Angel O7 local s,id=GetID() function s.initial_effect(c) --act limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.regop) c:RegisterEffect(e1) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsTributeSummoned() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,1) e1:SetValue(s.aclimit) c:RegisterEffect(e1) end function s.aclimit(e,re,tp) return re:IsMonsterEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent Special Summons a Ritual, Fusion, Synchro, Xyz, and/or Link Monster(s) (except during the Damage Step): You can activate 1 of these effects; ● Add 1 "Fallen of Albaz", or 1 monster that mentions it, from your Deck to your hand. ● Special Summon 1 "Fallen of Albaz", or 1 monster that mentions it, from your hand. You can only use each effect of "New Frontier" once per turn.
--開かれし大地 --New Frontier --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) --Activate 1 of these effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) e2:SetCondition(s.effcon) e2:SetTarget(s.efftg) e2:SetOperation(s.effop) c:RegisterEffect(e2) end s.listed_names={id,CARD_ALBAZ} function s.effconfilter(c,tp) return c:IsSummonPlayer(1-tp) and c:IsType(TYPE_RITUAL|TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ|TYPE_LINK) and c:IsFaceup() end function s.effcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.effconfilter,1,nil,tp) end function s.albazfilter(c) return c:IsCode(CARD_ALBAZ) or (c:IsMonster() and c:ListsCode(CARD_ALBAZ)) end function s.thfilter(c) return s.albazfilter(c) and c:IsAbleToHand() end function s.spfilter(c,e,tp) return s.albazfilter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=not Duel.HasFlagEffect(tp,id) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=not Duel.HasFlagEffect(tp,id+1) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) if op==1 then Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) else Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end e:SetLabel(op) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Add 1 "Fallen of Albaz", or 1 monter that mentions it, from your Deck to your hand 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 elseif op==2 then --Special Summon 1 "Fallen of Albaz", or 1 monter that mentions it, from your hand 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) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot declare an attack unless you banish 1 card from your GY. If exactly 3 of your cards are banished: You can Special Summon this card from your hand. You can only use this effect of "D.D. Assault Carrier" once per turn.
--異次元の強襲艦 --D.D. Assault Carrier --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Attack cost local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ATTACK_COST) e1:SetCost(s.atkcost) e1:SetOperation(s.atkop) 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_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.atkcost(e,c,tp) return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_GRAVE,0,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local coststatus=Duel.IsAttackCostPaid() if coststatus~=2 and c:IsLocation(LOCATION_MZONE) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local cg=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_GRAVE,0,nil) local tc=cg:SelectUnselect(Group.CreateGroup(),tp,coststatus==0,coststatus==0) if tc then Duel.Remove(tc,POS_FACEUP,REASON_COST) Duel.AttackCostPaid() else Duel.AttackCostPaid(2) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_REMOVED,0)==3 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 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:
When this card is Pendulum Summoned: You can target 1 card on the field; return it to the hand. You can only use this effect of "Aether, the Empowering Dragon" once per turn.
--魔装聖龍 イーサルウェポン --Aether, the Empowering Dragon 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) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) 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():IsPendulumSummoned() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.operation(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 2 or more cards are in the same column, you can Special Summon this card (from your hand) in that column. You can only Special Summon "Mekk-Knight Red Moon" once per turn this way. You can banish 1 "Mekk-Knight" monster from your GY, then target 1 face-up monster in this card's column; destroy it.
--紅蓮の機界騎士 --Mekk-Knight Red Moon --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon itself from hand 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetValue(s.hspval) c:RegisterEffect(e1) --Destroy 1 monster in this card's column local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.cost) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_MEKK_KNIGHT} function s.cfilter(c) return c:GetColumnGroupCount()>0 end function s.hspval(e,c) local tp=c:GetControler() local zone=0 local lg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) for tc in aux.Next(lg) do zone=(zone|tc:GetColumnZone(LOCATION_MZONE,0,0,tp)) end return 0,zone end function s.costfilter(c) return c:IsSetCard(SET_MEKK_KNIGHT) and c:IsMonster() and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.filter(c,g,mc) return c:IsFaceup() and (g:IsContains(c) or c==mc) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local cg=c:GetColumnGroup() if chkc then return s.filter(chkc,cg,c) and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,cg,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,cg,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.operation(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:
2+ Dinosaur monsters, including a Level 6 or higher monster If this card is Special Summoned: You can Special Summon 1 Dinosaur monster from your hand. If a face-up Dinosaur monster this card points to is destroyed by battle or sent to the GY: You can draw 1 card. If this card is destroyed: You can shuffle 1 Normal Monster from your GY into the Deck, then you can Special Summon this card. You can only use each effect of "Transcendosaurus Exaraptor" once per turn.
--超越竜エグザラプトル --Transcendosaurus Exaraptor --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon Procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DINOSAUR),2,nil,s.matcheck) --Special Summon 1 Dinosaur monster from your hand 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_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Summon 1 "Super Quant" monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetLabel(1) e2:SetCondition(s.drwcon) e2:SetTarget(s.drwtg) e2:SetOperation(s.drwop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_TO_GRAVE) e3:SetLabel(2) c:RegisterEffect(e3) --Shuffle 1 Normal Monster from your GY into the Deck and Special Summon this card local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCountLimit(1,{id,2}) e4:SetTarget(s.tdtg) e4:SetOperation(s.tdop) c:RegisterEffect(e4) end function s.matcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsLevelAbove,1,nil,6) end function s.spfilter(c,e,tp) return c:IsRace(RACE_DINOSAUR) 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_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) 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_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.cfilter(c,tp,zone,label) local seq=c:GetPreviousSequence() local rac=c:GetPreviousRaceOnField() if c:IsPreviousControler(1-tp) then seq=seq+16 end return (zone&(1<<seq))>0 and c:IsPreviousPosition(POS_FACEUP) and (rac&RACE_DINOSAUR)>0 and (label==1 or (label==2 and c:IsRace(RACE_DINOSAUR) and not c:IsReason(REASON_BATTLE))) end function s.drwcon(e,tp,eg,ep,ev,re,r,rp) local zone=e:GetHandler():GetLinkedZone() return eg:IsExists(s.cfilter,1,nil,tp,zone,e:GetLabel()) end function s.drwtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drwop(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 function s.tdfilter(c) return c:IsType(TYPE_NORMAL) and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g==0 then return end Duel.HintSelection(g,true) local c=e:GetHandler() if Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_DECK) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() 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 Tribute this card, then target 1 "Springans" monster in your GY, except "Springans Pedor"; Special Summon it. If this card is in your hand, field, or GY: You can target 1 "Springans" Xyz Monster you control; attach this card to it as material. You can only use each effect of "Springans Pedor" once per turn.
--スプリガンズ・ピード --Springans Pedor --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Attach itself to 1 "Sprigguns" Xyz monster from hand, field, or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_GRAVE|LOCATION_HAND|LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.mattg) e1:SetOperation(s.matop) c:RegisterEffect(e1) --Special summon 1 "Spriggun" monster 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_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end --Lists "Sprigguns" archetype s.listed_series={SET_SPRINGANS} --Specifically lists itself s.listed_names={id} --Check for "Sprigguns" Xyz monster function s.matfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SPRINGANS) and c:IsType(TYPE_XYZ) end --Activation legality function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.matfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.matfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.matfilter,tp,LOCATION_MZONE,0,1,1,nil) if(e:GetHandler():IsLocation(LOCATION_GRAVE)) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end end --Attach itself to targeted "Sprigguns" Xyz monster from hand, field, or GY function s.matop(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 not tc:IsImmuneToEffect(e) then Duel.Overlay(tc,c) end end --Tribute itself as cost --Check for "Spriggun" monster, except "Sprigguns Pede" function s.filter(c,e,tp) return c:IsSetCard(SET_SPRINGANS) 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:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 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 --Special summon 1 "Spriggun" monster from GY 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:
If you control a FIRE Warrior monster, you can Special Summon this card (from your hand). If Summoned this way, treat this card as a Tuner. You can only Special Summon "Infernoble Knight - Renaud" once per turn this way. If this card is Special Summoned: You can target 1 of your FIRE Warrior monsters, or 1 of your Equip Spells, that is banished or in your GY, except "Infernoble Knight - Renaud"; add it to your hand. You can only use this effect of "Infernoble Knight - Renaud" once per turn.
--焔聖騎士-リナルド --Infernoble Knight - Renaud --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Special summon 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={} function s.spfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_WARRIOR) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_MZONE,0,1,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(TYPE_TUNER) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e1) end function s.thfilter(c) return ((c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_WARRIOR) and not c:IsCode(id)) or c:IsType(TYPE_EQUIP)) and (c:IsFaceup() or not c:IsLocation(LOCATION_REMOVED)) 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|LOCATION_REMOVED) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,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 tc 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:
Once per turn: You can reveal any number of "Nekroz" cards in your hand; increase or reduce this card's Level by the number of revealed cards until the end of this turn. If this card is Tributed by a card effect: You can add 1 "Nekroz" monster from your Deck to your hand, except a Ritual Monster. You can only use this effect of "Ariel, Priestess of the Nekroz" once per turn.
--影霊衣の巫女 エリアル --Ariel, Priestess of the Nekroz local s,id=GetID() function s.initial_effect(c) --level change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.lvcost) e1:SetOperation(s.lvop) 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_RELEASE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_NEKROZ} function s.cfilter(c) return c:IsSetCard(SET_NEKROZ) and not c:IsPublic() end function s.lvcost(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.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,63,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) e:SetLabel(#g) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end local ct=e:GetLabel() local sel=nil if c:GetLevel()==1 then sel=Duel.SelectOption(tp,aux.Stringid(id,2)) else sel=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3)) end if sel==1 then ct=ct*-1 end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(ct) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT)~=0 end function s.filter(c) return c:IsSetCard(SET_NEKROZ) and c:IsMonster() and not c:IsType(TYPE_RITUAL) 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:
Tribute 1 monster; make your opponent Tribute 1 monster (for no effect).
--痛み分け --Share the Pain local s,id=GetID() function s.initial_effect(c) --Make the opponent tribute a monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) 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 function s.cfilter(c,tp) return Duel.CheckReleaseGroup(1-tp,nil,1,c) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroup(1-tp,nil,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_RELEASE) local g=Duel.SelectReleaseGroup(1-tp,nil,1,1,nil) if g then Duel.Release(g,REASON_RULE,1-tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 5 LIGHT monsters You can also Xyz Summon this card by using a Rank 4 "Utopia" monster you control as material. (Transfer its materials to this card.) Cannot be used as material for an Xyz Summon. If this card battles, your opponent cannot activate cards or effects until the end of the Damage Step. Once per Chain, during damage calculation, if this card battles an opponent's monster while this card has a "Utopia" Xyz Monster as material (Quick Effect): You can detach 2 materials from this card; this card's ATK becomes 5000 during that damage calculation only.
--SNo.39 希望皇ホープ・ザ・ライトニング --Number S39: Utopia the Lightning local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 5 LIGHT monsters OR 1 Rank 4 "Utopia" monster you control Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),5,3,s.ovfilter,aux.Stringid(id,0)) --Cannot be used as material for an Xyz Summon local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e0:SetValue(1) c:RegisterEffect(e0) --If this card battles, your opponent cannot activate cards or effects until the end of the Damage Step local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,1) e1:SetCondition(function(e) local c=e:GetHandler() return Duel.GetAttacker()==c or Duel.GetAttackTarget()==c end) e1:SetValue(1) c:RegisterEffect(e1) --This card's ATK becomes 5000 during that damage calculation only local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.atkcon) e2:SetCost(Cost.AND(Cost.DetachFromSelf(2),Cost.SoftOncePerBattle)) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_UTOPIA} s.xyz_number=39 function s.ovfilter(c,tp,xyzc) return c:IsRank(4) and c:IsSetCard(SET_UTOPIA,xyzc,SUMMON_TYPE_XYZ,tp) and c:IsType(TYPE_XYZ,xyzc,SUMMON_TYPE_XYZ,tp) and c:IsFaceup() end function s.atkconfilter(c) return c:IsSetCard(SET_UTOPIA) and c:IsType(TYPE_XYZ) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsControler(1-tp) and c:GetOverlayGroup():IsExists(s.atkconfilter,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --This card's ATK becomes 5000 during that damage calculation only local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(5000) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Special Summon 1 Level 4 or lower "Batteryman" monster from your Deck, except "Batteryman Micro-Cell". After this card has been flipped face-up, when it is destroyed by battle and sent to the Graveyard, draw 1 card.
--電池メン-ボタン型 --Batteryman Micro-Cell local s,id=GetID() function s.initial_effect(c) --flip effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_FLIP) e2:SetOperation(s.flipop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_DESTROYED) e3:SetCondition(s.drcon) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) end s.listed_series={SET_BATTERYMAN} s.listed_names={id} function s.filter(c,e,tp) return not c:IsCode(id) and c:IsSetCard(SET_BATTERYMAN) and c:IsLevelBelow(4) 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 true 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) end end function s.flipop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_EXC_GRAVE,0,0) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():GetFlagEffect(id)~=0 end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) 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.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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 4 LIGHT monsters You can also Xyz Summon this card by using a "Number 39: Utopia" you control as material. (Transfer its materials to this card.) You can detach 1 material from this card; it gains 500 ATK until the end of this turn, and if it does, 1 monster your opponent controls loses 1000 ATK until the end of this turn. You must have 1000 LP or less to activate and to resolve this effect.
--CNo.39 希望皇ホープレイ --Number C39: Utopia Ray local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 4 LIGHT monsters / 1 "Number 39: Utopia" Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),4,3,s.ovfilter,aux.Stringid(id,0)) --Make this card gain 500 ATK and 1 monster your opponent controls lose 1000 ATK until the end of that turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCondition(function(e,tp) return Duel.GetLP(tp)<=1000 end) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end s.xyz_number=39 s.listed_names={84013237} --"Number 39: Utopia" function s.ovfilter(c,tp,lc) return c:IsFaceup() and c:IsSummonCode(lc,SUMMON_TYPE_XYZ,tp,84013237) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLP(tp)>1000 then return end local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup()) then return end --This card gains 500 ATK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() if sc then Duel.HintSelection(sc) --Loses 1000 ATK until the end of this turn local e2=e1:Clone() e2:SetValue(-1000) sc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this face-up card is sent from the field to the GY: You can draw 1 card. * The above text is unofficial and describes the card's functionality in the OCG.
--引きガエル --Poison Draw Frog local s,id=GetID() function s.initial_effect(c) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_TO_GRAVE) 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) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) 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:
Activate by sending 2 cards from your hand to the Graveyard while your opponent has more than 3000 Life Points. Inflict 2000 damage to your opponent. If this card is in the Graveyard, you can add it to your hand instead of conducting your normal draw during your Draw Phase.
--メテオ・プロミネンス --Meteor Flare local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.damcon) e1:SetCost(s.damcost) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PREDRAW) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(1-tp)>3000 end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,2,nil) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,2,2,REASON_COST) end 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(2000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,2000) 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) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.GetDrawCount(tp)>0 end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToHand() end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() _replace_count=_replace_count+1 if _replace_count<=_replace_max and 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:
You can Ritual Summon this card with "Meteonis Drytron". Other "Drytron" monsters you control cannot be destroyed by your opponent's card effects. Twice per turn, when your opponent activates a monster effect (Quick Effect): You can banish "Drytron" monsters (min. 1) from your GY whose total ATK equal or exceed the original ATK of that monster; negate the activation, and if you do, destroy it. If this Ritual Summoned card in its owner's control is destroyed by an opponent's card: You can Special Summon 1 Ritual Monster with 4000 ATK from your hand or Deck. (This is treated as a Ritual Summon.)
--竜儀巧-メテオニス=DAD --Drytron Meteonis DA Draconids --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Other "Drytron" monsters you control cannot be destroyed by your opponent's card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c~=e:GetHandler() and c:IsSetCard(SET_DRYTRON) end) e1:SetValue(aux.indoval) c:RegisterEffect(e1) --Negate the activation of an opponent's monster effect and destroy that monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(2) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and re:IsMonsterEffect() and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end) e2:SetCost(s.negcost) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Special Summon 1 Ritual Monster with 4000 ATK from your hand or Deck 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:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={22398665} s.listed_series={SET_DRYTRON} function s.negcostfilter(c) return c:IsSetCard(SET_DRYTRON) and c:IsMonster() and c:GetAttack()>0 and c:IsAbleToRemoveAsCost() end function s.negcost(e,tp,eg,ep,ev,re,r,rp,chk) local atk=re:GetHandler():GetBaseAttack() local g=Duel.GetMatchingGroup(s.negcostfilter,tp,LOCATION_GRAVE,0,nil) if chk==0 then return #g>0 and g:CheckWithSumGreater(Card.GetAttack,atk) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Group.CreateGroup() if atk>0 then rg=g:SelectWithSumGreater(tp,Card.GetAttack,atk) else rg=g:Select(tp,1,1,nil) end Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local rc=re:GetHandler() Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,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 function s.spfilter(c,e,tp) local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,c,nil,REASON_RITUAL) return #pg<=0 and c:IsRitualMonster() and c:IsAttack(4000) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_RITUAL,tp,true,false) end 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_MZONE) and c:IsRitualSummoned() 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_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,SUMMON_TYPE_RITUAL,tp,tp,true,false,POS_FACEUP)>0 then tc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target Spells/Traps your opponent controls, up to the number of "Witchcrafter" monsters you control; return those targeted cards to the hand. During your End Phase, if you control a "Witchcrafter" monster, while this card is in your GY: You can add this card to your hand. You can only use 1 "Witchcrafter Draping" effect per turn, and only once that turn.
--ウィッチクラフト・ドレーピング --Witchcrafter Draping --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon2) e2:SetTarget(s.thtg2) e2:SetOperation(s.thop2) c:RegisterEffect(e2) end s.listed_series={SET_WITCHCRAFTER} function s.thfilter(c) return c:IsSpellTrap() and c:IsAbleToHand() 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 s.thfilter(chkc) end if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_WITCHCRAFTER),tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_ONFIELD,1,nil) end local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_WITCHCRAFTER),tp,LOCATION_MZONE,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_ONFIELD,1,ct,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.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end function s.thcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_WITCHCRAFTER),tp,LOCATION_MZONE,0,1,nil) and Duel.IsTurnPlayer(tp) end function s.thtg2(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.thop2(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,tp,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When using this card as Synchro Material, the other Synchro Material(s) must be Level 4 or lower Warrior or Machine-Type monsters, and they are treated as Level 1.
--モノ・シンクロン --Mono Synchron local s,id=GetID() function s.initial_effect(c) --synchro custom local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) e1:SetOperation(s.synop) c:RegisterEffect(e1) local e4=Effect.CreateEffect(c) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_SYNCHRO_MAT_RESTRICTION) e4:SetValue(s.synfilter) c:RegisterEffect(e4) end function s.synfilter(e,c) return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR|RACE_MACHINE) end function s.synop(e,tg,ntg,sg,lv,sc,tp) return #sg-1+e:GetHandler():GetLevel()==lv,true end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Witch of the Black Forest" + "Lady of Faith"
--音楽家の帝王 --Musician King local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,78010363,17358176) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn: You can banish this card; Special Summon 1 Level 3 or higher "Kozmo" monster from your hand. You can only use this effect of "Kozmo Strawman" once per turn. Once per turn: You can pay 500 LP, then target 1 of your banished "Kozmo" monsters; Special Summon it, but its effects are negated, also destroy it during the End Phase.
--Kozmo-フォルミート --Kozmo Strawman local s,id=GetID() function s.initial_effect(c) --spsummon 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:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.sptg1) e1:SetOperation(s.spop1) 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.PayLP(500)) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end s.listed_series={SET_KOZMO} function s.spfilter1(c,e,tp) return c:IsSetCard(SET_KOZMO) and c:IsLevelAbove(3) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(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.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 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:IsFaceup() and c:IsSetCard(SET_KOZMO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter2(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter2,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter2,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop2(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) then 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) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCountLimit(1) e3:SetCondition(s.descon) e3:SetOperation(s.desop) e3:SetLabelObject(tc) Duel.RegisterEffect(e3,tp) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end Duel.SpecialSummonComplete() end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffect(id)==0 then e:Reset() return false end return true end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.Destroy(tc,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 10 monsters Once per turn: You can detach 1 material from this card; inflict 2000 damage to your opponent.
--超弩級砲塔列車グスタフ・マックス --Superdreadnought Rail Cannon Gustav Max local s,id=GetID() function s.initial_effect(c) --Xyz Summon Xyz.AddProcedure(c,nil,10,2) c:EnableReviveLimit() --Burn for 2000 LP local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) 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(1-tp) Duel.SetTargetParam(2000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,2000) 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.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster you control; it gains 200 ATK/DEF for each card your opponent currently has in their hand, until the end of this turn.
--エナジー・ドレイン --Energy Drain local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local val=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)*200 if val~=0 and tc:IsRelateToEffect(e) and 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(val) 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:
Target 1 "Blue-Eyes" monster you control; this turn, that face-up monster is unaffected by card effects, except its own, it cannot be destroyed by battle, also any opponent's monster it battles is destroyed at the end of the Damage Step. While this card is in your GY, if you Normal or Special Summon a "Blue-Eyes White Dragon": You can Set this card, but banish it when it leaves the field. You can only use this effect of "The Ultimate Creature of Destruction" once per turn.
--強靭!無敵!最強! --The Ultimate Creature of Destruction local s,id=GetID() function s.initial_effect(c) --Apply various lingering effects to your "Blue-Eyes White Dragon" local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --Set itself from GY if you normal summoned "Blue-Eyes White Dragon" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.setcon) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) --Same as above, but if special summoned local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_BLUE_EYES} s.listed_names={CARD_BLUEEYES_W_DRAGON} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_BLUE_EYES) 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) local g=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 c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Unaffected by other card effects local e1=Effect.CreateEffect(c) e1:SetDescription(3100) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.efilter) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) --Cannot be destroyed by battle local e2=Effect.CreateEffect(c) e2:SetDescription(3000) e2:SetProperty(EFFECT_FLAG_CLIENT_HINT) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) --Destroy any monster it battles at end of damage step local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetCondition(s.descon) e3:SetOperation(s.desop) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end function s.efilter(e,re) return e:GetHandler()~=re:GetOwner() end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetBattleTarget() return tc and tc:IsRelateToBattle() end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetBattleTarget() Duel.Hint(HINT_CARD,0,id) Duel.Destroy(tc,REASON_EFFECT) end function s.cfilter(c,tp) return c:IsCode(CARD_BLUEEYES_W_DRAGON) and c:IsSummonPlayer(tp) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
After damage calculation: Destroy any opponent's monster that battles this card.
--紋章獣バシリスク --Heraldic Beast Basilisk 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_BATTLED) 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():GetBattleTarget()~=nil end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local tc=e:GetHandler():GetBattleTarget() Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0) end function s.operation(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:
If it is not the first turn of the Duel and there are no cards on the field, you can Normal Summon this card without Tributing. You can destroy all Field Spell Cards on the field. This card cannot attack the turn you activate this effect.
--グラヴィティ・ベヒモス --Gravity Behemoth local s,id=GetID() function s.initial_effect(c) --Normal summon it with no tributes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) c:RegisterEffect(e1) --Destroy all field spells on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCategory(CATEGORY_DESTROY) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.ntcon(e,c,minc) if c==nil then return Duel.GetTurnCount()~=1 end return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_ONFIELD,LOCATION_ONFIELD)==0 end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end --Cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) e:GetHandler():RegisterEffect(e1) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.TRUE,0,LOCATION_FZONE,LOCATION_FZONE,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,0,LOCATION_FZONE,LOCATION_FZONE,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:
The equipped monster cannot attack. Once per turn, during your Standby Phase: Inflict 500 damage to the controller of the equipped monster.
--呪魂の仮面 --Mask of the Accursed local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --The equipped monster cannot attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e1) --Inflict 500 damage to the controller of the equipped monster 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:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_PHASE+PHASE_STANDBY) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local p=e:GetHandler():GetEquipTarget():GetControler() Duel.SetTargetPlayer(p) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,p,500) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=e:GetHandler():GetEquipTarget():GetControler() local d=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can add 1 "Dinowrestler" monster or 1 "World Dino Wrestling" from your Deck to your hand. During the End Phase, if this card is in the GY because it was sent there this turn, and your opponent controls more monsters than you do: You can target 1 "Dinowrestler" monster in your GY, except "Dinowrestler Systegosaur"; Special Summon it. You can only use each effect of "Dinowrestler Systegosaur" once per turn.
--ダイナレスラー・システゴ --Dinowrestler Systegosaur --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Add 1 "Dinowrestler" monster or 1 "World Dino Wrestling" 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_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Register being sent to the GY local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_TO_GRAVE) e2:SetOperation(s.regop) c:RegisterEffect(e2) --Special Summon 1 "Dinowrestler" monster from your GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_GRAVE) 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_DINOWRESTLER} s.listed_names={90173539,id} --"World Dino Wrestling" function s.thfilter(c) return ((c:IsSetCard(SET_DINOWRESTLER) and c:IsMonster()) or c:IsCode(90173539)) 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) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_DINOWRESTLER) 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 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,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end 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:
If you control a Spellcaster-Type monster: You can reveal 1 other "Spellbook" card in your hand, then target 1 "Spellbook" Normal Spell Card in your Graveyard, except "Spellbook of the Master"; this card's effect becomes that target's effect. You can only activate 1 "Spellbook of the Master" per turn.
--セフェルの魔導書 --Spellbook of the Master local s,id=GetID() function s.initial_effect(c) --copy a "Spellbook" Spell local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={id} s.listed_series={SET_SPELLBOOK} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),tp,LOCATION_MZONE,0,1,nil) end function s.cffilter(c) return c:IsSetCard(SET_SPELLBOOK) and not c:IsPublic() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cffilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.cffilter,tp,LOCATION_HAND,0,1,1,e:GetHandler()) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.filter(c) return c:IsSetCard(SET_SPELLBOOK) and not c:IsCode(id) and c:IsNormalSpell() and c:CheckActivateEffect(true,true,false)~=nil end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local tg=e:GetLabelObject():GetTarget() return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end e:SetProperty(EFFECT_FLAG_CARD_TARGET) e:SetCategory(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) local te=g:GetFirst():CheckActivateEffect(true,true,false) Duel.ClearTargetCard() e:SetProperty(te:GetProperty()) e:SetLabel(te:GetLabel()) e:SetLabelObject(te:GetLabelObject()) local tg=te:GetTarget() if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end te:SetLabel(e:GetLabel()) te:SetLabelObject(e:GetLabelObject()) e:SetLabelObject(te) Duel.ClearOperationInfo(0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() if te:GetHandler():IsRelateToEffect(e) then e:SetLabel(te:GetLabel()) e:SetLabelObject(te:GetLabelObject()) local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) end te:SetLabel(e:GetLabel()) te:SetLabelObject(e:GetLabelObject()) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect, is activated, while you control an "Eldlich" monster: Tribute 1 Zombie monster; negate the activation, and if you do, destroy that card. You can only activate 1 "Golden Land Forever!" per turn.
--永久に輝けし黄金郷 --Golden Land Forever! --Scripted by ahtelel 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_ELDLICH} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_ELDLICH),tp,LOCATION_MZONE,0,1,nil) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsRace,1,false,nil,nil,RACE_ZOMBIE) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsRace,1,1,false,nil,nil,RACE_ZOMBIE) Duel.Release(g,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_REMOVE,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:
When your opponent would Normal or Special Summon a monster: Discard 1 "Watt" monster; negate the Summon and destroy it.
--エレキャンセル --Wattcancel local s,id=GetID() function s.initial_effect(c) --Activate(summon) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON) c:RegisterEffect(e2) end s.listed_series={SET_WATT} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain(true)==0 and eg:IsExists(Card.IsControler,1,nil,1-tp) end function s.cfilter(c) return c:IsSetCard(SET_WATT) and c:IsMonster() and c:IsDiscardable() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if Duel.IsPlayerAffectedByEffect(tp,EFFECT_DISCARD_COST_CHANGE) then return true end 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,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=eg:Filter(Card.IsControler,nil,1-tp) Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(Card.IsControler,nil,1-tp) Duel.NegateSummon(g) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Standby Phase, select 1 random card from your opponent's hand. Call the type of card (Monster, Spell, or Trap). If you call it right, inflict 700 points of damage to your opponent's Life Points. You can use this effect only once per turn.
--不吉な占い --Ominous Fortunetelling 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) c:RegisterEffect(e1) --call & 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:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.con) e2:SetOperation(s.op) c:RegisterEffect(e2) end function s.con(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1,nil) local tc=g:GetFirst() if not tc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) local op=Duel.SelectOption(tp,70,71,72) Duel.ConfirmCards(tp,tc) Duel.ShuffleHand(1-tp) if (op==0 and tc:IsMonster()) or (op==1 and tc:IsSpell()) or (op==2 and tc:IsTrap()) then Duel.Damage(1-tp,700,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Chain this card to an opponent's card effect that would inflict damage to you. That damage is negated, and you gain Life Points equal to the amount you would have taken.
--エネルギー吸収板 --Energy-Absorbing Monolith local s,id=GetID() function s.initial_effect(c) --reflect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and aux.damcon1(e,tp,eg,ep,ev,re,r,rp) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_REVERSE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetLabel(cid) e1:SetValue(s.refcon) e1:SetReset(RESET_CHAIN) Duel.RegisterEffect(e1,tp) end function s.refcon(e,re,r,rp,rc) local cc=Duel.GetCurrentChain() if cc==0 or (r&REASON_EFFECT)==0 then return 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:
When this card is Normal Summoned: You can target 1 Level 4 LIGHT Thunder-Type monster with 1600 or less ATK in your Graveyard, except "Sishunder"; banish that target. During the End Phase of this turn, add that card to your hand.
--ONeサンダー --Sishunder local s,id=GetID() function s.initial_effect(c) --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) end s.listed_names={id} function s.filter(c) return c:IsRace(RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==4 and not c:IsCode(id) and c:IsAttackBelow(1600) and c:IsAbleToRemove() and aux.SpElimFilter(c,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(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,HINTMSG_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_REMOVED) e1:SetCountLimit(1) e1:SetOperation(s.thop) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,e:GetHandler()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Armed Dragon LV3" while on the field or in the GY. You can only use each of the following effects of "Armed Dragon Thunder LV3" once per turn. You can send 1 monster from your hand to the GY; send this card from the field to the GY, and if you do, Special Summon 1 Level 5 or lower "Armed Dragon" monster from your hand or Deck. If this card is sent to the GY to activate a Dragon monster's effect: You can draw 1 card.
--アームド・ドラゴン・サンダー LV3 --Armed Dragon Thunder LV3 --Scripted by AlphaKretin Duel.LoadCardScript("c980973.lua") local s,id=GetID() function s.initial_effect(c) --This card's name becomes "Armed Dragon LV3" while on the field or in the GY 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_GRAVE) e1:SetValue(980973) c:RegisterEffect(e1) --Special Summon 1 Level 5 or lower "Armed Dragon" monster from your hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Draw 1 card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.drcon) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) end s.listed_names={980973} --"Armed Dragon LV3" s.listed_series={SET_ARMED_DRAGON} s.LVnum=3 s.LVset=SET_ARMED_DRAGON_THUNDER function s.spcostfilter(c,e,tp) return c:IsMonster() and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,c,e,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ARMED_DRAGON) and c:IsLevelBelow(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.SendtoGrave(g,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:IsAbleToGrave() and Duel.GetMZoneCount(tp,c)>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,c,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoGrave(c,REASON_EFFECT)>0 and c:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) if not (e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsMonsterEffect()) then return false end local rc=re:GetHandler() if rc:IsRelateToEffect(re) and rc:IsFaceup() then return rc:IsRace(RACE_DRAGON) else return Duel.GetChainInfo(0,CHAININFO_TRIGGERING_RACE)&RACE_DRAGON>0 end end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 monsters Cannot attack unless it has material. Once per turn: You can detach 1 material from this card, then target 1 monster on the field; destroy it. This is a Quick Effect if this card has "Super Quantum Red Layer" as material. Once per turn: You can attach 1 "Super Quantum" monster from your hand or field to this card as material.
--超量機獣マグナライガー --Super Quantal Mech Beast Magnaliger local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 5 monsters Xyz.AddProcedure(c,nil,5,2) --Cannot attack unless it has Xyz Material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetCondition(function(e) return e:GetHandler():GetOverlayCount()==0 end) c:RegisterEffect(e1) --Destroy 1 monster on the field local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e2:SetCondition(aux.NOT(s.quickeffcond)) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --This is a Quick effect if this card has "Super Quantum Red Layer" as Xyz Material local e3=e2:Clone() e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e3:SetCondition(s.quickeffcond) c:RegisterEffect(e3) --Attach 1 "Super Quantum" monster from your hand or field to this card local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.attachtg) e4:SetOperation(s.attachop) c:RegisterEffect(e4) end s.listed_series={SET_SUPER_QUANTUM} s.listed_names={59975920} --"Super Quantum Red Layer" function s.quickeffcond(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode,1,nil,59975920) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,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.attachfilter(c,e,tp,xc) return c:IsSetCard(SET_SUPER_QUANTUM) and c:IsMonster() and not c:IsType(TYPE_TOKEN) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsCanBeXyzMaterial(xc,tp,REASON_EFFECT) end function s.attachtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(s.attachfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,e,tp,c) end end function s.attachop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local tc=Duel.SelectMatchingCard(tp,s.attachfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil,e,tp,c):GetFirst() if tc and not tc:IsImmuneToEffect(e) then Duel.Overlay(c,tc,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card inflicts battle damage to your opponent, at the end of that Damage Step: Destroy the 1 face-up monster on the field that has the lowest ATK (your choice, if tied), and if you do, this card loses 800 ATK.
--ズバババスター --Zubaba Buster local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetOperation(s.damop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.damop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE,0,1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.filter(c) return c:IsFaceup() 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.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g==0 then return end local tg=g:GetMinGroup(Card.GetAttack) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g>0 then local tg=g:GetMinGroup(Card.GetAttack) if #tg>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=tg:Select(tp,1,1,nil) Duel.Destroy(sg,REASON_EFFECT) else Duel.Destroy(tg,REASON_EFFECT) end end local c=e:GetHandler() if c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-800) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 Rock-Type monsters This card is unaffected by other monsters' effects. Once per turn, during either player's turn: You can detach 1 Xyz Material from this card; it gains 1000 DEF until the end of this turn, and if it does, you take no effect damage from your opponent's card effects this turn.
--鋼鉄の巨兵 --Giant Soldier of Steel local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_ROCK),3,2) c:EnableReviveLimit() --immune 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:SetValue(s.efilter) c:RegisterEffect(e1) --def local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DEFCHANGE) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.efilter(e,te) return te:IsMonsterEffect() and te:GetOwner()~=e:GetOwner() 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:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CHANGE_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,0) e2:SetValue(s.damval) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) local e3=e2:Clone() e3:SetCode(EFFECT_NO_EFFECT_DAMAGE) e3:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e3,tp) end end function s.damval(e,re,val,r,rp,rc) if (r&REASON_EFFECT)~=0 and rp~=e:GetOwnerPlayer() then return 0 else return val 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 your opponent controls; negate its effects. When your opponent activates a card or effect (Quick Effect): You can shuffle this card from the field into the Deck, and if you do, Special Summon 1 "Blue-Eyes White Dragon" from your Deck. You can only use each effect of "Blue-Eyes Solid Dragon" once per turn.
--ブルーアイズ・ソリッド・ドラゴン --Blue-Eyes Solid Dragon local s,id=GetID() function s.initial_effect(c) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --shuffle local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={CARD_BLUEEYES_W_DRAGON} function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsNegatableMonster() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsNegatableMonster() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end end function s.filter(c,e,tp) return c:IsCode(CARD_BLUEEYES_W_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetMZoneCount(tp,c)>0 and c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsControler(tp) and Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then 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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned with "Release Restraint". Each time an Equip Card(s) is equipped to this card: Target 1 monster your opponent controls; destroy that target.
--剣聖-ネイキッド・ギア・フリード --Gearfried the Swordmaster local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:AddMustBeSpecialSummoned() --Destroy 1 monster your opponent controls 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_EQUIP) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.listed_names={75417459} --"Release Restraint" 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) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) if #g>0 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsControler(1-tp) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Infernoid" monster from your hand, ignoring its Summoning conditions, but its effects are negated until the end of this turn.
--蒼焔の煉獄 --Eye of the Void 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_INFERNOID} function s.filter(c,e,tp) return c:IsSetCard(SET_INFERNOID) and c:IsCanBeSpecialSummoned(e,0,tp,true,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,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.activate(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) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,true,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2,true) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can equip this card to a "Soitsu" you control, OR unequip it to Special Summon this card in face-up Attack Position. When equipped to a monster by this card's effect, that monster gains 2500 ATK. (A monster can only be equipped with 1 Union Monster at a time. If the equipped monster would be destroyed by battle, destroy this card instead.)
--ドイツ --Doitsu local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsCode,60246171),true) --atk up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(2500) e1:SetCondition(aux.IsUnionState) c:RegisterEffect(e1) end s.listed_names={60246171}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only activate this card when your Life Points are at least 2000 lower than your opponent's. Skip your opponent's next Battle Phase.
--魂の氷結 --Frozen Soul 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_MAIN_END) e1:SetCondition(s.condition) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(tp)+2000<=Duel.GetLP(1-tp) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SKIP_BP) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(0,1) if Duel.IsTurnPlayer(1-tp) and Duel.IsBattlePhase() then e1:SetLabel(Duel.GetTurnCount()) e1:SetCondition(s.skipcon) e1:SetReset(RESET_PHASE|PHASE_BATTLE|RESET_OPPO_TURN,2) else e1:SetReset(RESET_PHASE|PHASE_BATTLE|RESET_OPPO_TURN,1) end Duel.RegisterEffect(e1,tp) end function s.skipcon(e) return Duel.GetTurnCount()~=e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send "Gimmick Puppet" monsters with different names from your Deck to the GY, up to the number of monsters your opponent controls that were Special Summoned from the Extra Deck +1. You can banish this card from your GY, then target 1 Machine Xyz Monster you control; it cannot be destroyed by your opponent's card effects while face-up on the field. You can only use each effect of "Condolence Puppet" once per turn.
--コンドーレンス・パペット --Condolence Puppet --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Send "Gimmick Puppet" monsters from deck to GY local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Targeted machine Xyz monster cannot be destroyed by opponent's card effects local e2=Effect.CreateEffect(c) 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.indtg) e2:SetOperation(s.indop) c:RegisterEffect(e2) end s.listed_series={SET_GIMMICK_PUPPET} function s.filter(c) return c:IsSetCard(SET_GIMMICK_PUPPET) and c:IsMonster() and c:IsAbleToGrave() 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_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(Card.IsSummonLocation,tp,0,LOCATION_MZONE,nil,LOCATION_EXTRA)+1 local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if ct==0 or #g==0 then return end local sg=aux.SelectUnselectGroup(g,e,tp,1,ct,aux.dncheck,1,tp,HINTMSG_TOGRAVE) Duel.SendtoGrave(sg,REASON_EFFECT) end function s.indfilter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsRace(RACE_MACHINE) end function s.indtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.indfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.indfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.indfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.indop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then --Cannot be destroyed by opponent's card effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3060) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetValue(s.efilter) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.efilter(e,re,rp) return e:GetHandlerPlayer()==1-rp end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 Level 4 or lower Beast-Warrior monster from your Deck to your hand. All Beast-Warrior monsters you control gain 100 ATK. You can only activate 1 "Fire Formation - Tenki" per turn.
--炎舞-「天璣」 --Fire Formation - Tenki local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) 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:SetOperation(s.activate) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_BEASTWARRIOR)) e2:SetValue(100) c:RegisterEffect(e2) end function s.filter(c) return c:IsLevelBelow(4) and c:IsRace(RACE_BEASTWARRIOR) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
● Attack Position: Once per turn: You can target 1 "Morphtronic" monster in your GY; banish that target, and if you do, add 1 "Morphtronic" monster with the same Level as the target from your Deck to your hand. ● Defense Position: Once per turn: You can send 1 "Morphtronic" monster from your hand to the GY, and if you do, add 1 other "Morphtronic" monster with the same Level as that monster from your GY to your hand.
--D・リモコン --Morphtronic Remoten local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.cona) e1:SetTarget(s.tga) e1:SetOperation(s.opa) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.cond) e2:SetTarget(s.tgd) e2:SetOperation(s.opd) c:RegisterEffect(e2) end s.listed_series={SET_MORPHTRONIC} function s.filter(c,lv) return c:IsSetCard(SET_MORPHTRONIC) and c:GetLevel()==lv and c:IsAbleToHand() end function s.cona(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttackPos() end function s.filtera(c,tp) local lv=c:GetLevel() return c:IsSetCard(SET_MORPHTRONIC) and lv>0 and c:IsAbleToRemove() and aux.SpElimFilter(c,true) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,lv) end function s.tga(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(tp) and s.filtera(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.filtera,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filtera,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.opa(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,tc:GetLevel()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end function s.cond(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsDisabled() and e:GetHandler():IsDefensePos() end function s.filterd(c,tp) local lv=c:GetLevel() return c:IsSetCard(SET_MORPHTRONIC) and lv>0 and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil,lv) end function s.tgd(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filterd,tp,LOCATION_HAND,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.opd(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.filterd,tp,LOCATION_HAND,0,1,1,nil,tp) local tc=g:GetFirst() if not tc then return end Duel.SendtoGrave(tc,REASON_EFFECT) if not tc:IsLocation(LOCATION_GRAVE) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,tc,tc:GetLevel()) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only use the 1st of the following effects of "Therion "Duke" Yul" once per turn. ● You can target 1 "Therion" monster or 1 Psychic monster in your GY; Special Summon this card from your hand, and if you do, equip that monster to this card. ● While you control an Equip Card, "Therion" monsters you control cannot be destroyed by your opponent's card effects. A "Therion" monster equipped with this card gains 700 ATK, also it gains the 2nd effect listed above as if it were "Therion "Duke" Yul".
--セリオンズ“デューク”ユール --Therion "Duke" Yul --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,Card.EquipByEffectAndLimitRegister,e1) --"Therions" monsters protection local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetRange(LOCATION_MZONE) e2:SetTarget(function(_,c) return c:IsSetCard(SET_THERION) and c:IsFaceup() end) e2:SetCondition(s.indcon) e2:SetValue(aux.indoval) c:RegisterEffect(e2) --Equipped monster gains ATK local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsSetCard(SET_THERION) end) e3:SetValue(700) c:RegisterEffect(e3) --Equipped monster gains effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(function(e,c) return c==e:GetHandler():GetEquipTarget() and c:IsSetCard(SET_THERION) end) e4:SetLabelObject(e2) c:RegisterEffect(e4) end s.listed_series={SET_THERION} function s.eqfilter(c) return c:IsMonster() and (c:IsSetCard(SET_THERION) or c:IsRace(RACE_PSYCHIC)) end function s.eqval(ec,c,tp) return ec:IsControler(tp) and s.eqfilter(ec) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc) and not chkc:IsForbidden() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsRelateToEffect(e) and tc:IsMonster() and not tc:IsForbidden() then c:EquipByEffectAndLimitRegister(e,tp,tc) end end function s.indcon(e) return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil,TYPE_EQUIP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can activate this card the turn it was Set, by banishing 1 face-up "Maliss" monster you control. Special Summon 1 "Maliss" monster from your Deck, or if your opponent controls 3 or more cards, you can Special Summon 1 "Maliss" Link Monster from your Extra Deck instead. For the rest of this turn, that Summoned monster cannot attack and neither player can activate its effects. You can only activate 1 "Maliss <C> TB-11" per turn.
--M∀LICE<C>TB-11 --Maliss <C> TB-11 --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Maliss" monster from your Deck 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:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Can be activated the turn it was Set by banishing 1 face-up "Maliss" monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e2:SetValue(function(e) e:SetLabel(1) end) e2:SetCondition(function(e) local tp=e:GetHandlerPlayer() local loc=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>=3 and (LOCATION_DECK|LOCATION_EXTRA) or LOCATION_DECK return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_MZONE,0,1,nil,loc,e,tp) end) c:RegisterEffect(e2) e1:SetLabelObject(e2) --Workaround: Unaffected by other EFFECT_TRAP_ACT_IN_SET_TURN effects while the field is full local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_IMMUNE_EFFECT) e3:SetCondition(function(e) local tp=e:GetHandlerPlayer() local loc=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>=3 and (LOCATION_DECK|LOCATION_EXTRA) or LOCATION_DECK return not Duel.IsExistingMatchingCard(s.spfilter,tp,loc,0,1,nil,e,tp) end) e3:SetValue(function(e,te) return te:GetCode()==EFFECT_TRAP_ACT_IN_SET_TURN and te~=e2 end) c:RegisterEffect(e3) end s.listed_series={SET_MALISS} function s.spcostfilter(c,loc,e,tp) return c:IsFaceup() and c:IsSetCard(SET_MALISS) and c:IsAbleToRemove(tp) and Duel.IsExistingMatchingCard(s.spfilter,tp,loc,0,1,nil,e,tp,c) end function s.spfilter(c,e,tp,mc,ignore_zone_chk) if not (c:IsMonster() and c:IsSetCard(SET_MALISS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)) then return false end if mc or not ignore_zone_chk then if c:IsLocation(LOCATION_EXTRA) then return c:IsType(TYPE_LINK) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 else return Duel.GetMZoneCount(tp,mc)>0 end end return true end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) local label_obj=e:GetLabelObject() if chk==0 then label_obj:SetLabel(0) return true end if label_obj:GetLabel()>0 then label_obj:SetLabel(0) local loc=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>=3 and (LOCATION_DECK|LOCATION_EXTRA) or LOCATION_DECK Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_MZONE,0,1,1,nil,loc,e,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ignore_zone_chk=e:GetHandler():IsStatus(STATUS_SET_TURN) and e:GetLabel()==100 e:SetLabel(0) local loc=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>=3 and (LOCATION_DECK|LOCATION_EXTRA) or LOCATION_DECK return Duel.IsExistingMatchingCard(s.spfilter,tp,loc,0,1,nil,e,tp,nil,ignore_zone_chk) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local loc=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>=3 and (LOCATION_DECK|LOCATION_EXTRA) or LOCATION_DECK Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,loc,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then local tc=g:GetFirst() --Cannot attack local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) --Cannot activate its effects local e2=e1:Clone() e2:SetDescription(3302) e2:SetCode(EFFECT_CANNOT_TRIGGER) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: Target the attacking monster; negate the attack, and 1 face-up LIGHT monster you control gains ATK equal to that target's ATK, until your next End Phase.
--光子化 --Lumenize local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) 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.IsTurnPlayer(1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=Duel.GetAttacker() if chkc then return chkc==tg end if chk==0 then return tg:IsOnField() and tg:IsCanBeEffectTarget(e) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.SetTargetCard(tg) end function s.filter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.NegateAttack() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) local ac=g:GetFirst() if ac then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetAttack()) e1:SetReset(RESETS_STANDARD_PHASE_END,2) ac:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card on the field is destroyed and sent to the GY: For the rest of this turn, you take no battle damage.
--ハネクリボー --Winged Kuriboh local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.con) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.con(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_DESTROY) end function s.op(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetTargetRange(1,0) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ FIRE Effect Monsters If this card is Link Summoned using "Salamangreat Raging Phoenix" as material: You can add 1 "Salamangreat" card from your Deck to your hand. If a face-up FIRE monster(s) you control is destroyed by battle or card effect while this card is in your GY: You can target 1 of those monsters; Special Summon this card, and if you do, this card gains ATK equal to that monster's ATK. You can only use each effect of "Salamangreat Raging Phoenix" once per turn.
--転生炎獣レイジング・フェニックス --Salamangreat Raging Phoenix --Scripted by Satella local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() aux.EnableCheckReincarnation(c) --Link Summon procedure Link.AddProcedure(c,s.matfilter,2) --Add 1 "Salamangreat" card from your Deck to your hand 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_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special Summon itself local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_SALAMANGREAT} function s.matfilter(c,scard,sumtype,tp) return c:IsType(TYPE_EFFECT,scard,sumtype,tp) and c:IsAttribute(ATTRIBUTE_FIRE,scard,sumtype,tp) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReincarnationSummoned() and c:IsLinkSummoned() end function s.thfilter(c) return c:IsSetCard(SET_SALAMANGREAT) 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,c) 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.cfilter(c,e,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and (c:GetPreviousAttributeOnField()&ATTRIBUTE_FIRE)==ATTRIBUTE_FIRE and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsCanBeEffectTarget(e) and c:GetAttack()>0 and not c:IsType(TYPE_TOKEN) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter,1,nil,e,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return eg:IsContains(chkc) and s.cfilter(chkc,e,tp) end local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and eg:IsExists(s.cfilter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT) local tg=eg:FilterSelect(tp,s.cfilter,1,1,nil,e,tp) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,tp,tg:GetFirst():GetAttack()) 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)>0 then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Red-Eyes" monster you control; equip this card to it. It can make up to 2 attacks on monsters during each Battle Phase. You can send this Equip Card to the GY, then target 1 Effect Monster on the field; equip that target to the monster this card was equipped to, and if you do, while a monster is equipped to it by this effect, its ATK/DEF become equal to the original ATK/DEF of that equipped monster.
--鎖付き真紅眼牙 --Red-Eyes Fang with Chain local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --sand to grave and equip local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCondition(s.descon) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_RED_EYES} function s.filter(c) return c:IsSetCard(SET_RED_EYES) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return s.filter(chkc) and chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return 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) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_EXTRA_ATTACK_MONSTER) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(s.eqlimit) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) else c:CancelToGrave(false) end end function s.eqlimit(e,c) return c:IsSetCard(SET_RED_EYES) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetEquipTarget() and aux.StatChangeDamageStepCondition() end function s.descost(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.desfilter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ec=e:GetLabelObject() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.desfilter(chkc) and chkc~=ec end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler():GetEquipTarget()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,ec) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetLabelObject() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if ec and ec:IsLocation(LOCATION_MZONE) and ec:IsFaceup() then Duel.Equip(tp,tc,ec) --Atk local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(tc:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) --Def if not tc:IsOriginalType(TYPE_LINK) then local e2=Effect.CreateEffect(tc) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_SET_DEFENSE) e2:SetValue(tc:GetDefense()) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end --Equip limit local e3=Effect.CreateEffect(tc) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(s.eqlimit2) e3:SetReset(RESET_EVENT|RESETS_STANDARD) e3:SetLabelObject(ec) tc:RegisterEffect(e3) else Duel.SendtoGrave(tc,REASON_RULE) end end end function s.eqlimit2(e,c) return c==e:GetLabelObject() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster(s) with 1000 or less ATK is Summoned: Banish that monster(s) with 1000 or less ATK, then your opponent banishes all cards with the same name as that card(s) from their hand and Deck.
--連鎖除外 --Chain Disappearance local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.activate) 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) end function s.filter(c) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:GetAttack()<=1000 and c:IsAbleToRemove() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return eg:IsExists(s.filter,1,nil) end local g=eg:Filter(s.filter,nil) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.efilter(c,e) return c:IsFaceup() and c:IsAttackBelow(1000) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetTargetCards(e):Filter(s.efilter,nil) if #sg==0 or Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)==0 then return end local rg=Group.CreateGroup() for tc in sg:Iter() do if tc:IsLocation(LOCATION_REMOVED) then local tpe=tc:GetType() if (tpe&TYPE_TOKEN)==0 then rg:Merge(Duel.GetMatchingGroup(Card.IsCode,tp,0,LOCATION_DECK|LOCATION_HAND,nil,tc:GetCode())) end end end if #rg>0 then Duel.BreakEffect() Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a monster that is not a "Burning Abyss" monster, destroy this card. You can only use 1 of these effects of "Cir, Malebranche of the Burning Abyss" per turn, and only once that turn. ● If you control no Spell/Trap Cards: You can Special Summon this card from your hand. ● If this card is sent to the Graveyard: You can target 1 "Burning Abyss" monster in your Graveyard, except "Cir, Malebranche of the Burning Abyss"; Special Summon it.
--彼岸の悪鬼 ガトルホッグ --Cir, Malebranche of the Burning Abyss local s,id=GetID() function s.initial_effect(c) --self destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SELF_DESTROY) e1:SetCondition(s.sdcon) 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_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.sscon) e2:SetTarget(s.sstg) e2:SetOperation(s.ssop) c:RegisterEffect(e2) --spsummon 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_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,id) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_BURNING_ABYSS} s.listed_names={id} function s.sdfilter(c) return not c:IsFaceup() or not c:IsSetCard(SET_BURNING_ABYSS) end function s.sdcon(e) return Duel.IsExistingMatchingCard(s.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.filter(c) return c:IsSpellTrap() end function s.sscon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.sstg(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.ssop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BURNING_ABYSS) 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 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:
1 Rock monster in your GY + 1 Level 7 or higher monster Must first be Special Summoned with "Fossil Fusion". While you control this Fusion Summoned card, all monsters your opponent controls lose ATK equal to their original DEF. This card can make up to 3 attacks on monsters during each Battle Phase. When this card destroys an opponent's monster by battle: You can inflict 1000 damage to your opponent.
--古生代化石マシン スカルコンボイ --Fossil Machine Skull Convoy --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Susion summon procedure Fusion.AddProcMix(c,true,true,s.ffilter,aux.FilterBoolFunctionEx(Card.IsLevelAbove,7)) --Must be properly summoned before reviving c:EnableReviveLimit() --Clock Lizard check Auxiliary.addLizardCheck(c) --Must first be special summoned with "Fossil Fusion" local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetRange(LOCATION_EXTRA) e0:SetValue(aux.FossilLimit) c:RegisterEffect(e0) --Opponent's monsters loses ATK equal to their original DEF 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:SetCondition(s.condition) e1:SetValue(s.atkval) c:RegisterEffect(e1) --Can make 3 attacks on monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_EXTRA_ATTACK_MONSTER) e2:SetValue(2) c:RegisterEffect(e2) --Inflict 1000 damage after destroying a monster by battle local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCondition(aux.bdocon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end --Specifically lists "Fossil Fusion" s.listed_names={CARD_FOSSIL_FUSION} --Check for a rock monster in your GY function s.ffilter(c,fc,sumtype,tp) return c:IsRace(RACE_ROCK) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) end --If fusion summoned function s.condition(e) return e:GetHandler():IsFusionSummoned() end --Get original DEF function s.atkval(e,c) local val=math.max(c:GetBaseDefense(),0) return val*-1 end --Activation legality 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(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end --Inflict 1000 damage after destroying a monster by battle 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) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 card from your hand to the GY; add 1 Level 4 or lower Cyberse monster from your Deck to your hand. You can only activate 1 "Cynet Mining" per turn.
--サイバネット・マイニング --Cynet Mining --scripted by Larry126 --Substitute ID local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.filter(c) return c:IsRace(RACE_CYBERSE) and c:IsLevelBelow(4) 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.activate(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:
Destroy all tokens on the field. Increase your Life Points by the number of tokens destroyed x 800 points.
--トークン収穫祭 --Token Thanksgiving local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,TYPE_TOKEN) end local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,nil,TYPE_TOKEN) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,#g*800) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,nil,TYPE_TOKEN) local ct=Duel.Destroy(g,REASON_EFFECT) Duel.Recover(tp,ct*800,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 face-up "Naturia" monster you control. Its ATK becomes 3000, and its effects are negated, until the End Phase.
--ガオドレイクのタテガミ --Leodrake's Mane local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE) 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 s.listed_series={SET_NATURIA} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_NATURIA) 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) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,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 tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(3000) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a card(s) is banished from the hand and/or field to activate a monster effect (except during the Damage Step): You can apply 1 of the following effects based on 1 of the card types banished. ● Monster: Negate the effects of 1 face-up Spell/Trap on the field until the end of this turn. ● Spell: Draw 2 cards. ● Trap: Banish 1 monster on the field. If this card is banished to activate a monster effect: You can add 1 of your other banished cards to your hand. You can only use each effect of "Shadow Severing Strike" once per turn.
--断影烈破 --Shadow Severing Strike --scripted by Naim 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) --Apply 1 of the following effects based on 1 of the card types banished local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_CUSTOM+id) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) e1:SetLabel(0) c:RegisterEffect(e1) --Register cards banished local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1a:SetCode(EVENT_REMOVE) e1a:SetRange(LOCATION_SZONE) e1a:SetLabelObject(e1) e1a:SetOperation(s.regop) c:RegisterEffect(e1a) e1:SetLabelObject(e1a) --Add 1 of your other banished cards to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_REMOVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsMonsterEffect() end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.regfilter(c) return c:IsFaceup() and c:IsPreviousLocation(LOCATION_HAND|LOCATION_ONFIELD) and c:IsReason(REASON_COST) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if not e:GetLabelObject():CheckCountLimit(tp) then return end if not (re and re:IsActivated() and re:IsMonsterEffect()) then return false end local og=eg:Filter(s.regfilter,nil) if #og>0 then local types=0 for tc in og:Iter() do types=types|tc:GetMainCardType() end local label=e:GetLabel() e:SetLabel(label|types) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local types=e:GetLabelObject():GetLabel()>0 and e:GetLabelObject():GetLabel() or e:GetLabel() local b1=types&TYPE_MONSTER>0 and Duel.IsExistingMatchingCard(Card.IsNegatableSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) local b2=types&TYPE_SPELL>0 and Duel.IsPlayerCanDraw(tp,2) local b3=types&TYPE_TRAP>0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) e:GetLabelObject():SetLabel(0) e:SetLabel(types) if chk==0 then return (b1 or b2 or b3) end local cat=0 if types&TYPE_MONSTER>0 then cat=cat|CATEGORY_DISABLE Duel.SetPossibleOperationInfo(0,CATEGORY_DISABLE,nil,1,PLAYER_ALL,LOCATION_ONFIELD) end if types&TYPE_SPELL>0 then Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end if types&TYPE_TRAP>0 then cat=cat|CATEGORY_REMOVE local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) end e:SetCategory(cat) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local types=e:GetLabel() local b1=types&TYPE_MONSTER>0 and Duel.IsExistingMatchingCard(Card.IsNegatableSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) local b2=types&TYPE_SPELL>0 and Duel.IsPlayerCanDraw(tp,2) local b3=types&TYPE_TRAP>0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) if not (b1 or b2 or b3) then return end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}, {b3,aux.Stringid(id,4)}) if op==1 then --Negate the effects of 1 face-up Spell/Trap on the field until the end of this turn Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local tc=Duel.SelectMatchingCard(tp,Card.IsNegatableSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil):GetFirst() if tc then Duel.HintSelection(tc) tc:NegateEffects(e:GetHandler(),RESET_PHASE|PHASE_END) end elseif op==2 then --Draw 2 cards Duel.Draw(tp,2,REASON_EFFECT) elseif op==3 then --Banish 1 monster on the field Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_REMOVED,0,1,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_REMOVED) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local exc=c:IsRelateToEffect(e) and c or nil Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToHand,tp,LOCATION_REMOVED,0,1,1,exc) 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:
Once per turn, you can select 1 face-up Tuner monster on the field. The selected monster's name is treated as "Genex Controller" until the End Phase.
--A・ジェネクス・リモート --Genex Ally Remote local s,id=GetID() function s.initial_effect(c) --cos local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.costg) e1:SetOperation(s.cosop) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_TUNER) end function s.costg(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.cosop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(68505803) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Synchro Monster your opponent controls; Special Summon 1 Synchro Monster that is 1 Level higher than it from your Extra Deck, but it cannot activate its effects this turn. You can only activate 1 "Synchro Transcend" per turn.
--シンクロ・トランセンド --Synchro Transcend --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Special summon 1 synchro monster from extra deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) end function s.opfilter(c,e,tp) return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and Duel.IsExistingMatchingCard(s.tpfilter,tp,LOCATION_EXTRA,0,1,nil,c:GetLevel(),e,tp) end function s.tpfilter(c,lv,e,tp) return c:IsType(TYPE_SYNCHRO) and c:IsLevel(lv+1) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 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 chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.opfilter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.opfilter,tp,0,LOCATION_MZONE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.opfilter,tp,0,LOCATION_MZONE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.tpfilter,tp,LOCATION_EXTRA,0,1,1,nil,tc:GetLevel(),e,tp):GetFirst() if sg and Duel.SpecialSummonStep(sg,0,tp,tp,false,false,POS_FACEUP) then --Cannot activate its effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3302) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) sg:RegisterEffect(e1) end Duel.SpecialSummonComplete() 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 Tributing 1 "Flower Cardian" monster, except "Flower Cardian Peony with Butterfly". If this card is Special Summoned: Draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, look at the top 3 cards of your opponent's Deck, then place them all on the top or bottom of the Deck in any order. Otherwise, send the drawn card to the GY. If this card on the field is used as Synchro Material, you can treat it and all other Synchro Materials (that have a Level) as Level 2 monsters. * The above text is unofficial and describes the card's functionality in the OCG.
--花札衛-牡丹に蝶- --Flower Cardian Peony with Butterfly local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Must first be Special Summoned (from your hand) by Tributing 1 "Flower Cardian" monster, except "Flower Cardian Peony with Butterfly" 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.selfspcon) e0:SetTarget(s.selfsptg) e0:SetOperation(s.selfspop) c:RegisterEffect(e0) --Draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, look at the top 3 cards of your opponent's Deck, then place them all on the top or bottom of the Deck in any order local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --When this card is used as Synchro Material, you can treat it and all other Synchro Materials (that have a Level) as Level 2 monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SYNCHRO_MATERIAL_CUSTOM) e2:SetOperation(s.synop) c:RegisterEffect(e2) end s.listed_series={SET_FLOWER_CARDIAN} s.listed_names={id} function s.selfspfilter(c) return c:IsSetCard(SET_FLOWER_CARDIAN) and not c:IsCode(id) end function s.selfspcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.CheckReleaseGroup(tp,s.selfspfilter,1,false,1,true,c,tp,nil,false,nil) end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local g=Duel.SelectReleaseGroup(tp,s.selfspfilter,1,1,false,true,true,c,nil,nil,false,nil) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.selfspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST) g:DeleteGroup() end function s.drtg(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) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)>0 then local dc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,dc) if dc:IsSetCard(SET_FLOWER_CARDIAN) and dc:IsMonster() then local deck_ct=Duel.GetFieldGroupCount(1-tp,LOCATION_DECK,0) local ct=math.min(deck_ct,3) if ct==0 then Duel.ShuffleHand(tp) return end Duel.BreakEffect() local g=Duel.GetDecktopGroup(1-tp,ct) Duel.ConfirmCards(tp,g) local op=0 if deck_ct>3 then op=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3)) end Duel.SortDecktop(tp,1-tp,ct) if op==1 then Duel.MoveToDeckBottom(ct,1-tp) end else Duel.BreakEffect() Duel.SendtoGrave(dc,REASON_EFFECT) end Duel.ShuffleHand(tp) end end function s.synop(e,tg,ntg,sg,lv,sc,tp) local res=sg:CheckWithSumEqual(Card.GetSynchroLevel,lv,#sg,#sg,sc) or sg:CheckWithSumEqual(function() return 2 end,lv,#sg,#sg) return res,true end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Turn the top card of your opponent's Deck face-up, then your opponent shuffles their Deck. When your opponent draws the face-up card, immediately send it to the Graveyard.
--墓場からの誘い --Grave Lure local s,id=GetID() function s.initial_effect(c) Duel.EnableGlobalFlag(GLOBALFLAG_DECK_REVERSE_CHECK) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>0 end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmDecktop(1-tp,1) local g=Duel.GetDecktopGroup(1-tp,1) if #g>0 then local tc=g:GetFirst() Duel.ShuffleDeck(1-tp) tc:ReverseInDeck() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_DRAW) e1:SetOperation(s.tgop) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOHAND)) tc:RegisterEffect(e1) end end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can discard 1 "Gishki" monster to target 1 face-up card your opponent controls; shuffle that target into the Deck.
--イビリチュア・ソウルオーガ --Evigishki Soul Ogre local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --return to deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GISHKI} function s.costfilter(c) return c:IsSetCard(SET_GISHKI) and c:IsMonster() and c:IsDiscardable() 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_COST|REASON_DISCARD) end function s.filter(c) return c:IsFaceup() and c:IsAbleToDeck() 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.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.operation(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:
You cannot Summon the turn you activate this card. Activate at the end of the Damage Step, if a Spellcaster-Type monster you control attacked and destroyed an opponent's monster by battle. That monster can attack again (immediately).
--未来王の予言 --Enlightenment local s,id=GetID() function s.initial_effect(c) --chain attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return tc:IsControler(tp) and tc:IsRace(RACE_SPELLCASTER) and tc:CanChainAttack() and tc:IsStatus(STATUS_OPPO_BATTLE) end 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) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SUMMON) Duel.RegisterEffect(e2,tp) local e3=e1: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.operation(e,tp,eg,ep,ev,re,r,rp) Duel.ChainAttack() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
At the end of the Damage Step, if this card battled a Warrior or Spellcaster monster: Destroy that monster.
--龍骨鬼 --Ryu Kokki 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_DAMAGE_STEP_END) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local t=Duel.GetAttackTarget() if ev==1 then t=Duel.GetAttacker() end e:SetLabelObject(t) return t and t:IsRace(RACE_SPELLCASTER|RACE_WARRIOR) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetLabelObject():IsRelateToBattle() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetLabelObject(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsRelateToBattle() then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 5 or higher monsters Cannot be used as Link Material. This Link Summoned card is unaffected by other monsters' effects. You can only use each of the following effects of "World Gears of Theurlogical Demiurgy" once per turn. ● During your Main Phase, if you control this card that was Link Summoned using 3 monsters that had 3 different Types and Attributes on the field: You can destroy all other cards on the field. ● If your opponent Special Summons a monster(s) from the Extra Deck (except during the Damage Step): You can Special Summon 1 "World Legacy" monster from your Deck.
--星神器デミウルギア --World Gears of Theurlogical Demiurgy --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunction(Card.IsLevelAbove,5),3,3) --cannot link material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --immune local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.econ) e2:SetValue(s.efilter) c:RegisterEffect(e2) --material check local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_MATERIAL_CHECK) e3:SetValue(s.matcheck) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,id) e4:SetCondition(s.descon) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_SPSUMMON_SUCCESS) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1,{id,1}) e5:SetCondition(s.spcon) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) c:RegisterEffect(e5) end s.listed_series={SET_WORLD_LEGACY} function s.econ(e) return e:GetHandler():IsLinkSummoned() end function s.efilter(e,re) return re:IsMonsterEffect() and re:GetOwner()~=e:GetOwner() end function s.matcheck(e,c) local g=c:GetMaterial() local tp=c:GetControler() if g:GetClassCount(Card.GetRace,c,SUMMON_TYPE_LINK,tp)==3 and g:GetClassCount(Card.GetAttribute,c,SUMMON_TYPE_LINK,tp)==3 then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~(RESET_TOFIELD|RESET_LEAVE|RESET_TEMP_REMOVE),EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.spcfilter(c,tp) return c:IsSummonLocation(LOCATION_EXTRA) and not c:IsSummonPlayer(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spcfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_WORLD_LEGACY) 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) 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:
Send 1 "Therion" card, except "Therion Charge", or 1 "Endless Engine Argyro System" from your hand or your face-up Spell & Trap Zone to the GY; draw 2 cards. You can only activate 1 "Therion Charge" per turn.
--セリオンズ・チャージ --Therion Charge --scripted by pyrQ 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:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) 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_names={CARD_ARGYRO_SYSTEM,id} s.listed_series={SET_THERION} function s.cfilter(c) return ((c:IsFaceup() and c:GetSequence()<5) or c:IsLocation(LOCATION_HAND)) and c:IsAbleToGraveAsCost() and ((c:IsSetCard(SET_THERION) and not c:IsCode(id)) or c:IsCode(CARD_ARGYRO_SYSTEM)) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_SZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_SZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.target(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 function s.activate(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:
1 Zombie-Type Tuner + 1 or more non-Tuner Zombie-Type monsters Once per turn, during either player's turn: You can target 1 of your banished Zombie-Type monsters; shuffle it into the Deck, and if you do, change to Defense Position all monsters your opponent controls with ATK less than or equal to that monster's. If this card is banished: You can target 1 face-up monster your opponent controls; it loses 500 ATK. You can only Special Summon "Shiranui Samuraisaga(s)" once per turn.
--刀神-不知火 --Shiranui Samuraisaga local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_ZOMBIE),1,1,Synchro.NonTunerEx(Card.IsRace,RACE_ZOMBIE),1,99) c:EnableReviveLimit() --pos local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_REMOVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.filter(c,tp) local atk=c:GetAttack() return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and atk>=0 and c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.posfilter,tp,0,LOCATION_MZONE,1,nil,atk) end function s.posfilter(c,atk) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsCanChangePosition() and c:IsAttackBelow(atk) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.filter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,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 Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then local g=Duel.GetMatchingGroup(s.posfilter,tp,0,LOCATION_MZONE,nil,tc:GetAttack()) Duel.ChangePosition(g,POS_FACEUP_DEFENSE) end 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_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) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(-500) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) is Special Summoned from the Extra Deck (except during the Damage Step): You can Tribute this card; send that monster(s) to the GY. You can only use each of the following effects of "World Legacy - "World Chalice"" once per turn. ● If this face-up Normal Summoned/Set card leaves the field: You can Special Summon 2 "World Chalice" monsters from your Deck, except "World Legacy - "World Chalice"". ● During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY; add 1 "World Legacy" card from your Deck to your hand.
--星遺物-『星杯』 --World Legacy - "World Chalice" local s,id=GetID() function s.initial_effect(c) --send to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.tgcon) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) 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_LEAVE_FIELD) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(aux.exccon) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_WORLD_CHALICE,SET_WORLD_LEGACY} s.listed_names={id} function s.tgfilter(c) return (c:GetSummonLocation()&LOCATION_EXTRA)==LOCATION_EXTRA and c:IsLocation(LOCATION_MZONE) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tgfilter,1,nil) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=eg:Filter(s.tgfilter,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.tgfilter,nil) if #g>0 then Duel.SendtoGrave(g,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:IsPreviousPosition(POS_FACEUP) and not c:IsSpecialSummoned() end function s.spfilter(c,e,tp) return c:IsSetCard(SET_WORLD_CHALICE) 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) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) 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 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) if #g==2 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c) return c:IsSetCard(SET_WORLD_LEGACY) 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:
Special Summon 1 "Nemleria" monster or 1 Level 10 Beast monster from your hand or Deck in Defense Position, but return it to the hand during the End Phase. You can banish this card from your GY, then target 1 face-up monster your opponent controls; it loses 100 ATK/DEF for each of your currently face-down banished cards, until the end of this turn. You can only use each effect of "Nemleria Louve" once per turn.
--ネムレリア・ルーヴ --Nemleria Louve --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Nemleria" monster or 1 Level 10 Beast from your hand or Deck 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Reduce the ATK/DEF of 1 opponent's monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.StatChangeDamageStepCondition) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.atkdeftg) e2:SetOperation(s.atkdefop) c:RegisterEffect(e2) end s.listed_series={SET_NEMLERIA} function s.spfilter(c,e,tp) return (c:IsSetCard(SET_NEMLERIA) or (c:IsLevel(10) and c:IsRace(RACE_BEAST))) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_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_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|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 sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Return it to the hand during the End Phase aux.DelayedOperation(sc,PHASE_END,id,e,tp,function(ag) Duel.SendtoHand(ag,nil,REASON_EFFECT) end,nil,0,0,aux.Stringid(id,2)) end end function s.atkdeftg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_REMOVED,0,1,nil) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.atkdefop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end local ct=Duel.GetMatchingGroupCount(Card.IsFacedown,tp,LOCATION_REMOVED,0,nil) if ct==0 then return end --Reduce ATK/DEF local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*-100) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Take 1 "Amazoness" card from your Deck, except "Amazoness Call", and either add it to your hand or send it to the GY. During your Main Phase: You can banish this card from your GY, then target 1 "Amazoness" monster you control; this turn, that monster can attack all monsters your opponent controls, once each, also other monsters you control cannot attack. You can only activate 1 "Amazoness Call" per turn.
--アマゾネスの叫声 --Amazoness Call local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) 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:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --multi attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_AMAZONESS} s.listed_names={id} function s.filter(c) return c:IsSetCard(SET_AMAZONESS) and not c:IsCode(id) and (c:IsAbleToHand() or c:IsAbleToGrave()) 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 end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() aux.ToHandOrElse(tc,tp) end function s.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_AMAZONESS) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) 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_TARGET) 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) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ATTACK_ALL) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_ATTACK) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.ftarget) e2:SetLabel(tc:GetFieldID()) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.ftarget(e,c) return e:GetLabel()~=c:GetFieldID() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Number" Xyz Monsters with the same name and Rank Once per turn: You can detach 1 material from this card; this card gains ATK equal to the combined Ranks of all Xyz Monsters currently on the field x 1000, until the end of your opponent's turn. When this card is destroyed by card effect: You can destroy as many monsters on the field as possible (min. 1), then, if any player(s) has a Spell/Trap in their GY, they Set 1 of them to their field. When an opponent's monster declares an attack while this card is in your GY and you have no cards in your hand or field: You can Special Summon this card. * The above text is unofficial and describes the card's functionality in the OCG.
--No.100 ヌメロン・ドラゴン --Number 100: Numeron Dragon local s,id=GetID() function s.initial_effect(c) --Xyz Summon Xyz.AddProcedure(c,s.xyzfilter,nil,2,nil,nil,nil,nil,false,s.xyzcheck) c:EnableReviveLimit() --Gains ATK equal to the combined Ranks of all Xyz monsters on the field x 1000 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Destroy as many monsters on the field as possible and each player sets 1 Spell/Trap from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(function(e) return e:GetHandler():IsReason(REASON_EFFECT) end) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Special Summon this card from the 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_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.xyz_number=100 function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and c:IsSetCard(SET_NUMBER,xyz,sumtype,tp) end function s.xyzcheck(g,tp,xyz) local mg=g:Filter(function(c) return not c:IsHasEffect(EFFECT_EQUIP_SPELL_XYZ_MAT) end,nil) return mg:GetClassCount(Card.GetRank)==1 and mg:GetClassCount(Card.GetCode)==1 end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:GetRank()>0 end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsFaceup() or not c:IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local atk=g:GetSum(Card.GetRank) if atk<=0 then return end --Gain 1000 ATK per Rank local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk*1000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END|RESET_OPPO_TURN) c:RegisterEffect(e1) end function s.setfilter(c,tp) return c:IsSpellTrap() and c:IsSSetable(false,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,2,PLAYER_ALL,LOCATION_GRAVE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if Duel.Destroy(g,REASON_EFFECT)==0 then return end Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local tc1=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SET) local tc2=Duel.SelectMatchingCard(1-tp,s.setfilter,1-tp,LOCATION_GRAVE,0,1,1,nil,1-tp):GetFirst() if (tc1 and tc1:IsHasEffect(EFFECT_NECRO_VALLEY)) or (tc2 and tc2:IsHasEffect(EFFECT_NECRO_VALLEY)) then return end if tc1 then Duel.SSet(tp,tc1) end if tc2 then Duel.SSet(1-tp,tc2) end end function s.spfilter(c) return not c:IsStatus(STATUS_LEAVE_CONFIRMED) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==nil and not Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,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,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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an Xyz Monster you control is destroyed by battle: Pay 1000 Life Points; you reveal 1 Xyz Monster from the Extra Deck with a Rank less than or equal to that destroyed monster's, and so can your opponent (simultaneously). The player who revealed the monster with lower ATK takes damage equal to the difference between the revealed monsters' ATK's. If the opponent doesn't reveal a monster, inflict damage to your opponent equal to the ATK of your revealed monster.
--エクシーズ熱戦!! --Xyz Xtreme !! local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsType(TYPE_XYZ) and c:IsPreviousControler(tp) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if s.cfilter(tc,tp) then e:SetLabel(tc:GetRank()) return true end tc=eg:GetNext() if tc and s.cfilter(tc,tp) then e:SetLabel(tc:GetRank()) return true end return false end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsRankBelow,tp,LOCATION_EXTRA,0,1,nil,e:GetLabel()) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local tc1=Duel.SelectMatchingCard(tp,Card.IsRankBelow,tp,LOCATION_EXTRA,0,1,1,nil,e:GetLabel()):GetFirst() Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(id,0)) local tc2=Duel.SelectMatchingCard(1-tp,Card.IsRankBelow,1-tp,LOCATION_EXTRA,0,1,1,nil,e:GetLabel()):GetFirst() if tc1 and tc2 then Duel.ConfirmCards(1-tp,tc1) Duel.ConfirmCards(tp,tc2) local atk1=tc1:GetAttack() local atk2=tc2:GetAttack() if atk1>atk2 then Duel.Damage(1-tp,atk1-atk2,REASON_EFFECT) elseif atk1<atk2 then Duel.Damage(tp,atk2-atk1,REASON_EFFECT) end elseif tc1 then Duel.ConfirmCards(1-tp,tc1) Duel.Damage(1-tp,tc1:GetAttack(),REASON_EFFECT) elseif tc2 then Duel.ConfirmCards(tp,tc2) Duel.Damage(tp,tc2:GetAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate 1 of the following effects. For the rest of this turn after this card resolves, you cannot Special Summon monsters, except WATER monsters. ● Target 1 non-Link "Marincess" monster in your GY; Special Summon it. ● If "Marincess Battle Ocean" is in your Field Zone: Special Summon 1 "Marincess" monster from your Deck. You can only activate 1 "Marincess Dive" per turn.
--海晶乙女の潜逅 --Marincess Dive --Scripted by Neo Yuno 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={91027843} s.listed_series={SET_MARINCESS} --Special Summon from GY filter function s.spgfilter(c,e,tp) return c:IsSetCard(SET_MARINCESS) and not c:IsType(TYPE_LINK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end --Special Summon from Deck filter function s.spdfilter(c,e,tp) return c:IsSetCard(SET_MARINCESS) and c:IsMonster() 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 chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spgfilter(chkc,e,tp) end local b1=Duel.IsExistingTarget(s.spgfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) local b2=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,91027843),tp,LOCATION_FZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.spdfilter,tp,LOCATION_DECK,0,1,nil,e,tp) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (b1 or b2) end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,0)}, {b2,aux.Stringid(id,1)}) e:SetLabel(op) if op==1 then e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spgfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) else e:SetProperty(0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if op==1 and ft>0 then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end elseif op==2 and ft>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spdfilter,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 if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end --Cannot Special Summon, except WATER monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsAttribute(ATTRIBUTE_WATER) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Your opponent cannot Special Summon for the rest of this turn.
--ガード・ドッグ --Guard Dog local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetTargetRange(0,1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control 2 or more "Lightsworn" monsters with the same Type but different names: Banish 2 "Lightsworn" monsters from your GY, then target 2 cards on the field; banish them. If this card is sent from the Deck to the GY by a "Lightsworn" monster's effect: You can Special Summon 1 "Lightsworn" monster from your hand.
--トワイライト・イレイザー --Twilight Eraser local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_LIGHTSWORN} function s.filter1(c,tp) return c:IsFaceup() and c:IsSetCard(SET_LIGHTSWORN) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_MZONE,0,1,c,c:GetRace(),c:GetCode()) end function s.filter2(c,race,code) return c:IsFaceup() and c:IsSetCard(SET_LIGHTSWORN) and c:IsRace(race) and not c:IsCode(code) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_MZONE,0,1,nil,tp) end function s.cfilter(c) return c:IsMonster() and c:IsSetCard(SET_LIGHTSWORN) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.rescon(sg,e,tp,mg) sg:AddCard(e:GetHandler()) local res=Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,sg) sg:RemoveCard(e:GetHandler()) return res end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) local cg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chk==0 then return aux.SelectUnselectGroup(cg,e,tp,2,2,s.rescon,0) end local rg=aux.SelectUnselectGroup(cg,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() and chkc:IsAbleToRemove() end if chk==0 then local label=e:GetLabel() e:SetLabel(0) return label==1 or Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.activate(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 function s.spcon(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.spfilter(c,e,tp) return c:IsSetCard(SET_LIGHTSWORN) 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_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(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 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) end end