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:
[ Pendulum Effect ] When you Pendulum Summon a Zombie-Type monster(s): You can activate this effect; it cannot be destroyed by battle or card effects this turn. ---------------------------------------- [ Monster Effect ] If this card destroys a monster by battle: You can target 1 Pendulum Monster in your Graveyard; add it to your hand.
--P・M・キャプチャー --P.M. Captor local s,id=GetID() function s.initial_effect(c) --Enable pendulum summon Pendulum.AddProcedure(c) --When a zombie monster(s) is pendulum summoned, make it unable to be destroyed by battle or card effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_PZONE) e2:SetCondition(s.indcon) e2:SetTarget(s.indtg) e2:SetOperation(s.indop) c:RegisterEffect(e2) --Add 1 pendulum monster from GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end function s.cfilter(c,e,tp) return c:IsRace(RACE_ZOMBIE) and c:IsSummonPlayer(tp) and c:IsPendulumSummoned() and (not e or c:IsRelateToEffect(e)) end function s.indcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,nil,tp) end function s.indtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(eg) end function s.indop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=eg:Filter(s.cfilter,nil,e,tp) local tc=g:GetFirst() for tc in aux.Next(g) do --Cannot be destroyed by battle or card effects local e1=Effect.CreateEffect(c) e1:SetDescription(3008) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e2) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRelateToBattle() and c:GetBattleTarget():IsMonster() end function s.filter(c) return c:IsType(TYPE_PENDULUM) and c:IsAbleToHand() end function s.thtg(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) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can send this card from your hand to the GY, then target 1 FIRE monster you control; that target gains 400 ATK.
--フレムベル・ベビー --Flamvell Baby local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCost(s.atcost) e1:SetTarget(s.attg) e1:SetOperation(s.atop) c:RegisterEffect(e1) end function s.atcost(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.filter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_FIRE) end function s.attg(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.atop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(400) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 "Dual Avatar" monster from your Deck to your hand. If you control a "Dual Avatar" Effect Monster: You can Special Summon 1 "Dual Avatar Spirit Token" (Warrior/LIGHT/Level 2/ATK 0/DEF 0), also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Fusion Monsters. You can only use this effect of "Perfect Sync - A-Un" once per turn. You can only activate 1 "Perfect Sync - A-Un" per turn.
--阿吽の呼吸 --Perfect Sync - A-Un --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetDescription(aux.Stringid(id,0)) 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) --Special Summon Token local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_DUAL_AVATAR} s.listed_names={TOKEN_DUAL_AVATAR_SPIRIT} function s.thfilter(c) return c:IsSetCard(SET_DUAL_AVATAR) and c:IsMonster() 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.thfilter,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 function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_DUAL_AVATAR) and c:IsType(TYPE_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_DUAL_AVATAR_SPIRIT,SET_DUAL_AVATAR,TYPES_TOKEN,0,0,2,RACE_WARRIOR,ATTRIBUTE_LIGHT) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local ge1=Effect.CreateEffect(e:GetHandler()) ge1:SetType(EFFECT_TYPE_FIELD) ge1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) ge1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) ge1:SetDescription(aux.Stringid(id,2)) ge1:SetTargetRange(1,0) ge1:SetTarget(s.splimit) ge1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(ge1,tp) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_DUAL_AVATAR_SPIRIT,SET_DUAL_AVATAR,TYPES_TOKEN,0,0,2,RACE_WARRIOR,ATTRIBUTE_LIGHT) then return end local token=Duel.CreateToken(tp,TOKEN_DUAL_AVATAR_SPIRIT) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not c:IsOriginalType(TYPE_FUSION) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned while a Synchro Monster is on the field: You can Special Summon 1 "Resonator" monster from your Deck, except "Chain Resonator".
--チェーン・リゾネーター --Chain Resonator 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:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_RESONATOR} s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_SYNCHRO),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end function s.filter(c,e,tp) return c:IsSetCard(SET_RESONATOR) 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 Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Mokey Mokey" + "Mokey Mokey" + "Mokey Mokey" When this card is removed from the field, you can Special Summon as many "Mokey Mokey" as possible from your Graveyard.
--キング・もけもけ --Mokey Mokey King local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixN(c,true,true,27288416,3) --Special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_LEAVE_FIELD) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={27288416} function s.spfilter(c,e,tp) return c:IsCode(27288416) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local tg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp) if ft<=0 or #tg==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=tg:Select(tp,ft,ft,nil) 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 Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 1 face-up Trap your opponent controls to the GY.
--トラップ・イーター --Trap Eater local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --spsummon proc local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.spfilter(c) return c:IsFaceup() and c:IsTrap() and c:IsAbleToGraveAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(s.spfilter,tp,0,LOCATION_ONFIELD,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 and aux.SelectUnselectGroup(g,e,tp,1,1,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,0,LOCATION_ONFIELD,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_TOGRAVE,aux.ChkfMMZ(1),nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_COST) g:DeleteGroup() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute Summon this card by Tributing 1 monster. This card is unaffected by the activated effects of Special Summoned monsters if it was Normal Summoned/Set. If this card is Normal or Special Summoned: You can target 1 Beast, Beast-Warrior, or Winged Beast monster in your GY; add it to your hand, and if you do, this card loses 700 ATK. Once per turn, during your End Phase: You can make this card gain 700 ATK.
--百戦王 ベヒーモス --Behemoth the King of a Hundred Battles --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Normal Summon/Set this card with 1 tribute local e1a=aux.AddNormalSummonProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0)) local e1b=aux.AddNormalSetProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0)) --Add 1 Beast, Beast-Warrior, or Winged Beast monster to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Unaffected by the effects of Special Summoned monsters local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetCode(EFFECT_IMMUNE_EFFECT) e4:SetRange(LOCATION_MZONE) e4:SetCondition(function(e) return e:GetHandler():IsNormalSummoned() end) e4:SetValue(s.imnval) c:RegisterEffect(e4) --Gain 700 ATK local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_ATKCHANGE) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_PHASE+PHASE_END) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) e5:SetOperation(s.atkop) c:RegisterEffect(e5) end function s.thfilter(c) return c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,-700) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,tc) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end c:UpdateAttack(-700) end end function s.imnval(e,te) return te:IsMonsterEffect() and te:IsActivated() and te:GetHandler():IsSpecialSummoned() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then c:UpdateAttack(700) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: You can add 1 "Green Gadget" from your Deck to your hand.
--イエロー・ガジェット --Yellow Gadget local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_names={41172955} function s.filter(c) return c:IsCode(41172955) and c:IsAbleToHand() end function s.tg(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.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstMatchingCard(s.filter,tp,LOCATION_DECK,0,nil) if tc then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the Graveyard, destroy all face-down and non-FIRE monsters.
--ヘルプロミネンス --Firestorm Prominence local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return (c:IsFacedown() or c:GetAttribute()~=ATTRIBUTE_FIRE) end function s.target(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) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Summoned: You can target 1 "tellarknight" monster on the field; it gains 500 ATK, but send it to the Graveyard during the End Phase. You can only use this effect of "Satellarknight Rigel" once per turn.
--星因士 リゲル --Satellarknight Rigel local s,id=GetID() function s.initial_effect(c) --Make 1 "tellarknight" monster on the field gain 500 ATK, but send it to the GY during the End Phase local e1a=Effect.CreateEffect(c) e1a:SetDescription(aux.Stringid(id,0)) e1a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1a:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1a:SetCode(EVENT_SUMMON_SUCCESS) e1a:SetCountLimit(1,id) e1a:SetTarget(s.atktg) e1a:SetOperation(s.atkop) c:RegisterEffect(e1a) local e1b=e1a:Clone() e1b:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e1b) local e1c=e1a:Clone() e1c:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e1c) end s.listed_series={SET_TELLARKNIGHT} function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsSetCard(SET_TELLARKNIGHT) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_TELLARKNIGHT),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_TELLARKNIGHT),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if tc:IsFaceup() then --It gains 500 ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end --Send it to the GY during the End Phase aux.DelayedOperation(tc,PHASE_END,id,e,tp, function(dg) Duel.SendtoGrave(dg,REASON_EFFECT) end, nil,0,1,aux.Stringid(id,1),aux.Stringid(id,2) ) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name is also treated as "Neo-Spacian Glow Moss". This card cannot be Special Summoned except with "NEX". When this card attacks or is attacked, draw 1 card. Reveal that card, and based on its type apply the proper effect: ● Monster: End the Battle Phase. ● Spell: You can change this card's attack to a direct attack. ● Trap: This monster is changed to Defense Position.
--N・ティンクル・モス --Neo-Spacian Twinkle Moss local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --Activate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.activate) c:RegisterEffect(e3) --add code local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetCode(EFFECT_ADD_CODE) e4:SetValue(17732278) c:RegisterEffect(e4) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler()==Duel.GetAttacker() or e:GetHandler()==Duel.GetAttackTarget() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 end e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE,0,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.Draw(tp,1,REASON_EFFECT)==0 then return end local tc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,tc) if tc:IsMonster() then Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) elseif tc:IsSpell() then if c==Duel.GetAttacker() and not c:IsHasEffect(EFFECT_CANNOT_DIRECT_ATTACK) and c:IsRelateToEffect(e) and c:IsFaceup() and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.ChangeAttackTarget(nil) end else if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end Duel.ShuffleHand(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 "Ritual Beast" card from your hand, then target 1 card your opponent controls; return it to the hand. You can only Special Summon "Spiritual Beast Pettlephin(s)" once per turn.
--精霊獣 ペトルフィン --Spiritual Beast Pettlephin local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --tohand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_RITUAL_BEAST} function s.filter(c) return c:IsSetCard(SET_RITUAL_BEAST) and c:IsAbleToRemoveAsCost() end function s.cost(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.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.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:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by shuffling all monsters in your Graveyard into the Deck, and cannot be Special Summoned by other ways. When this card declares an attack: Send 1 monster from your hand or Deck to the Graveyard. This card gains 1000 ATK for each Normal Monster in your Graveyard. If this face-up card would leave the field, banish it instead. If there are 5 different "Forbidden One" cards in your Graveyard that were sent there by this card's effect, you win the Duel.
--究極封印神エクゾディオス --Exodius the Ultimate Forbidden Lord local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summoning condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --Special Summon procedure local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Send 1 monster from your hand or Deck to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) --Gains 1000 ATK for each Normal Monster in your GY local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_MZONE) e4:SetValue(function(e,c) return Duel.GetMatchingGroupCount(Card.IsType,c:GetControler(),LOCATION_GRAVE,0,nil,TYPE_NORMAL)*1000 end) c:RegisterEffect(e4) --Banish itself it it leaves the field local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e5:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e5:SetCondition(function(e) return e:GetHandler():IsFaceup() end) e5:SetValue(LOCATION_REMOVED) c:RegisterEffect(e5) end s.listed_series={SET_FORBIDDEN_ONE} function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_GRAVE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 and #g==g:FilterCount(Card.IsAbleToDeckOrExtraAsCost,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_GRAVE,0,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.winfilter(c,rc) return c:IsRelateToCard(rc) and c:IsSetCard(SET_FORBIDDEN_ONE) and c:IsMonster() end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectMatchingCard(tp,aux.AND(Card.IsMonster,Card.IsAbleToGrave),tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil):GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then tc:CreateRelation(c,RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) --Win condition if not (c:IsFaceup() and c:IsOriginalCode(id) and c:IsControler(tp)) then return end local g=Duel.GetMatchingGroup(s.winfilter,tp,LOCATION_GRAVE,0,nil,c) if s.winfilter(tc,c) and g:GetClassCount(Card.GetCode)==5 then Duel.Win(tp,WIN_REASON_EXODIUS) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Mardel, Generaider Boss of Light". If this card is Normal or Special Summoned: You can add 1 "Generaider" card or 1 Plant monster from your Deck to your hand, except "Mardel, Generaider Boss of Light". You can only use this effect of "Mardel, Generaider Boss of Light" once per turn.
--光の王 マルデル --Mardel, Generaider Boss of Light --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --search 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+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_GENERAIDER} function s.thfilter(c) return not c:IsCode(id) and (c:IsRace(RACE_PLANT) or c:IsSetCard(SET_GENERAIDER)) 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:
You can target 1 Continuous Spell/Trap you control; send it to the GY, and if you do, add 1 "Ancient Warriors" Spell/Trap with a different name from your GY to your hand. If your other "Ancient Warriors" monster's effect is activated (except during the Damage Step): You can target 1 Spell/Trap your opponent controls; destroy it. You can only use each effect of "Ancient Warriors - Eccentric Lu Jing" once per turn.
--戦華の妙-魯敬 --Ancient Warriors - Eccentric Lu Jing local s,id=GetID() function s.initial_effect(c) --Add a Spell/Trap with different name from GY to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Destroy 1 Spell/Trap local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_ANCIENT_WARRIORS} function s.gvfilter(c,tp) return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS) and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,c:GetCode()) end function s.thfilter(c,code) return c:IsSetCard(SET_ANCIENT_WARRIORS) and c:IsAbleToHand() and c:IsSpellTrap() and not c:IsCode(code) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.gvfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.gvfilter,tp,LOCATION_ONFIELD,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.gvfilter,tp,LOCATION_ONFIELD,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,tc:GetCode()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=re:GetHandler() return re:IsMonsterEffect() and rc~=c and rc:IsSetCard(SET_ANCIENT_WARRIORS) and rc:IsControler(tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Raidraptor" monster: Target 1 face-up monster your opponent controls, or if you control a "Raidraptor" Xyz Monster, you can target 1 face-up card your opponent controls; negate that card's effects until the end of this turn. You can banish this card from your GY, then target 1 of your "Raidraptor" monsters that is banished or in your GY; add it to your hand. You can only use 1 "Raidraptor - Glorious Bright" effect per turn, and only once that turn.
--RR-グロリアス・ブライト --Raidraptor - Glorious Bright --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Negate the effects of 1 monster or card the opponent controls local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_RAIDRAPTOR),tp,LOCATION_MZONE,0,1,nil) end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Add 1 of your "Raidraptor" monsters that is banished or in your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_RAIDRAPTOR} function s.xyzfilter(c) return c:IsType(TYPE_XYZ) and c:IsSetCard(SET_RAIDRAPTOR) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local xyz_chk=Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) local neg_filter=xyz_chk and Card.IsNegatable or Card.IsNegatableMonster local loc=xyz_chk and LOCATION_ONFIELD or LOCATION_MZONE if chkc then return chkc:IsLocation(loc) and chkc:IsControler(1-tp) and neg_filter(chkc) end if chk==0 then return Duel.IsExistingTarget(neg_filter,tp,0,loc,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,neg_filter,tp,0,loc,1,1,nil) e:SetLabel(xyz_chk and 1 or 0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Negate its effects tc:NegateEffects(e:GetHandler(),RESET_PHASE|PHASE_END,e:GetLabel()==1) end end function s.thfilter(c) return c:IsMonster() and c:IsSetCard(SET_RAIDRAPTOR) and c:IsFaceup() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and chkc:IsControler(tp) 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:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Fusion Monster(s) is Fusion Summoned to your field (except during the Damage Step): You can target 1 of those monsters; Special Summon 1 "Lunalight Token" (Beast-Warrior/DARK/Level 4/ATK 2000/DEF 2000) to your opponent's field, also that target gains 500 ATK for each monster your opponent controls (if any) (even if this card leaves the field). During your Main Phase: You can banish this card from your GY; send 1 card from your hand to the GY, and if you do, Special Summon 1 "Lunalight" monster from your Deck. You can only use this effect of "Lunalight Serenade Dance" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--月光小夜曲舞踊 --Lunalight Serenade Dance --scripted by Logical Nonsense 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) --Special Summon 1 "Lunalight Token" and icrease the ATK of a monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.tkcon) e2:SetTarget(s.tktg) e2:SetOperation(s.tkop) c:RegisterEffect(e2) --Send 1 card from the hand to the GY and Special Summon 1 "Lunalight" monster from the Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id) e3:SetCost(Cost.SelfBanish) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={13935002} --Lunalight Token s.listed_series={SET_LUNALIGHT} --If fusion monster(s) were fusion summoned to your field function s.cfilter(c,e,tp) return c:IsFaceup() and c:IsType(TYPE_FUSION) and c:IsControler(tp) and c:IsFusionSummoned() and c:IsCanBeEffectTarget(e) end --If it ever happened function s.tkcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,e,tp) end --Activation legality function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return eg:IsContains(chkc) and s.cfilter(chkc,e,tp) end if chk==0 then return eg:IsExists(s.cfilter,1,nil,e,tp) and Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,SET_LUNALIGHT,TYPES_TOKEN,2000,2000,1,RACE_BEASTWARRIOR,ATTRIBUTE_DARK,POS_FACEUP,1-tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=eg:FilterSelect(tp,s.cfilter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end --Performing the effect of ATK gain and token special summoned to opponent's field function s.tkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,SET_LUNALIGHT,TYPES_TOKEN,2000,2000,1,RACE_BEASTWARRIOR,ATTRIBUTE_DARK,POS_FACEUP,1-tp) then local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummon(token,0,tp,1-tp,false,false,POS_FACEUP) end local atk=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)*500 if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Increase ATK tc:UpdateAttack(atk,RESET_EVENT|RESETS_STANDARD,e:GetHandler()) end end --Check if current phase is main phase function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and Duel.IsMainPhase() end --Check for "Lunalight" monster function s.spfilter(c,e,tp) return c:IsSetCard(SET_LUNALIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE,tp)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end --Performing the effect of sending a card from hand to GY, and then special summmoning 1 "Lunalight" monster from deck function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tgc=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,1,nil):GetFirst() if tgc and Duel.SendtoGrave(tgc,REASON_EFFECT)>0 and tgc:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE,tp)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this monster is Normal Summoned, Flip Summoned or Special Summoned, increase your Life Points by 1000 points. When this card is destroyed and sent to the Graveyard, you take 2000 points of damage.
--グラナドラ --Granadora local s,id=GetID() function s.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.rectg) e1:SetOperation(s.recop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_TO_GRAVE) e4:SetCondition(s.damcon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1000) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is attacked by a monster, after damage calculation: Return that monster to the hand.
--幻影の壁 --Wall of Illusion local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) 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 Duel.GetAttackTarget()==e:GetHandler() and not Duel.GetAttacker():IsStatus(STATUS_BATTLE_DESTROYED) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,Duel.GetAttacker(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if not a:IsRelateToBattle() then return end Duel.SendtoHand(a,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card in Defense Position as an Effect Monster (Machine/EARTH/Level 4/ATK 0/DEF 2000). (This card is also still a Trap.) While you control "Green Gadget", "Red Gadget", and "Yellow Gadget", this card gains 3000 ATK.
--機動砦 ストロング・ホールド --Stronghold the Moving Fortress 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_names={41172955,86445415,13839120} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) then return end c:AddMonsterAttribute(TYPE_TRAP+TYPE_EFFECT) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP_DEFENSE) c:AddMonsterAttributeComplete() --update attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(3000) e1:SetCondition(s.atkcon) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) Duel.SpecialSummonComplete() end function s.atkcon(e) local tp=e:GetHandlerPlayer() return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,41172955),tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,86445415),tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,13839120),tp,LOCATION_ONFIELD,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by having exactly 5 WATER monsters in your GY. If this card is Special Summoned: Discard 2 random cards from your opponent's hand (or their entire hand, if less than 2). You can only use this effect of "Moulinglacia the Elemental Lord" once per turn. If this face-up card leaves the field, skip the Battle Phase of your next turn.
--氷霊神ムーラングレイス --Moulinglacia the Elemental Lord local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) c:RegisterEffect(e2) --handes local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_HANDES) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,id) e3:SetTarget(s.hdtg) e3:SetOperation(s.hdop) c:RegisterEffect(e3) --leave local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_LEAVE_FIELD_P) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e4:SetOperation(s.leaveop) c:RegisterEffect(e4) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetMatchingGroupCount(Card.IsAttribute,c:GetControler(),LOCATION_GRAVE,0,nil,ATTRIBUTE_WATER)==5 end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,2) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,2) Duel.SendtoGrave(g,REASON_EFFECT|REASON_DISCARD) end function s.leaveop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsFacedown() then return end local effp=e:GetHandler():GetControler() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SKIP_BP) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) if Duel.GetTurnPlayer()==effp then e1:SetLabel(Duel.GetTurnCount()) e1:SetCondition(s.skipcon) e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,2) else e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,1) end Duel.RegisterEffect(e1,effp) end function s.skipcon(e) return Duel.GetTurnCount()~=e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent controls a monster: Discard 1 Zombie monster; Special Summon 1 "Shiranui" monster with a different name from your Deck or GY, also you cannot Special Summon monsters, except Zombie monsters, for the rest of this turn after this card resolves. You can only activate 1 "Ghost Meets Girl - A Shiranui's Story" per turn.
--逢華妖麗譚-不知火語 --Ghost Meets Girl - A Shiranui's Story --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Shiranui" monster from your Deck or GY 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:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SHIRANUI} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) return true end function s.costfilter(c,e,tp) return c:IsDiscardable() and c:IsRace(RACE_ZOMBIE) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp,c:GetCode()) end function s.spfilter(c,e,tp,code) return c:IsSetCard(SET_SHIRANUI) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(code) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) e:SetLabelObject(g:GetFirst()) Duel.SendtoGrave(g,REASON_COST|REASON_DISCARD) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local dc=e:GetLabelObject() local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp,dc:GetCode()) if #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end 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(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsRace(RACE_ZOMBIE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 WIND Spellcaster-Type monster, then target 1 monster your opponent controls; shuffle it into the Deck.
--マジェスペクター・ストーム --Majespecter Storm local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) 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) return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_WIND) end function s.filter(c,e) return c:IsAbleToDeck() and c:IsCanBeEffectTarget(e) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) 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(1-tp) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.activate(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:
Cannot be Special Summoned. While you control no Set Spells/Traps, neither player can Set Spells/Traps nor activate Spell/Trap Cards that are Set on the field.
--電光-雪花- --Denko Sekka local s,id=GetID() function s.initial_effect(c) --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) c:RegisterEffect(e1) --cannot set local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SSET) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(1,1) e2:SetCondition(s.effcon) c:RegisterEffect(e2) --cannot trigger local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_TRIGGER) e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e3:SetTarget(s.distg) e3:SetCondition(s.effcon) c:RegisterEffect(e3) end function s.effcon(e) return not Duel.IsExistingMatchingCard(Card.IsFacedown,e:GetHandlerPlayer(),LOCATION_SZONE,0,1,nil) end function s.distg(e,c) return c:IsFacedown() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Beast-Type Tuner + 1 or more non-Tuner monsters If this card is destroyed by your opponent's card (either by battle or by card effect), both players send the top 7 cards of their Deck to the Graveyard.
--ボルテック・バイコーン --Voltic Bicorn local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_BEAST),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --deckdes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_DESTROYED) e1:SetCondition(s.ddcon) e1:SetTarget(s.ddtg) e1:SetOperation(s.ddop) c:RegisterEffect(e1) end function s.ddcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.ddtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,PLAYER_ALL,7) end function s.ddop(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,7,REASON_EFFECT) Duel.DiscardDeck(1-tp,7,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 "Iron Core of Koa'ki Meiru" in your hand and discard 1 "Koa'ki Meiru" monster to activate this card. Draw 2 cards.
--コア濃度圧縮 --Core Compression 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_KOAKI_MEIRU} s.listed_names={36623431} function s.cfilter1(c) return c:IsCode(36623431) and not c:IsPublic() end function s.cfilter2(c) return c:IsMonster() and c:IsSetCard(SET_KOAKI_MEIRU) and c:IsDiscardable() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter1,tp,LOCATION_HAND,0,1,nil) and Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g1=Duel.SelectMatchingCard(tp,s.cfilter1,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local g2=Duel.SelectMatchingCard(tp,s.cfilter2,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g2,REASON_COST|REASON_DISCARD) Duel.ShuffleHand(tp) 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:
When this card is activated: Shuffle all "Madolche" monsters in your GY (if any) into the Deck. All "Madolche" monsters on the field gain 500 ATK/DEF. If a monster(s) in your GY would be returned to the Deck by the effect of a "Madolche" monster, you can add it to your hand instead. * The above text is unofficial and describes the card's functionality in the OCG.
--マドルチェ・シャトー --Madolche Chateau local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_MADOLCHE)) e2:SetValue(500) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_FZONE) e4:SetCode(EFFECT_SEND_REPLACE) e4:SetTarget(s.reptg) e4:SetValue(s.repval) c:RegisterEffect(e4) end s.listed_series={SET_MADOLCHE} function s.tdfilter(c) return c:IsMonster() and c:IsSetCard(SET_MADOLCHE) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_GRAVE,0,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,LOCATION_GRAVE) 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(aux.NecroValleyFilter(s.tdfilter),tp,LOCATION_GRAVE,0,nil) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.repfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_GRAVE) and c:GetDestination()==LOCATION_DECK and c:IsMonster() and c:IsAbleToHand() end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return (r&REASON_EFFECT)~=0 and re and re:IsMonsterEffect() and re:GetHandler():IsSetCard(SET_MADOLCHE) and eg:IsExists(s.repfilter,1,nil,tp) end if Duel.SelectYesNo(tp,aux.Stringid(id,0)) then local c=e:GetHandler() local g=eg:Filter(s.repfilter,nil,tp) local ct=#g if ct>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) g=g:Select(tp,1,ct,nil) end for tc in g:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TO_DECK_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(LOCATION_HAND) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) tc:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TOHAND)|RESET_PHASE|PHASE_END,0,1) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_TO_HAND) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) return true else return false end end function s.repval(e,c) return false end function s.thfilter(c) return c:GetFlagEffect(id)~=0 end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.thfilter,1,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.thfilter,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 WIND Xyz Monster you control that has no Xyz Materials. While that monster is on the field, negate the effects of all face-up monsters on the field. When that monster leaves the field, destroy this card. During the End Phase of the turn this card was activated: Attach this card to that monster as an Xyz Material.
--ムーンダンスの儀式 --Moon Dance Ritual local s,id=GetID() function s.initial_effect(c) aux.AddPersistentProcedure(c,0,s.filter,nil,nil,nil,TIMINGS_CHECK_MONSTER_E,nil,nil,nil,s.activate) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetCondition(s.matcon) e1:SetOperation(s.matop) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.disable) e2:SetCondition(s.discon) e2:SetCode(EFFECT_DISABLE) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCondition(s.descon) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:GetOverlayCount()==0 and c:IsAttribute(ATTRIBUTE_WIND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,0) end end function s.disable(e,c) return c:IsType(TYPE_EFFECT) end function s.discon(e) return e:GetHandler():GetFirstCardTarget()~=nil end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function s.matcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFirstCardTarget()~=nil and e:GetHandler():GetFlagEffect(id)>0 end function s.matop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetFirstCardTarget() if tc then Duel.Overlay(tc,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Dragon Synchro Monster + 1 Warrior monster Must first be Fusion Summoned. Once per turn: You can target 1 Dragon Synchro Monster in the GY; banish that target, and if you do, until the End Phase, this card's name becomes that monster's, and replace this effect with that monster's original effects. While this card is in Attack Position, your opponent takes any effect damage you would have taken from their card effects, instead.
--波動竜騎士 ドラゴエクィテス --Dragon Knight Draco-Equiste local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,s.ffilter,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WARRIOR)) --special summon condition 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(s.splimit) c:RegisterEffect(e0) --copy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --reflect damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_REFLECT_DAMAGE) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,0) e2:SetValue(s.refcon) c:RegisterEffect(e2) end s.miracle_synchro_fusion=true function s.splimit(e,se,sp,st) if e:GetHandler():IsLocation(LOCATION_EXTRA) then return (st&SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end return true end function s.refcon(e,re,val,r,rp,rc) return (r&REASON_EFFECT)~=0 and rp==1-e:GetHandler():GetControler() and e:GetHandler():IsAttackPos() end function s.ffilter(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(TYPE_SYNCHRO,fc,sumtype,tp) end function s.cpfilter(c) return c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.cpfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.cpfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.cpfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsFaceup() and tc and tc:IsRelateToEffect(e) then if Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)==1 then local code=tc:GetOriginalCode() local reset_flag=RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_END c:CopyEffect(code, reset_flag, 1) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(reset_flag) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(code) c:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Mathmech" monster in your GY; Special Summon it, and if you do, it gains 1000 ATK until the end of this turn. You can only activate 1 "Mathmech Equation" per turn.
--斬機方程式 --Mathmech Equation --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_MATHMECH} function s.spfilter(c,e,tp) return c:IsSetCard(SET_MATHMECH) 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,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1000) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 "Laval" monster from your Graveyard; inflict 1000 damage to your opponent. "Laval Judgment Lord" cannot declare an attack the turn this effect is activated.
--ラヴァルロード・ジャッジメント --Laval Judgment Lord local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.damcost) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end s.listed_series={SET_LAVAL} s.listed_names={id} function s.cfilter(c) return c:IsSetCard(SET_LAVAL) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.cfilter2(c) return c:IsCode(id) and c:GetAttackAnnouncedCount()>0 end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) and not Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetProperty(EFFECT_FLAG_OATH) e1:SetTarget(aux.TargetBoolFunction(Card.IsCode,id)) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) 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(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) 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:
Send 1 monster from your Deck to the GY, but for the rest of this turn, you cannot activate cards, or the effects of cards, with the same name the sent monster had in the GY. You can only activate 1 "Peaceful Burial" per turn.
--のどかな埋葬 --Peaceful Burial --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Send 1 monster 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,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) end function s.tgfilter(c) return 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.tgfilter,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) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then --Cannot activate cards or effects with the same name as sent monster local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetLabelObject(tc) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(3302) e2:SetProperty(EFFECT_FLAG_CLIENT_HINT) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_TRIGGER) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.aclimit(e,re,tp) local tc=e:GetLabelObject() return re:GetHandler():IsCode(tc:GetCode()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If both players have 3 or more cards in their hand: Each player places their entire hand on the bottom of the Deck in any order, also you lose LP equal to the total number of cards returned to the Deck by this effect x 300 (min. 1), then each player draws 5 cards. You can only activate 1 "Multiple Destruction" per turn.
--死なばもろとも --Multiple Destruction local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>=3 and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>=3 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,5) and Duel.IsPlayerCanDraw(1-tp,5) end local g=Duel.GetFieldGroup(tp,LOCATION_HAND,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,5) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_HAND,LOCATION_HAND)==0 then return end local p=tp local st=0 for i=1,2 do local sg=Duel.GetFieldGroup(p,LOCATION_HAND,0) Duel.SendtoDeck(sg,nil,SEQ_DECKBOTTOM,REASON_EFFECT) local og=Duel.GetOperatedGroup() local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK) if ct>0 then st=st+ct Duel.SortDeckbottom(p,p,ct) end p=1-p end local lp=Duel.GetLP(tp) Duel.SetLP(tp,lp-st*300) if Duel.GetLP(tp)>0 then Duel.BreakEffect() Duel.Draw(tp,5,REASON_EFFECT) Duel.Draw(1-tp,5,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster on the field; change that target to face-down Defense Position.
--月の書 --Book of Moon local s,id=GetID() function s.initial_effect(c) --Change 1 face-up monster on the field to face-down Defense Position local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION) 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(TIMING_END_PHASE,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMING_BATTLE_START|TIMING_BATTLE_PHASE|TIMINGS_CHECK_MONSTER_E) 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:IsCanTurnSet() end if chk==0 then return Duel.IsExistingTarget(Card.IsCanTurnSet,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,Card.IsCanTurnSet,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,POS_FACEDOWN_DEFENSE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsMonster() then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 Fusion Monster from your Extra Deck that lists exactly 2 monsters as material, including "Elemental HERO Neos", by sending those monsters from your hand, Deck, or field, ignoring its Summoning conditions. For the rest of this turn after this card resolves, you cannot Special Summon monsters. If a Fusion Monster(s) you control that lists "Elemental HERO Neos" as material would be destroyed by battle or card effect, or shuffled into the Extra Deck by its own effect, you can banish this card from your GY instead.
--ネオス・フュージョン --Neos Fusion --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.ListsCodeAsMaterial,CARD_NEOS),nil,s.fextra,nil,nil,s.stage2,2,0,nil,FUSPROC_NOTFUSION|FUSPROC_LISTEDMATS,nil,nil,nil,s.extratg) c:RegisterEffect(e1) --destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end s.listed_names={CARD_NEOS} function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToGrave),tp,LOCATION_DECK,0,nil) end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,2,tp,LOCATION_DECK) end function s.stage2(e,tc,tp,mg,chk) if chk==2 then 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(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_FUSION) and c:ListsCodeAsMaterial(CARD_NEOS) and not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT|REASON_BATTLE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card destroys an opponent's monster by battle: Special Summon 1 "Thunder Option Token" (Machine-Type/LIGHT/Level 4/ATK 1500/DEF 1500). This Token cannot be Tributed for a Tribute Summon.
--ブルーサンダーT45 --Blue Thunder T-45 local s,id=GetID() function s.initial_effect(c) --Special summon 1 token to your field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(aux.bdocon) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={14089429} 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,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,1500,1500,4,RACE_MACHINE,ATTRIBUTE_LIGHT) then local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) --Cannot be tributed for a tribute summon local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3304) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be used to Ritual Summon any "Black Luster Soldier" Ritual Monster. You must also Tribute monsters from your hand or field whose total Levels exactly equal 8. During your Main Phase, except the turn this card was sent to the GY: You can banish this card, 1 LIGHT monster, and 1 DARK monster from your GY; Special Summon 1 "Black Luster Soldier" Ritual Monster from your hand, ignoring its Summoning conditions. You can only use this effect of "Super Soldier Ritual" once per turn.
--超戦士の儀式 --Super Soldier Ritual local s,id=GetID() function s.initial_effect(c) Ritual.AddProcEqual(c,aux.FilterBoolFunction(Card.IsSetCard,SET_BLACK_LUSTER_SOLDIER),8) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(aux.exccon) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_BLACK_LUSTER_SOLDIER} function s.cfilter(c,att) return c:IsAttribute(att) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,ATTRIBUTE_LIGHT) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,ATTRIBUTE_DARK) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_LIGHT) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,ATTRIBUTE_DARK) g1:Merge(g2) g1:AddCard(e:GetHandler()) Duel.Remove(g1,POS_FACEUP,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BLACK_LUSTER_SOLDIER) and c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,0,tp,true,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,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If an "Odd-Eyes" card(s) you control is destroyed by battle or card effect: You can Special Summon 1 "Odd-Eyes" monster from your hand, Deck, or GY. You can only use this effect of "Odd-Eyes Arc Pendulum Dragon" once per turn. ---------------------------------------- [ Flavor Text ] Made from miracles, this valiant and beautiful dragon has gleaming eyes that reflect an arc drawn in the sky.
--オッドアイズ・アークペンデュラム・ドラゴン --Odd-Eyes Arc Pendulum Dragon local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_ODD_EYES} function s.cfilter(c,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousSetCard(SET_ODD_EYES) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ODD_EYES) 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|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All EARTH monsters you control are also treated as "Vernusylph" monsters. Once per turn, if you would discard a "Vernusylph" monster(s) and 1 card to activate the effect of that "Vernusylph" monster in your hand, you can discard only that "Vernusylph" monster(s) instead.
--春化精の花冠 --Vernusylph Corolla --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --EARTH monsters become "Vernusylph" monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_ADD_SETCODE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_EARTH)) e2:SetValue(SET_VERNUSYLPH) c:RegisterEffect(e2) --"Vernusylph" cost replacement local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(CARD_VERNUSYLPH_COROLLA) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_HAND,0) e3:SetCountLimit(1) e3:SetValue(s.repval) e3:SetOperation(s.repop) c:RegisterEffect(e3) end s.listed_series={SET_VERNUSYLPH} function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() return c:IsMonster() and c:IsSetCard(SET_VERNUSYLPH) and c:IsDiscardable() end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) local c=base:GetHandler() if #{Duel.GetPlayerEffect(tp,CARD_VERNUSYLPH_COROLLA)}>1 then Duel.HintSelection(c,true) end c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,nil,aux.Stringid(id,1)) Duel.SendtoGrave(e:GetHandler(),REASON_COST|REASON_DISCARD) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(Quick Effect): You can discard this card, then target 1 "HERO" monster on the field; it gains 2500 ATK until the end of this turn. (Quick Effect): You can discard 1 "HERO" monster; this card gains ATK equal to the discarded monster's ATK until the end of this turn. You can only use each effect of "Elemental HERO Honest Neos" once per turn.
--E・HERO オネスティ・ネオス --Elemental HERO Honest Neos local s,id=GetID() function s.initial_effect(c) --Make 1 "HERO" monster on the field gain 2500 ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(function() return not (Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated()) end) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.heroatktg) e1:SetOperation(s.heroatkop) c:RegisterEffect(e1) --Make this card gain ATK equal to the ATK of a "HERO" monster you discard local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function() return not (Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated()) end) e2:SetTarget(s.selfatkcost) e2:SetOperation(s.selfatkop) c:RegisterEffect(e2) end s.listed_series={SET_HERO} function s.heroatktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsSetCard(SET_HERO) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.heroatkop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Gains 2500 ATK until the end of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(2500) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.selfatkcostfilter(c) return c:IsSetCard(SET_HERO) and c:GetAttack()>0 and c:IsDiscardable() end function s.selfatkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.selfatkcostfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local sc=Duel.SelectMatchingCard(tp,s.selfatkcostfilter,tp,LOCATION_HAND,0,1,1,nil):GetFirst() e:SetLabel(sc:GetAttack()) Duel.SendtoGrave(sc,REASON_COST|REASON_DISCARD) end function s.selfatkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --Gains ATK equal to the discarded monster's ATK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabel()) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This monster cannot be Normal Summoned or Set. This card can only be Special Summoned by Tributing "Petit Moth" on the 4th of your turns after "Petit Moth" has been equipped with "Cocoon of Evolution".
--グレート・モス --Great Moth local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --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:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={40240595,58192742} function s.eqfilter(c) return c:IsCode(40240595) and c:GetTurnCounter()>=4 end function s.rfilter(c,ft,tp) return c:IsCode(58192742) and c:GetEquipGroup():IsExists(s.eqfilter,1,nil) end function s.spcon(e,c) if c==nil then return true end return Duel.CheckReleaseGroup(c:GetControler(),s.rfilter,1,false,1,true,c,c:GetControler(),nil,false,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,s.rfilter,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.spop(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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, if your "@Ignister" monster is attacked (Quick Effect): You can discard this card; you take no battle damage from that battle. When an "@Ignister" monster effect, or "A.I." Spell/Trap Card or effect, is activated that inflicts damage to your opponent, even during the Damage Step (Quick Effect): You can banish this card from your GY; double that damage inflicted to your opponent. You can only use each effect of "Donyoribo @Ignister" once per turn.
--ドンヨリボー@イグニスター --Donyoribo @Ignister --Scripted by Eerie Code, based on anime version by Larry126 local s,id=GetID() function s.initial_effect(c) --battle Damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfDiscard) e1:SetOperation(s.operation) c:RegisterEffect(e1) --double damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.damcon) e2:SetCost(Cost.SelfBanish) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_series={SET_IGNISTER,SET_AI} function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttackTarget() return tc and tc:IsControler(tp) and tc:IsSetCard(SET_IGNISTER) and Duel.GetBattleDamage(tp)>0 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_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if not ((re:IsMonsterEffect() and rc:IsSetCard(SET_IGNISTER)) or (re:IsSpellTrapEffect() and rc:IsSetCard(SET_AI))) then return false end local p=1-tp local e1=Duel.IsPlayerAffectedByEffect(p,EFFECT_REVERSE_DAMAGE) local e2=Duel.IsPlayerAffectedByEffect(p,EFFECT_REVERSE_RECOVER) local rd=e1 and not e2 local rr=not e1 and e2 local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE) if ex and (cp==p or p==PLAYER_ALL) and not rd and not Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_EFFECT_DAMAGE) then return true end ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER) if ex and (p==tp or p==PLAYER_ALL) and rr and not Duel.IsPlayerAffectedByEffect(p,EFFECT_NO_EFFECT_DAMAGE) then return true end return false end function s.damop(e,tp,eg,ep,ev,re,r,rp) local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CHANGE_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(0,1) e2:SetLabel(cid) e2:SetValue(s.damval) e2:SetReset(RESET_CHAIN) Duel.RegisterEffect(e2,tp) end function s.damval(e,re,val,r,rp,rc) local cc=Duel.GetCurrentChain() if cc==0 or r&REASON_EFFECT==0 then return val end local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if cid~=e:GetLabel() then return val end return val*2 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: Place 3 counters on it. Cannot be destroyed by battle. At the end of the Damage Step, if this card battled: Remove 1 counter from this card. If you cannot, destroy it.
--巨大戦艦 ビッグ・コア --B.E.S. Big Core local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x1f) --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.addct) e1:SetOperation(s.addc) c:RegisterEffect(e1) --battle indestructable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) c:RegisterEffect(e2) --remove counter local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetCondition(s.rctcon) e3:SetOperation(s.rctop) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DAMAGE_STEP_END) e4:SetCondition(s.descon) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end function s.addct(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,3,0,0x1f) end function s.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():AddCounter(0x1f,3) end end function s.rctcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetCounter(0x1f)~=0 end function s.rctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then c:RemoveCounter(tp,0x1f,1,REASON_EFFECT) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetCounter(0x1f)==0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then Duel.Destroy(c,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can send 1 "Lunalight" card from your hand to the GY, and if you do, draw 1 card. If this card is sent to the GY by a card effect: You can target 1 of your Level 4 or lower "Lunalight" monsters that is banished or in your GY, except "Lunalight Emerald Bird"; Special Summon it in Defense Position, but negate its effects. You can only use each effect of "Lunalight Emerald Bird" once per turn.
--月光翠鳥 --Lunalight Emerald Bird --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon 1 "Lunalight" monster 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+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_LUNALIGHT} function s.drfilter(c) return c:IsSetCard(SET_LUNALIGHT) and c:IsDiscardable(REASON_EFFECT) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(s.drfilter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(tp,s.drfilter,1,1,REASON_EFFECT,nil)~=0 then local ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_GRAVE) if ct>0 then Duel.Draw(tp,1,REASON_EFFECT) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end function s.spfilter(c,e,tp) return (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and c:IsLevelBelow(4) and c:IsSetCard(SET_LUNALIGHT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,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 c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) 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 Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 Spellcaster monsters Once per turn, when your opponent activates a Spell/Trap Card (Quick Effect): You can detach 1 material from this card; negate the activation, and if you do, destroy it.
--風紀宮司ノリト --Norito the Moral Leader local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),6,2) c:EnableReviveLimit() --Negate activation local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.discon) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end return rp==1-tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) 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:
Once per turn, if a monster is Special Summoned by the effect of an "Evoltile" monster (except during the Damage Step): You can target 1 card on the field; destroy that target.
--進化の代償 --Evo-Price 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) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.cfilter(c) local st=c:GetSummonType() return st>=(SUMMON_TYPE_SPECIAL+150) and st<(SUMMON_TYPE_SPECIAL+180) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return e:GetHandler():IsRelateToEffect(e) and not e:GetHandler():IsStatus(STATUS_CHAINING) and 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.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be used to Ritual Summon any "Nouvelles" Ritual Monster. You must also Tribute monsters from your hand or field whose total Levels equal or exceed the Level of the Ritual Monster you Ritual Summon. Then, if you Ritual Summoned "Confiras de Nouvelles", you can apply the following effect. ● Change all Defense Position monsters your opponent currently controls to Attack Position.
--Recette de Viande~肉料理のレシピ~ --Recette de Viande (Meat Recipe) --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Ritual Summon any "Nouvelles" monster local e1=Ritual.AddProcGreater({handler=c,filter=aux.FilterBoolFunction(Card.IsSetCard,SET_NOUVELLES), stage2=s.stage2,extratg=s.extratg}) e1:SetCategory(e1:GetCategory()|CATEGORY_POSITION) end s.listed_series={SET_NOUVELLES} s.listed_names={53618197} --Confiras de Nouvelles function s.posfilter(c) return c:IsDefensePos() and c:IsCanChangePosition() end function s.stage2(mat,e,tp,eg,ep,ev,re,r,rp,tc) if not tc:IsCode(53618197) then return end local g=Duel.GetMatchingGroup(s.posfilter,tp,0,LOCATION_MZONE,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.ChangePosition(g,0,0,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK) end end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.posfilter,tp,0,LOCATION_MZONE,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your LP are higher than your opponent's: You can Special Summon this card from your hand. If you gain LP: Target 1 non-Tuner Plant monster on the field; it is treated as a Tuner this turn. If this card is sent to the GY: You can gain 500 LP. You can only use each effect of "Aromage Laurel" once per turn.
--アロマージ-ローリエ --Aromage Laurel --Scripted by AlphaKretin 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:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --become tuner local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_RECOVER) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.tuncon) e2:SetTarget(s.tuntg) e2:SetOperation(s.tunop) c:RegisterEffect(e2) --remove local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_RECOVER) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.rectg) e3:SetOperation(s.recop) c:RegisterEffect(e3) end function s.spcon(e) local tp=e:GetHandlerPlayer() return Duel.GetLP(tp)>Duel.GetLP(1-tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.tuncon(e,tp,eg,ep,ev,re,r,rp) return ep==tp end function s.tunfilter(c) return c:IsFaceup() and c:IsRace(RACE_PLANT) and not c:IsType(TYPE_TUNER) end function s.tuntg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.tunfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) Duel.SelectTarget(tp,s.tunfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.tunop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(TYPE_TUNER) tc:RegisterEffect(e1) end end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card to draw and reveal 1 card. If that card is a Level 1 Monster Card, draw 1 more card. The effect of "Mystic Piper" can only be activated once per turn.
--ミスティック・パイパー --Mystic Piper local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfTribute) 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 Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.Draw(tp,1,REASON_EFFECT) if ct==0 then return end local dc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,dc) if dc:GetLevel()==1 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end Duel.ShuffleHand(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be used as material for an Xyz Summon, except for the Xyz Summon of a DARK monster. When this card is Normal Summoned: You can Special Summon 1 DARK "Vampire" monster from your hand or Deck, except "Shadow Vampire", but monsters you control cannot attack for the rest of this turn, except that Special Summoned monster.
--シャドウ・ヴァンパイア --Shadow Vampire 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) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e2:SetValue(s.xyzlimit) c:RegisterEffect(e2) end s.listed_series={SET_VAMPIRE} function s.filter(c,e,tp) return c:GetCode()~=id and c:IsSetCard(SET_VAMPIRE) and c:IsAttribute(ATTRIBUTE_DARK) 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.filter,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.filter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 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.ftarget) e1:SetLabel(tc:GetFieldID()) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end end function s.ftarget(e,c) return e:GetLabel()~=c:GetFieldID() end function s.xyzlimit(e,c) if not c then return false end return not c:IsAttribute(ATTRIBUTE_DARK) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you Special Summon 1 Ritual Monster (and no other cards) by a Spell Card or effect (except during the Damage Step): You can look at either player's Extra Deck, and send 1 monster from it to the GY. If you Special Summon 1 Fusion Monster (and no other cards) by a Spell Card or effect (except during the Damage Step): You can target that monster; for the rest of this turn, it gains ATK equal to its original ATK, also it can only attack Attack Position monsters your opponent controls. You can only use each effect of "Branded in Central Dogmatika" once per turn.
--烙印の命数 --Branded in Central Dogmatika --Scripted by Eerie Code 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) --Look at either Extra Deck and send 1 monster from it to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,0}) e2:SetCondition(s.condition(TYPE_RITUAL)) e2:SetTarget(s.gytg) e2:SetOperation(s.gyop) c:RegisterEffect(e2) --Increase the ATK of your Fusion Monster local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.condition(TYPE_FUSION)) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end function s.condition(typ) return function(e,tp,eg,ep,ev,re,r,rp) if #eg~=1 then return false end local c=eg:GetFirst() return c:IsFaceup() and c:IsType(typ) and c:IsSummonPlayer(tp) and re and re:IsSpellEffect() end end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_EXTRA,LOCATION_EXTRA)>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,PLAYER_ALL,LOCATION_EXTRA) end function s.gyop(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetFieldGroup(tp,LOCATION_EXTRA,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_EXTRA) if not e:GetHandler():IsRelateToEffect(e) or #g1+#g2==0 then return end local op=Duel.SelectEffect(tp, {#g1>0,aux.Stringid(id,2)}, {#g2>0,aux.Stringid(id,3)}) local g=(op==1) and g1 or g2 if op==2 then Duel.ConfirmCards(tp,g) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tg=g:FilterSelect(tp,aux.AND(Card.IsMonster,Card.IsAbleToGrave),1,1,nil) if #tg>0 then Duel.BreakEffect() Duel.SendtoGrave(tg,REASON_EFFECT) if op==2 then Duel.ShuffleExtra(1-tp) end end end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return eg:GetFirst():IsCanBeEffectTarget(e) end Duel.SetTargetCard(eg) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetBaseAttack()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) --Can only attack an opponent's Attack Position monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(s.atlimit) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end function s.atlimit(e,c) return not (c:IsAttackPos() and c:IsControler(1-e:GetHandler():GetControler())) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Bubbleman" + "Elemental HERO Avian" Must be Fusion Summoned. While you have any Set card(s) in your Spell & Trap Zone, this card can attack your opponent directly.
--E・HERO セイラーマン --Elemental HERO Mariner local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,79979666,21844576) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.fuslimit) c:RegisterEffect(e1) --direct attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DIRECT_ATTACK) e2:SetCondition(s.dacon) c:RegisterEffect(e2) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} function s.filter(c) return c:IsFacedown() and c:GetSequence()~=5 end function s.dacon(e) return Duel.IsExistingMatchingCard(s.filter,e:GetHandlerPlayer(),LOCATION_SZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 Dragon Normal Monster you control; equip this monster from your hand or field to that target. If a monster equipped with this card attacks a Defense Position monster, inflict piercing battle damage to your opponent. If a monster equipped with this card would be destroyed, destroy this card instead.
--暴風竜の防人 --Rider of the Storm Winds local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_PIERCE) c:RegisterEffect(e2) --destroy sub local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_DESTROY_SUBSTITUTE) e3:SetValue(1) c:RegisterEffect(e3) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsRelateToEffect(e) then Duel.SendtoGrave(c,REASON_EFFECT) return end Duel.Equip(tp,c,tc,true) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) end function s.eqlimit(e,c) return c==e:GetLabelObject() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your opponent's Standby Phase: Send 1 card from the top of their Deck to the Graveyard for each "Malice Ascendant" in your Graveyard. This card must be face-up on the field to activate and to resolve this effect.
--増幅する悪意 --Malice Ascendant local s,id=GetID() function s.initial_effect(c) --discard deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCategory(CATEGORY_DECKDES) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.discon) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetControler()~=tp or not c:IsRelateToEffect(e) or c:IsFacedown() then return end local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,id) if ct>0 then Duel.DiscardDeck(1-tp,ct,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card by removing from play any 2 Rock-Type monsters in your Graveyard. During your Standby Phase, remove from play 1 Rock-Type monster in your Graveyard, or send this card to the Graveyard. Halve the ATK and DEF of any monster that battles with this card.
--地球巨人 ガイア・プレート --Gaia Plate the Earth Giant 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:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atk/def down local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SET_ATTACK_FINAL) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.adcon) e2:SetTarget(s.adtg) e2:SetValue(s.atkval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_SET_DEFENSE_FINAL) e3:SetValue(s.defval) c:RegisterEffect(e3) --maintain local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetCode(EVENT_PHASE|PHASE_STANDBY) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.mtcon) e4:SetOperation(s.mtop) c:RegisterEffect(e4) end function s.filter(c) return c:IsRace(RACE_ROCK) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and #rg>1 and aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.adcon(e) return Duel.IsPhase(PHASE_DAMAGE_CAL) and e:GetHandler():GetBattleTarget() end function s.adtg(e,c) return c==e:GetHandler():GetBattleTarget() end function s.atkval(e,c) return c:GetAttack()/2 end function s.defval(e,c) return c:GetDefense()/2 end function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.mtop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) else Duel.SendtoGrave(e:GetHandler(),REASON_RULE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can flip this card into face-down Defense Position. When this card attacks an opponent's face-down Defense Position monster, this card's ATK becomes 2400 during damage calculation only.
--八つ手サソリ --8-Claws Scorpion local s,id=GetID() function s.initial_effect(c) --turn set local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --atk up local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetCondition(s.atkcon) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return c==Duel.GetAttacker() and bc and bc:GetBattlePosition()==POS_FACEDOWN_DEFENSE end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(2400) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Choose 1 "Nouvelles" Pendulum Monster and 1 "Patissciel" Pendulum Monster from your hand, Deck, and/or Extra Deck, and Special Summon both monsters, 1 to each field, also this turn, you cannot use monsters as material for a Fusion, Synchro, Xyz, or Link Summon, except "Nouvelles" and "Patissciel" monsters. During your Main Phase: You can banish this card from your GY, then target 1 face-up monster on the field; it gains 200 ATK for each "Recipe" card in the GYs. You can only use each effect of "Concours de Cuisine (Culinary Confrontation)" once per turn.
--Concours de Cuisine~菓冷なる料理対決~ --Concours de Cuisine (Culinary Confrontation) --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Nouvelles" Pendulum Monster and 1 "Patissciel" Pendulum Monster from your hand, Deck, and/or Extra 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,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Increase the ATK of a monster by 200 x the number of "Recipe" cards in the GYs local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) 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.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_NOUVELLES,SET_PATISSCIEL,SET_RECIPE} local locs=LOCATION_HAND|LOCATION_DECK|LOCATION_EXTRA function s.cfilter(c,archetyp) return c:IsSetCard(archetyp) and c:IsType(TYPE_PENDULUM) end function s.firstsummon(c,e,tp,sg) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ((not c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0) or Duel.GetLocationCountFromEx(tp,tp,nil,c)>0) and sg:IsExists(s.secondsummon,1,c,e,tp) --exclude 'c' end function s.secondsummon(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) and ((not c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0) or Duel.GetLocationCountFromEx(1-tp,tp,nil,c)>0) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsSetCard,nil,SET_PATISSCIEL)==1 and sg:FilterCount(Card.IsSetCard,nil,SET_NOUVELLES)==1 and sg:IsExists(s.firstsummon,1,nil,e,tp,sg) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g1=Duel.GetMatchingGroup(s.cfilter,tp,locs,0,nil,SET_NOUVELLES) local g2=Duel.GetMatchingGroup(s.cfilter,tp,locs,0,nil,SET_PATISSCIEL) local g=g1+g2 if chk==0 then return #g1>0 and #g2>0 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,locs) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end local c=e:GetHandler() --You cannot use monsters as material for a Fusion, Synchro, Xyz, or Link Summon, except "Nouvelles" and "Patissciel" monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_BE_MATERIAL) e1:SetTargetRange(LOCATION_ALL,LOCATION_ALL) e1:SetTarget(function(e,c) return not c:IsSetCard({SET_NOUVELLES,SET_PATISSCIEL}) end) e1:SetValue(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,2)) --Special Summon 1 "Nouvelles" monster and 1 "Patissciel" monster local g1=Duel.GetMatchingGroup(s.cfilter,tp,locs,0,nil,SET_NOUVELLES) local g2=Duel.GetMatchingGroup(s.cfilter,tp,locs,0,nil,SET_PATISSCIEL) if #g1==0 or #g2==0 then return end local g=g1+g2 local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_SPSUMMON) if #sg~=2 then return end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local sc1=sg:FilterSelect(tp,s.firstsummon,1,1,nil,e,tp,sg):GetFirst() local sc2=sg:RemoveCard(sc1):GetFirst() Duel.SpecialSummonStep(sc1,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonStep(sc2,0,tp,1-tp,false,false,POS_FACEUP) Duel.SpecialSummonComplete() end function s.sumlimit(e,sumc,sumtype,sumplayer) if not sumc then return false end local tp=e:GetHandlerPlayer() return sumplayer==tp and sumc:IsControler(tp) and aux.cannotmatfilter(SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ,SUMMON_TYPE_LINK)(e,sumc,sumtype,sumplayer) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ct=Duel.GetMatchingGroupCount(Card.IsSetCard,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,SET_RECIPE) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(Card.IsSetCard,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,SET_RECIPE) if ct==0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then tc:UpdateAttack(ct*200,RESET_EVENT|RESETS_STANDARD,e:GetHandler()) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, if a monster you control would be destroyed by battle, you can send 1 Rock-Type monster from your Deck to the Graveyard instead.
--岩投げエリア --Catapult Zone local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetTarget(s.destg) e2:SetValue(s.value) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.dfilter(c,tp) return c:IsControler(tp) and c:IsReason(REASON_BATTLE) end function s.repfilter(c) return c:IsRace(RACE_ROCK) and c:IsAbleToGrave() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.dfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_DECK,0,1,nil) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.value(e,c) return c:IsControler(e:GetHandlerPlayer()) and c:IsReason(REASON_BATTLE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoGrave(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be Normal Summoned or Set. This monster can only be Special Summoned by selecting 1 face-up "Gradius" on your side of the field. The ATK and DEF of this card becomes the same as the ATK and DEF of the selected "Gradius". If the selected "Gradius" is removed from the field, destroy this card.
--オプション --Gradius' Option local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --spsummon con local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetValue(s.splimit) c:RegisterEffect(e2) --set target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetOperation(s.tgop) c:RegisterEffect(e3) --atk.def local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_SET_ATTACK_FINAL) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.adcon) e4:SetValue(s.atkval) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_SET_DEFENSE_FINAL) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetRange(LOCATION_MZONE) e5:SetCondition(s.adcon) e5:SetValue(s.defval) c:RegisterEffect(e5) --destroy local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_SELF_DESTROY) e6:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e6:SetRange(LOCATION_MZONE) e6:SetCondition(s.sdcon) c:RegisterEffect(e6) end s.listed_names={10992251} function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,10992251),c:GetControler(),LOCATION_MZONE,0,1,nil) end function s.splimit(e,se,sp,st,pos,top) if (pos&POS_FACEDOWN)~=0 then return false end return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,10992251),top,LOCATION_MZONE,0,1,nil) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local g=Duel.SelectMatchingCard(tp,aux.FaceupFilter(Card.IsCode,10992251),tp,LOCATION_MZONE,0,1,1,nil) Duel.HintSelection(g) c:SetCardTarget(g:GetFirst()) c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE,0,1) end function s.adcon(e) return e:GetHandler():GetFirstCardTarget()~=nil end function s.atkval(e,c) return c:GetFirstCardTarget():GetAttack() end function s.defval(e,c) return c:GetFirstCardTarget():GetDefense() end function s.sdcon(e) return e:GetHandler():GetFirstCardTarget()==nil and e:GetHandler():GetFlagEffect(id)~=0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 Warrior monsters If this card battles an opponent's monster, during damage calculation: You can detach 2 materials from this card; double this card's ATK during damage calculation only. Once per turn, during the Main Phase (Quick Effect): You can target 1 other face-up monster you control; equip this card you control to it as an Equip Spell that gives it 2000 ATK/DEF. You can banish this card from your GY; shuffle 3 Warrior monsters from your GY into the Deck.
--H-C マグナム・エクスカリバー --Heroic Champion - Magnum Excalibur --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 4 Warrior monsters Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WARRIOR),4,2) --Double this card's ATK during damage calculation only local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN) e1:SetCondition(s.atkcon) e1:SetCost(Cost.DetachFromSelf(2)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Equip this card to another monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e2:SetCondition(function() return Duel.IsMainPhase() end) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) --Shuffle 3 Warrior monsters from your GY into the Deck. local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.tdtg) e3:SetOperation(s.tdop) c:RegisterEffect(e3) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() return bc and bc:IsControler(1-tp) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,tp,c:GetAttack()) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then --Double this card's ATK during damage calculation only local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(c:GetAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_DAMAGE_CAL) c:RegisterEffect(e1) end end 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:IsFaceup() and chkc~=c end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,tp,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 (tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return Duel.SendtoGrave(c,REASON_RULE,PLAYER_NONE,PLAYER_NONE) else if not Duel.Equip(tp,c,tc) then return end --Equip limit local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_EQUIP_LIMIT) e0:SetValue(function(e,c) return c==tc end) e0:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e0) --The equipped monster gains 2000 ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(2000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end end function s.tdfilter(c) return c:IsRace(RACE_WARRIOR) 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,3,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,3,tp,LOCATION_GRAVE) 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,3,3,nil) if #g==3 then Duel.HintSelection(g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 or more (max. 5) Level 3 monsters Once per turn: You can detach 1 Xyz Material from this card; place 1 Shark Counter on this card. If this card attacks or is attacked, it gains 1000 ATK for each Shark Counter on it, during the Damage Step only.
--牙鮫帝シャーク・カイゼル --Shark Caesar local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x2e) --xyz summon Xyz.AddProcedure(c,nil,3,3,nil,nil,5) c:EnableReviveLimit() --counter local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetOperation(s.ctop) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCondition(s.atkcon) e2:SetValue(s.atkval) c:RegisterEffect(e2) end s.counter_place_list={0x2e} function s.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then c:AddCounter(0x2e,1) end end function s.atkcon(e) local ph=Duel.GetCurrentPhase() return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and (Duel.GetAttacker()==e:GetHandler() or Duel.GetAttackTarget()==e:GetHandler()) end function s.atkval(e,c) return c:GetCounter(0x2e)*1000 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters If this card is Synchro Summoned using a Tuner Synchro Monster: You can target 1 Spell/Trap in your GY; add it to your hand. When your opponent activates a card or effect (Quick Effect): You can send 1 Spell/Trap from your hand or field to the GY; Special Summon 1 Level 7 or lower Tuner Synchro Monster from your Extra Deck, GY, or banishment. You can only use each effect of "Diabell, Queen of the White Forest" once per turn.
--白き森の妖魔ディアベル --Diabell, Queen of the White Forest --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Add 1 Spell/Trap from the GY to the hand 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:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() and e:GetLabel()==1 end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Check Synchro Summon material local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_SINGLE) e1a:SetCode(EFFECT_MATERIAL_CHECK) e1a:SetValue(s.matcheck) e1a:SetLabelObject(e1) c:RegisterEffect(e1a) --Special Summon 1 Level 7 or lower Tuner Synchro Monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg,ep) return ep==1-tp end) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsSpellTrap() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsSpellTrap,Card.IsAbleToHand),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,aux.AND(Card.IsSpellTrap,Card.IsAbleToHand),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.matfilter(c,sc,tp) return c:IsType(TYPE_SYNCHRO,sc,SUMMON_TYPE_SYNCHRO|MATERIAL_SYNCHRO,tp) and c:IsType(TYPE_TUNER,sc,SUMMON_TYPE_SYNCHRO|MATERIAL_SYNCHRO,tp) end function s.matcheck(e,c) local mg=c:GetMaterial() if #mg==0 then return e:GetLabelObject():SetLabel(0) end if mg:IsExists(s.matfilter,1,nil,c,e:GetHandlerPlayer()) then e:GetLabelObject():SetLabel(1) else e:GetLabelObject():SetLabel(0) end end function s.spcostfilter(c,e,tp) return c:IsSpellTrap() and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA|LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp,c) end function s.spfilter(c,e,tp,mc) if not (c:IsType(TYPE_TUNER) and c:IsType(TYPE_SYNCHRO) and c:IsLevelBelow(7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)) then return false end if c:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 else return Duel.GetMZoneCount(tp,mc)>0 end 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|LOCATION_ONFIELD,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil,e,tp) Duel.SendtoGrave(g,REASON_COST) end function s.sptg(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_EXTRA|LOCATION_GRAVE|LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_EXTRA|LOCATION_GRAVE|LOCATION_REMOVED,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:
During each of your End Phases, destroy this card unless you send 1 "Iron Core of Koa'ki Meiru" from your hand to the GY or reveal 1 Rock monster in your hand. When your opponent would Summon a monster(s) (Quick Effect): You can Tribute this card; negate the Summon, and if you do, destroy that monster(s).
--コアキメイル・オーバードーズ --Koa'ki Meiru Overload local s,id=GetID() function s.initial_effect(c) --cost local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.mtcon) e1:SetOperation(s.mtop) c:RegisterEffect(e1) --disable spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,3)) e2:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_SUMMON) e2:SetCondition(s.condition) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON) c:RegisterEffect(e3) local e4=e2:Clone() e4:SetCode(EVENT_SPSUMMON) c:RegisterEffect(e4) end s.listed_names={36623431} function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.cfilter1(c) return c:IsCode(36623431) and c:IsAbleToGraveAsCost() end function s.cfilter2(c) return c:IsMonster() and c:IsRace(RACE_ROCK) and not c:IsPublic() end function s.mtop(e,tp) local c=e:GetHandler() Duel.HintSelection(Group.FromCards(c)) local g1=Duel.GetMatchingGroup(s.cfilter1,tp,LOCATION_HAND,0,nil) local g2=Duel.GetMatchingGroup(s.cfilter2,tp,LOCATION_HAND,0,nil) local select=2 if #g1>0 and #g2>0 then select=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,1),aux.Stringid(id,2)) elseif #g1>0 then select=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,2)) if select==1 then select=2 end elseif #g2>0 then select=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 else select=Duel.SelectOption(tp,aux.Stringid(id,2)) select=2 end if select==0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=g1:Select(tp,1,1,nil) Duel.SendtoGrave(g,REASON_COST) elseif select==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=g2:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) else Duel.Destroy(c,REASON_COST) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return tp~=ep and Duel.GetCurrentChain()==0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,#eg,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.NegateSummon(eg) Duel.Destroy(eg,REASON_EFFECT) 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, then end the Battle Phase.
--攻撃の無力化 --Negate Attack 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) end Duel.SetTargetCard(tg) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsRelateToEffect(e) and Duel.NegateAttack() then Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Standby Phase, gain Life Points equal to half of the total Life Points you paid during your last turn.
--生命吸収装置 --Life Absorbing Machine 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(TIMING_STANDBY_PHASE,0) c:RegisterEffect(e1) --recover local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_RECOVER) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.reccon) e2:SetTarget(s.rectg) e2:SetOperation(s.recop) c:RegisterEffect(e2) aux.GlobalCheck(s,function() s[0]={} s[1]={} s[2]={} s[3]={} local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_PAY_LPCOST) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) aux.AddValuesReset(function() local p=Duel.GetTurnPlayer() s[p+2]={table.unpack(s[p])} s[p]={} end) end) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if ep==Duel.GetTurnPlayer() then local val=math.ceil(ev/2) table.insert(s[ep],val) end end function s.reccon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return #s[tp+2]>0 and (c:GetFlagEffect(id)==0 or s[tp+2][c:GetFlagEffectLabel(id)+1]) end local rec if c:GetFlagEffect(id)==0 then rec=s[tp+2][1] c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,1,1) else rec=s[tp+2][c:GetFlagEffectLabel(id)+1] c:SetFlagEffectLabel(id,c:GetFlagEffectLabel(id)+1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(rec) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,rec) end function s.recop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All Tokens in Attack Position gain 1000 ATK, also they cannot be destroyed by battle.
--暴走闘君 --Token Stampede local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.tg) e2:SetValue(1000) c:RegisterEffect(e2) --indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(s.tg) e3:SetValue(1) c:RegisterEffect(e3) end function s.tg(e,c) return c:IsType(TYPE_TOKEN) and c:IsAttackPos() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can select 1 Defense Position monster your opponent controls. Change it to face-up Attack Position.
--サムライソード・バロン --Samurai Sword Baron local s,id=GetID() function s.initial_effect(c) --pos change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) 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:IsControler(1-tp) and chkc:IsDefensePos() end if chk==0 then return Duel.IsExistingTarget(Card.IsDefensePos,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DEFENSE) local g=Duel.SelectTarget(tp,Card.IsDefensePos,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsDefensePos() then Duel.ChangePosition(tc,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by shuffling 3 of your banished Insect monsters into the Main Deck. During the Main Phase, if this card in its owner's control is destroyed or banished by an opponent's card effect: You can Special Summon this card. You can only use this effect of "Heavy Beetrooper Mighty Neptune" once per turn. Once per turn, during the End Phase: You can target 1 other Insect monster you control; it gains 1000 ATK.
--重騎甲虫マイティ・ネプチューン --Heavy Beetrooper Mighty Neptune --Scripted by Zefile local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Summon itself back local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,id) e2:SetCondition(s.rscon) e2:SetTarget(s.rstg) e2:SetOperation(s.rsop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_REMOVE) c:RegisterEffect(e3) --Increase ATK local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_ATKCHANGE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.atktg) e4:SetOperation(s.atkop) c:RegisterEffect(e4) end function s.cfilter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) and c:IsAbleToDeckAsCost() 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.cfilter,tp,LOCATION_REMOVED,0,3,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_REMOVED,0,3,3,true,nil) if g and #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.HintSelection(g,true) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.rscon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsMainPhase() and c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.rstg(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.rsop(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.atkfilter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) end function s.atktg(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_MZONE) and s.atkfilter(chkc) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,c) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1000) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 or lower "Trickstar" monsters You can only control 1 "Trickstar Divaridis". If this card is Special Summoned: You can inflict 200 damage to your opponent. Each time your opponent Normal or Special Summons a monster(s): Inflict 200 damage to your opponent. * The above text is unofficial and describes the card's functionality in the OCG.
--トリックスター・ディーヴァリディス --Trickstar Divaridis --Credit to Larry126 and Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Link summon Link.AddProcedure(c,s.matfilter,2,2) --Must be properly summoned in order to be revived c:EnableReviveLimit() --Can only control one c:SetUniqueOnField(1,0,id) --Effect damage, optional trigger local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e1:SetTarget(s.sstg) e1:SetOperation(s.ssop) c:RegisterEffect(e1) --Effect damage for normal summon, continuous effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --Effect damage for special summon, continuous effect local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end function s.matfilter(c,lc,sumtype,tp) return c:IsLevelBelow(3) and c:IsSetCard(SET_TRICKSTAR,lc,sumtype,tp) end --Activation legality function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(200) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200) end --Performing the effect damage function s.ssop(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 --If opponent was the one to perform the summon function s.filter(c,p) return c:GetSummonPlayer()==p end --If it ever happened function s.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil,1-tp) end --Inflict effect damage to opponent 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(200) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200) 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:
Discard 1 card; add 1 "Destiny Board" or 1 Level 8 Fiend monster from your Deck or GY to your hand. You can banish this card from your GY, except the turn this card was sent to the GY; place any number of "Destiny Board" and/or "Spirit Message" cards with different names from your hand or GY on the bottom of the Deck in any order, then draw the same number of cards. You can only use each effect of "Dark Spirit's Mastery" once per turn.
--ダーク・オカルティズム --Dark Spirit's Mastery --Scripted by Larry126s local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --To Deck and Draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.tdrtg) e2:SetOperation(s.tdrop) c:RegisterEffect(e2) end s.listed_names={CARD_DESTINY_BOARD} s.listed_series={SET_SPIRIT_MESSAGE} 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,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.thfilter(c) return (c:IsCode(CARD_DESTINY_BOARD) or c:IsRace(RACE_FIEND) and c:GetLevel()==8) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.tdfilter(c) return (c:IsCode(CARD_DESTINY_BOARD) or c:IsSetCard(SET_SPIRIT_MESSAGE)) and c:IsAbleToDeck() end function s.tdrtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,nil) if chk==0 then return Duel.IsPlayerCanDraw(tp) and aux.SelectUnselectGroup(g,e,tp,1,g:GetClassCount(Card.GetCode),aux.dncheck,0) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.tdrop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.tdfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,nil) if #g==0 then return end local sg=aux.SelectUnselectGroup(g,e,tp,1,g:GetClassCount(Card.GetCode),s.rescon,1,tp,HINTMSG_TODECK) Duel.ConfirmCards(1-tp,sg) Duel.SendtoDeck(sg,nil,SEQ_DECKBOTTOM,REASON_EFFECT) local og=Duel.GetOperatedGroup() local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_DECK) if ct>0 then Duel.SortDeckbottom(tp,tp,ct) Duel.BreakEffect() Duel.Draw(tp,ct,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Visas Starfrost" while on the field or in the GY. You can target any number of your "Visas" monsters that are banished, in your GY, and/or on your field; shuffle those "Visas" monsters into the Deck, and if you do, Special Summon this card from your hand, and if you do that, it gains 400 ATK for each monster you shuffled with a different original name. You can only use this effect of "Visas Samsara" once per turn. If this card you control would be used as Synchro Material, you can treat it as a non-Tuner.
--ヴィサス=サンサーラ --Visas Samsara --scripted by Naim local s,id=GetID() function s.initial_effect(c) --This card's name becomes "Visas Starfrost" 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(CARD_VISAS_STARFROST) c:RegisterEffect(e1) --Special Summon itself from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Can be treated as a non-tuner for a Synchro Summon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_NONTUNER) e3:SetRange(LOCATION_MZONE) c:RegisterEffect(e3) end s.listed_names={CARD_VISAS_STARFROST} s.listed_series={SET_VISAS} function s.tdfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_VISAS) and c:IsMonster() and c:IsAbleToDeck() and Duel.GetMZoneCount(tp,c)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local loc=LOCATION_MZONE|LOCATION_REMOVED|LOCATION_GRAVE if chkc then return chkc:IsControler(tp) and chkc:IsLocation(loc) and s.tdfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.tdfilter,tp,loc,0,1,nil,tp) end local ct=Duel.GetMatchingGroupCount(s.tdfilter,tp,loc,0,nil,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,loc,0,1,ct,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.visasfilter(c) return c:IsFaceup() and c:IsSetCard(SET_VISAS) and c:IsMonster() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Match(s.visasfilter,nil) if #g==0 or Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)==0 then return end local og=Duel.GetOperatedGroup():Match(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA) if #og==0 then return end local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then c:UpdateAttack(400*og:GetClassCount(Card.GetCode)) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you take 3000 or more Battle Damage from 1 attack, you can activate this card. Remove all monsters in each player's Deck and Graveyard from play.
--ヘル・テンペスト --Inferno Tempest 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_BATTLE_DAMAGE) 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 ep==tp and ev>=3000 end function s.filter(c) return c:IsMonster() and c:IsAbleToRemove() and (c:IsLocation(LOCATION_DECK) or aux.SpElimFilter(c)) 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|LOCATION_MZONE|LOCATION_GRAVE,LOCATION_DECK|LOCATION_MZONE|LOCATION_GRAVE,1,nil) end local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK|LOCATION_MZONE|LOCATION_GRAVE,LOCATION_DECK|LOCATION_MZONE|LOCATION_GRAVE,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK|LOCATION_MZONE|LOCATION_GRAVE,LOCATION_DECK|LOCATION_MZONE|LOCATION_GRAVE,nil) Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All Cyberse monsters you control gain 500 ATK. If you control a "Mathmech" monster: You can send this face-up card from the field to the GY, then target 1 card your opponent controls; destroy it. You can only use this effect of "Mathmech Induction" once per turn.
--斬機帰納法 --Mathmech Induction --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_CYBERSE)) e2:SetValue(500) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_FREE_CHAIN) e3:SetCountLimit(1,id) e3:SetCondition(s.descon) e3:SetCost(s.descost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_series={SET_MATHMECH} function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_MATHMECH),tp,LOCATION_MZONE,0,1,nil) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED) end Duel.SendtoGrave(c,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(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:
[ Pendulum Effect ] During your Main Phase: You can Special Summon this card to your Main Monster Zone in its same column, also you cannot Special Summon non-"Vaylantz" monsters for the rest of this turn, except from the Extra Deck. You can only use this effect of "Vaylantz Buster Baron" once per turn. ---------------------------------------- [ Monster Effect ] If you control this Special Summoned card: You can target 1 other "Vaylantz" monster in your Main Monster Zone; move that monster you control to an adjacent (horizontal) Monster Zone. If this card in the Monster Zone moves to another Monster Zone: You can target 1 card in either player's Pendulum Zone; place it face-up in its adjacent Spell & Trap Zone as a Continuous Spell. You can only use each effect of "Vaylantz Buster Baron" once per turn.
--ヴァリアンツB-バロン --Vaylantz Buster Baron --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Move 1 other "Valiants" monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsSpecialSummoned() end) e2:SetTarget(s.mmvtg) e2:SetOperation(s.mmvop) c:RegisterEffect(e2) --Move 1 "Valiants" Pendulum Spell local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_MOVE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.smvcon) e3:SetTarget(s.smvtg) e3:SetOperation(s.smvop) c:RegisterEffect(e3) end s.listed_series={SET_VAYLANTZ} function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then local zone=(1<<c:GetSequence())&ZONES_MMZ return zone~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local zone=(1<<c:GetSequence())&ZONES_MMZ if zone~=0 then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone) end --Cannot Special Summon, except "Valiants" and from the Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,3)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c) return not c:IsSetCard(SET_VAYLANTZ) and not c:IsLocation(LOCATION_EXTRA) end function s.mmvfilter(c) return c:IsFaceup() and c:IsSetCard(SET_VAYLANTZ) and c:CheckAdjacent() end function s.mmvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return c~=chkc and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.mmvfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.mmvfilter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.mmvfilter,tp,LOCATION_MZONE,0,1,1,c) end function s.mmvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then tc:MoveAdjacent() end end function s.smvcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_MZONE) and c:IsPreviousLocation(LOCATION_MZONE) end function s.smvfilter(c,tp) local z=1<<c:GetSequence() return Duel.GetLocationCount(tp,LOCATION_SZONE,tp,LOCATION_REASON_TOFIELD,(z<<1|z>>1)&ZONES_MMZ)>0 end function s.smvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_PZONE) and s.smvfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.smvfilter,tp,LOCATION_PZONE,LOCATION_PZONE,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.smvfilter,tp,LOCATION_PZONE,LOCATION_PZONE,1,1,nil,tp) end function s.smvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local seq=tc:GetSequence() if seq>4 then return end local flag=0 if seq>0 and Duel.CheckLocation(tp,LOCATION_SZONE,seq-1) then flag=flag|(0x1<<seq-1) end if seq<4 and Duel.CheckLocation(tp,LOCATION_SZONE,seq+1) then flag=flag|(0x1<<seq+1) end if flag==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) local zone=math.log(Duel.SelectDisableField(tp,1,LOCATION_SZONE,0,~(flag<<8)),2)-8 if Duel.MoveSequence(tc,zone,LOCATION_SZONE) then --Treat as Continuous Spell local e1=Effect.CreateEffect(e:GetHandler()) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control this face-up Attack Position card, when an opponent's monster declares an attack, inflict 500 damage to your opponent.
--インターセプト・デーモン --Archfiend Interceptor local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPosition(POS_FACEUP_ATTACK) and Duel.GetTurnPlayer()~=tp end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsPosition(POS_FACEUP_ATTACK) and c:IsRelateToEffect(e) then local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(Quick Effect): You can target 1 face-up monster on the field; equip this card from your hand to that target. The equipped monster becomes an Insect monster, cannot attack Insect monsters, also its effects that activate by targeting an Insect monster(s) are negated. You can only use this effect of "Parasite Paranoid" once per turn. If this Equip Card is sent to the GY: You can Special Summon 1 Level 7 or higher Insect monster from your hand, ignoring its Summoning conditions.
--寄生虫パラノイド --Parasite Paranoid --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) --to hand 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:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.eqtg(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.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) then Duel.SendtoGrave(c,REASON_EFFECT) return end Duel.Equip(tp,c,tc,true) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) --race local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_CHANGE_RACE) e2:SetValue(RACE_INSECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) --cannot attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e3:SetValue(s.atlimit) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) --disable local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_CHAIN_SOLVING) e4:SetRange(LOCATION_SZONE) e4:SetLabelObject(tc) e4:SetCondition(s.discon) e4:SetOperation(s.disop) e4:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e4) local att=Duel.GetAttacker() if att and att==tc then local tg=tc:GetBattleTarget() if tg and s.atlimit(nil,tg) then --cannot attack workaround local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_EQUIP) e5:SetCode(EFFECT_CANNOT_ATTACK) e5:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e5) --reset after unsuccessful attack local e5r=Effect.CreateEffect(c) e5r:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5r:SetCode(EVENT_ADJUST) e5r:SetRange(0xff) e5r:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e5r:SetLabelObject(e5) e5r:SetOperation(s.resop) e5r:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e5r) Duel.AdjustInstantly() end end end function s.eqlimit(e,c) return c==e:GetLabelObject() end function s.atlimit(e,c) return c:IsRace(RACE_INSECT) and c:IsFaceup() end function s.disfilter(c) return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_INSECT) end function s.discon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() local rc=re:GetHandler() if not tc or rc~=tc then return false end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.disfilter,1,nil) and Duel.IsChainNegatable(ev) end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end function s.resop(e,tp,eg,ep,ev,re,r,rp) e:GetLabelObject():Reset() e:Reset() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_SZONE) end function s.spfilter(c,e,tp) return c:IsRace(RACE_INSECT) and c:IsLevelAbove(7) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,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,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned from the Graveyard. When this face-up card you control is destroyed and sent to your Graveyard: You can target 1 Spell in your Graveyard; add that target to your hand. You must have 3 or more Spellcaster monsters in your Graveyard to activate and to resolve this effect.
--氷の女王 --Ice Queen local s,id=GetID() function s.initial_effect(c) --Cannot be Special Summoned from the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_GRAVE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --Add 1 Spell from the GY to the 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:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) 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:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_GRAVE,0,3,nil,RACE_SPELLCASTER) end function s.filter(c) return c:IsSpell() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_GRAVE,0,3,nil,RACE_SPELLCASTER) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 "Predaplant" monster in your Graveyard; Special Summon it and equip it with this card. When this card leaves the field, destroy that monster.
--捕食接ぎ木 --Predapruning 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_LEAVE_FIELD_P) e2:SetOperation(s.checkop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetOperation(s.desop) e3:SetLabelObject(e2) c:RegisterEffect(e3) end s.listed_series={SET_PREDAPLANT} function s.spfilter(c,e,tp) return c:IsSetCard(SET_PREDAPLANT) 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.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) 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() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then Duel.Equip(tp,c,tc) --Add Equip limit local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) c:RegisterEffect(e1) end Duel.SpecialSummonComplete() end function s.eqlimit(e,c) return e:GetOwner()==c end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Nordic" monster from your Deck to your hand.
--神の桎梏グレイプニル --Gleipnir, the Fetters of Fenrir 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:SetHintTiming(0,TIMING_END_PHASE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_NORDIC} function s.filter(c) return c:IsSetCard(SET_NORDIC) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.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:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 2 monsters you control and 1 monster from your Graveyard. Once per turn: You can target 1 face-up monster your opponent controls; equip that target to this card. (You can only equip 1 monster at a time to this card with this effect.) This card gains ATK and DEF equal to the ATK and DEF of that equipped monster.
--The アトモスフィア --The Atmosphere local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon this card (from your hand) by banishing 2 monsters you control and 1 monster from your GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Equip a face-up monster your opponent controls to this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.eqcon) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) aux.AddEREquipLimit(c,s.eqcon,function(ec,_,tp) return ec:IsControler(1-tp) end,s.equipop,e2) end function s.gfilter(c) return c:IsMonster() and c:IsAbleToRemoveAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg1=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil) local rg2=Duel.GetMatchingGroup(s.gfilter,tp,LOCATION_GRAVE,0,nil) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=-2 then return false end if Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then return aux.SelectUnselectGroup(rg1,e,tp,3,3,aux.ChkfMMZ(1),0) else return aux.SelectUnselectGroup(rg1,e,tp,2,2,aux.ChkfMMZ(1),0) and aux.SelectUnselectGroup(rg2,e,tp,1,1,aux.ChkfMMZ(1),0) end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg1=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil) local rg2=Duel.GetMatchingGroup(s.gfilter,tp,LOCATION_GRAVE,0,nil) local g1 if Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then g1=aux.SelectUnselectGroup(rg1,e,tp,3,3,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) else g1=aux.SelectUnselectGroup(rg1,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g1>=1 then local g2=aux.SelectUnselectGroup(rg2,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) g1:Merge(g2) end end if #g1>2 then g1:KeepAlive() e:SetLabelObject(g1) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g1=e:GetLabelObject() if not g1 then return end Duel.Remove(g1,POS_FACEUP,REASON_COST) g1:DeleteGroup() end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) return #e:GetHandler():GetEquipGroup():Filter(s.eqfilter,nil)==0 end function s.eqfilter(c) return c:GetFlagEffect(id)~=0 end function s.filter(c) return c:IsFaceup() and c:IsAbleToChangeControler() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) end function s.equipop(c,e,tp,tc) local atk=tc:GetTextAttack() local def=tc:GetTextDefense() if atk<0 then atk=0 end if def<0 then def=0 end if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end if atk>0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(atk) tc:RegisterEffect(e1) end if def>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(def) tc:RegisterEffect(e2) end end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then s.equipop(c,e,tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Each turn, the first time an "Ultimate Crystal" monster(s) and/or "Crystal Beast" card(s) you control would be destroyed by card effect that turn, it is not destroyed. ---------------------------------------- [ Monster Effect ] If a "Crystal Beast" monster you control battles an opponent's monster, during damage calculation (Quick Effect): You can Tribute this card from your hand or face-up field; your battling monster's ATK/DEF become double its original ATK/DEF during that damage calculation only, but it is destroyed at the end of this Damage Step.
--宝玉の守護者 --Crystal Keeper local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --avoid destruction local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetRange(LOCATION_PZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.indtg) e2:SetValue(s.indval) c:RegisterEffect(e2) --double local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e3:SetRange(LOCATION_MZONE|LOCATION_HAND) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_CRYSTAL_BEAST,SET_ULTIMATE_CRYSTAL} function s.indtg(e,c) return c:IsSetCard(SET_CRYSTAL_BEAST) or (c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_ULTIMATE_CRYSTAL)) end function s.indval(e,re,r,rp) if (r&REASON_EFFECT)~=0 then return 1 else return 0 end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if a:IsControler(1-tp) then a=d end if chk==0 then return d and a:IsSetCard(SET_CRYSTAL_BEAST) end e:SetLabelObject(a) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsRelateToBattle() and tc:IsFaceup() then local atk=tc:GetBaseAttack() local def=tc:GetBaseDefense() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(atk*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE_FINAL) e2:SetValue(def*2) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetOperation(s.desop) e3:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) tc:RegisterEffect(e3) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToBattle() and c:IsFaceup() then Duel.Destroy(c,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 2 "Ojama Tokens" (Beast/LIGHT/Level 2/ATK 0/DEF 1000) to your opponent's field in Defense Position. These Tokens cannot be Tributed for a Tribute Summon, and each time 1 is destroyed, its controller takes 300 damage. During either player's turn, except the turn this card was sent to the GY: You can banish this card from your GY; Special Summon 2 "Ojama" monsters with different names from your Deck.
--おジャマデュオ --Ojama Duo local s,id=GetID() function s.initial_effect(c) --Special summon 2 tokens to opponent's field local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --Special summon 2 "Ojama" monsters from deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_GRAVE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) e2:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e2) end s.listed_series={SET_OJAMA} s.listed_names={TOKEN_OJAMA} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_OJAMA,SET_OJAMA,TYPES_TOKEN,0,1000,2,RACE_BEAST,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE,1-tp) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)<2 or not Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_OJAMA,SET_OJAMA,TYPES_TOKEN,0,1000,2,RACE_BEAST,ATTRIBUTE_LIGHT,POS_FACEUP_DEFENSE,1-tp) then return end for i=0,1 do local token=Duel.CreateToken(tp,TOKEN_OJAMA_DUO+i) if Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE) then --Cannot be tributed for a tribute summon local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3304) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1) token:RegisterEffect(e1,true) --Inflict 300 damage when destroyed local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(s.damop) token:RegisterEffect(e2,true) end end Duel.SpecialSummonComplete() end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsReason(REASON_DESTROY) then Duel.Damage(c:GetPreviousControler(),300,REASON_EFFECT) end e:Reset() end function s.spfilter(c,e,tp) return c:IsSetCard(SET_OJAMA) 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 local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and g:GetClassCount(Card.GetCode)>=2 end Duel.SetOperationInfo(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) if not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and ft>1 and g:GetClassCount(Card.GetCode)>1 then local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SPSUMMON) if sg then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) Duel.ConfirmCards(1-tp,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the GY: You can add 1 Insect monster with 1500 or less ATK from your Deck to your hand.
--ゴキポン --Gokipon 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_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return c:IsAttackBelow(1500) and c:IsRace(RACE_INSECT) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Libromancer" monster: You can target 1 face-up monster your opponent controls; this turn, that face-up monster cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon. You can only use this effect of "Libromancer Prevented" once per turn. Once per turn, during the End Phase, if you control no "Libromancer" Ritual Monsters: Send this card to the GY.
--リブロマンサー・プリベント --Libromancer Prevented --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Prevent target from being used as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e2:SetCountLimit(1,id) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --Send itself to the GY during the End Phase local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(s.tgcond) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_LIBROMANCER} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_LIBROMANCER),tp,LOCATION_MZONE,0,1,nil) 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(1-tp) 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_TARGET) 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 --Cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetDescription(aux.Stringid(id,2)) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_BE_MATERIAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(aux.cannotmatfilter(SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ,SUMMON_TYPE_LINK)) tc:RegisterEffect(e1) end end function s.rfilter(c) return c:IsRitualMonster() and c:IsSetCard(SET_LIBROMANCER) and c:IsFaceup() end function s.tgcond(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.rfilter,tp,LOCATION_MZONE,0,1,nil) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,tp,LOCATION_SZONE) 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:
When this card is Normal Summoned: You can target 1 "Lady of Lament" monster in your GY; Special Summon it. You can only use each of the following effects of "Alice, Lady of Lament" once per turn. You can banish 1 Trap from your hand or GY; Special Summon this card from your hand. If this card is Tributed, or if this card in its owner's possession is destroyed by an opponent's card: You can add 1 Fiend monster whose combined ATK & DEF equal 2000 from your Deck to your hand, except "Alice, Lady of Lament".
--悪魔嬢アリス --Alice, Lady of Lament --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special summon self local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCost(s.hspcost) e2:SetTarget(s.hsptg) e2:SetOperation(s.hspop) c:RegisterEffect(e2) --Search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_RELEASE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_DESTROYED) e4:SetCondition(s.thdescon) c:RegisterEffect(e4) end s.listed_names={id} s.listed_series={SET_LADY_OF_LAMENT} function s.spfilter(c,e,tp) return c:IsSetCard(SET_LADY_OF_LAMENT) 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 function s.hspcostfilter(c) return c:IsTrap() and c:IsAbleToRemoveAsCost() end function s.hspcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.hspcostfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.hspcostfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.hsptg(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.hspop(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.thfilter(c) local atk,def=c:GetTextAttack(),c:GetTextDefense() return c:IsRace(RACE_FIEND) and atk>=0 and def>=0 and atk+def==2000 and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.thdescon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If all monsters you control are Cyberse monsters (min. 1), you can Special Summon this card (from your hand). You can only Special Summon "Cyberse Converter" once per turn this way. When this card is Normal Summoned: You can target 1 face-up monster you control; it becomes a Cyberse monster until the end of this turn.
--サイバース・コンバーター --Cyberse Converter local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.sprcon) c:RegisterEffect(e1) --race local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.rctg) e2:SetOperation(s.rcop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsFacedown() or not c:IsRace(RACE_CYBERSE) end function s.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0 and not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.rcfilter(c) return c:IsFaceup() and not c:IsRace(RACE_CYBERSE) end function s.rctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.rcfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rcfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.rcfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.rcop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) e1:SetValue(RACE_CYBERSE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Target 1 Level 4 monster in your GY; add that target to your hand.
--ダッカー --DUCKER Mobile Cannon local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.filter(c) return c:GetLevel()==4 and c:IsAbleToHand() end function s.thtg(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) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,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:
Target 1 face-up monster your opponent controls; you can use that monster as Synchro Material this turn, as if you controlled it. You cannot conduct your Battle Phase the turn you activate this card.
--シンクロ・マテリアル --Synchro Material local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsCanBeSynchroMaterial() and not c:IsHasEffect(EFFECT_SYNCHRO_MATERIAL) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BP) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SYNCHRO_MATERIAL) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned by a card effect. You can target 3 of your banished Fiend monsters; Special Summon this card from your hand, and if you do, shuffle those banished monsters into the Deck. During the End Phase, if this card is in the GY because it was destroyed in your Monster Zone by an opponent's card and sent there this turn: Special Summon this card from your GY, then, you can destroy cards your opponent controls, up to the number of face-up Spells/Traps you control with different names. You can only use each effect of "Curse Necrofear" once per turn.
--カース・ネクロフィア --Curse Necrofear --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableUnsummonable() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --to grave local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_TO_GRAVE) e3:SetOperation(s.regop) c:RegisterEffect(e3) end function s.splimit(e,se,sp,st) return se:IsHasType(EFFECT_TYPE_ACTIONS) end function s.tdfilter(c) return c:IsFaceup() and c:IsRace(RACE_FIEND) and c:IsAbleToDeck() 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_REMOVED) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,0,3,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,0,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,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 g=Duel.GetTargetCards(e) if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 and #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_MZONE) and c:GetReasonPlayer()~=tp then local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1,{id,1}) e1:SetRange(LOCATION_GRAVE) e1:SetTarget(s.sptg2) e1:SetOperation(s.spop2) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) local ct=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSpellTrap),tp,LOCATION_ONFIELD,0,nil):GetClassCount(Card.GetCode) if #g>0 and ct>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,math.min(ct,#g),nil) Duel.Destroy(sg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Prinzessin" you control can attack directly. Your opponent cannot target "Golden Castle of Stromberg" you control with card effects, also it cannot be destroyed by card effects.
--カボチャの馬車 --Pumpkin Carriage --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsCode,78527720)) c:RegisterEffect(e1) --indestructable local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_ONFIELD,0) e2:SetTarget(s.indtg) e2:SetValue(1) c:RegisterEffect(e2) --cannot be target local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) end s.listed_names={CARD_STROMBERG,78527720} function s.indtg(e,c) return c:IsFaceup() and c:IsCode(CARD_STROMBERG) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
After you Normal Summon this card, you can Normal Summon 1 "Ritual Beast" monster during your Main Phase this turn, in addition to your Normal Summon/Set. (You can only gain this effect once per turn.) You can only Special Summon "Ritual Beast Tamer Elder(s)" once per turn.
--霊獣使いの長老 --Ritual Beast Tamer Elder local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --extra summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.sumop) c:RegisterEffect(e1) end s.listed_series={SET_RITUAL_BEAST} function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetDescription(aux.Stringid(id,0)) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_RITUAL_BEAST)) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] "Supreme King Z-ARC" you control cannot be banished by your opponent's card effects. During your Main Phase: You can destroy this card, and if you do, place 1 "Supreme King Gate" Pendulum Monster from your hand or Deck in your Pendulum Zone, except "Supreme King Gate Magician". You can only use this effect of "Supreme King Gate Magician" once per turn. ---------------------------------------- [ Monster Effect ] If you have a "Supreme King Gate" card in your Pendulum Zone, except "Supreme King Gate Magician": You can send 1 "Pendulum Dragon", "Xyz Dragon", "Synchro Dragon", or "Fusion Dragon" monster from your hand or Extra Deck to the GY, and if you do, Special Summon this card from your hand. If this card is Special Summoned: You can add 1 card that mentions "Supreme King Z-ARC" from your Deck to your hand, except a Spellcaster monster. You can only use each effect of "Supreme King Gate Magician" once per turn.
--覇王門の魔術師 --Supreme King Gate Magician --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --"Supreme King Z-ARC" cannot be banished local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_REMOVE) e1:SetRange(LOCATION_PZONE) e1:SetTargetRange(0,1) e1:SetTarget(aux.TargetBoolFunction(Card.IsHasEffect,id)) c:RegisterEffect(e1) --Apply effect to "Supreme King Z-ARC" so unaffected ones can still be banished local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_FIELD) e1a:SetCode(id) e1a:SetRange(LOCATION_PZONE) e1a:SetTargetRange(LOCATION_MZONE,0) e1a:SetTarget(aux.TargetBoolFunction(Card.IsCode,CARD_ZARC)) c:RegisterEffect(e1a) --Destroy this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Special Summon this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_HAND) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --Search 1 card that mentions "Supreme King Z-ARC", except a Spellcaster monster local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetCountLimit(1,{id,2}) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end s.listed_names={id,CARD_ZARC} s.listed_series={SET_SUPREME_KING_GATE,SET_PENDULUM_DRAGON,SET_XYZ_DRAGON,SET_SYNCHRO_DRAGON,SET_FUSION_DRAGON} function s.plfilter(c) return c:IsSetCard(SET_SUPREME_KING_GATE) and c:IsType(TYPE_PENDULUM) and not c:IsCode(id) and not c:IsForbidden() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.Destroy(c,REASON_EFFECT)==0 or not Duel.CheckPendulumZones(tp) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end function s.spconfilter(c) return c:IsSetCard(SET_SUPREME_KING_GATE) and not c:IsCode(id) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_PZONE,0,1,nil) end function s.tgfilter(c) return c:IsSetCard({SET_PENDULUM_DRAGON,SET_XYZ_DRAGON,SET_SYNCHRO_DRAGON,SET_FUSION_DRAGON}) and c:IsAbleToGrave() 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) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_EXTRA,0,1,c) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) 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() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_EXTRA,0,1,1,c):GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c) return c:ListsCode(CARD_ZARC) and not c:IsRace(RACE_SPELLCASTER) 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 "Darklord" monster from your GY in Defense Position. You can only activate 1 "Darklord Contact" per turn.
--堕天使の戒壇 --Darklord Contact 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.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_DARKLORD} function s.filter(c,e,tp) return c:IsSetCard(SET_DARKLORD) 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_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,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:
3 "Memento" monsters You can banish this card from your GY; add 1 "Mementomictlan" from your Deck to your hand. You cannot activate the following effects of "Mementomictlan Tecuhtlica - Creation King" in the same Chain. If this card is Fusion Summoned: You can send 3 "Memento" cards from your Deck and/or Extra Deck to the GY. (Quick Effect): You can target an equal number of "Memento" monsters you control and cards your opponent controls; destroy them. You can only use each effect of "Mementomictlan Tecuhtlica - Creation King" once per turn.
--冥骸王-メメントラン・テクトリカ --Mementomictlan Tecuhtlica - Creation King --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --3 "Memento" monsters Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_MEMENTO),3) --Search 1 "Mementomictlan" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Send 3 "Memento" cards from the Deck and/or Extra Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsFusionSummoned() end) e2:SetCost(s.opccost) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --Destroy an equal number of "Memento" monsters and opponent cards local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e3:SetCost(s.opccost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_names={43338320} --"Mementomictlan" s.listed_series={SET_MEMENTO} function s.thfilter(c) return c:IsCode(43338320) 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.opccost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.HasFlagEffect(tp,id) end Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) end function s.tgfilter(c) return c:IsSetCard(SET_MEMENTO) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,3,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,3,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,3,3,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.desfilter(c,e,tp) return (c:IsControler(1-tp) or (c:IsFaceup() and c:IsSetCard(SET_MEMENTO))) and c:IsCanBeEffectTarget(e) end function s.desrescon(maxc) return function(sg,e,tp,mg) local ct1=sg:FilterCount(Card.IsControler,nil,tp) local ct2=#sg-ct1 return ct1==ct2,ct1>maxc or ct2>maxc end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_MEMENTO),tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_ONFIELD,nil,e,tp) local ct=g:FilterCount(Card.IsControler,nil,tp) local rescon=s.desrescon(math.min(ct,#g-ct)) local tg=aux.SelectUnselectGroup(g,e,tp,2,#g,rescon,1,tp,HINTMSG_DESTROY,rescon) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,#tg,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no face-up cards: Activate 1 of these effects; ● Destroy all Attack Position monsters your opponent controls. ● Destroy all Spells and Traps your opponent controls. You can only activate 1 "Lightning Storm" per turn.
--ライトニング・ストーム --Lightning Storm --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Destroy local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) 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) return not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_ONFIELD,0,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g1=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) local g2=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) local b1=#g1>0 local b2=#g2>0 if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,0)}, {b2,aux.Stringid(id,1)}) e:SetLabel(op) local g=(op==1 and g1 or g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==1 then local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end else local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by discarding 1 Level 5 or higher DARK monster. Once per turn: You can discard 1 DARK monster; send 1 DARK monster from your Deck to the GY.
--ダーク・グレファー --Dark Grepher local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --to grave local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.sgcost) e2:SetTarget(s.sgtg) e2:SetOperation(s.sgop) c:RegisterEffect(e2) end function s.spfilter(c) return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_DARK) end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil) return aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),0,c) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_DISCARD|REASON_COST) g:DeleteGroup() end function s.costfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsDiscardable() end function s.sgcost(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:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToGrave() end function s.sgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() 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.sgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Monsters your opponent controls cannot target face-up "Ninja" monsters for attacks, except this one. Your opponent cannot target face-up "Ninja" monsters with card effects, except this one. If this card is destroyed by battle and sent to the Graveyard, or if this card in your possession is destroyed by an opponent's card effect and sent to your Graveyard: You can add 1 "Ninja" monster from your Deck to your hand, except "Twilight Ninja Shingetsu". You can only use this effect of "Twilight Ninja Shingetsu" once per turn.
--黄昏の忍者-シンゲツ --Twilight Ninja Shingetsu local s,id=GetID() function s.initial_effect(c) --untargetable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(s.atlimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.tglimit) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,id) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_NINJA} s.listed_names={id} function s.atlimit(e,c) return c:IsFaceup() and c:IsSetCard(SET_NINJA) and c~=e:GetHandler() end function s.tglimit(e,c) return c:IsSetCard(SET_NINJA) and c~=e:GetHandler() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp)) end function s.thfilter(c) return c:IsSetCard(SET_NINJA) and c:IsMonster() and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard up to 2 cards, and send the same number of "Infernity" cards from your Deck to the Graveyard.
--インフェルニティ・インフェルノ --Infernity Inferno local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_HANDES+CATEGORY_TOGRAVE) 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_INFERNITY} function s.filter(c) return c:IsSetCard(SET_INFERNITY) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 then return end local ac=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_DECK,0,nil) if ac==0 then return end if ac>2 then ac=2 end local ct=Duel.DiscardHand(tp,aux.TRUE,1,ac,REASON_DISCARD|REASON_EFFECT) Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,ct,ct,nil) Duel.SendtoGrave(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned with "Assault Mode Activate". If this card is Special Summoned: Place 2 Spell Counters on it. Gains 1000 ATK for each Spell Counter on it. You can remove 2 Spell Counters from this card; destroy all cards your opponent controls. When this card on the field is destroyed: You can target 1 "Arcanite Magician" in your GY; Special Summon that target.
--アーカナイト・マジシャン/バスター --Arcanite Magician/Assault Mode local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:EnableCounterPermit(COUNTER_SPELL) c:AddMustBeSpecialSummoned() --Place 2 Spell Counters on it local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COUNTER,e:GetHandler(),2,tp,COUNTER_SPELL) end) e1:SetOperation(s.counterop) c:RegisterEffect(e1) --Gains 1000 ATK for each Spell Counter on it local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(function(e,c) return c:GetCounter(COUNTER_SPELL)*1000 end) c:RegisterEffect(e2) --Destroy all cards your opponent controls local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCost(Cost.RemoveCounterFromSelf(COUNTER_SPELL,2)) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) --Special Summon 1 "Arcanite Magician" from your GY local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.counter_place_list={COUNTER_SPELL} s.listed_names={CARD_ASSAULT_MODE,31924889} --"Arcanite Magician" s.assault_mode=31924889 function s.counterop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then c:AddCounter(COUNTER_SPELL,2) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.spfilter(c,e,tp) return c:IsCode(31924889) 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) 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:
Special Summon this card as an Effect Monster (Rock/EARTH/Level 4/ATK 1800/DEF 1800) with the following effect (this card is also still a Trap). ● (Quick Effect): You can pay 800 LP; Special Summon 1 Continuous Trap, except "Tiki Peace", from your GY or banishment as a Normal Monster (Rock/EARTH/Level 4/ATK 1000/DEF 1000) and its name becomes "Tiki Peace" (even while face-down) (that card is NOT treated as a Trap). You can only use this effect of "Tiki Peace" once per turn.
--ピース・オブ・スタチュー --Tiki Peace --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon this card as an Effect Monster 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,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) end s.listed_names={id} function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,1800,1800,4,RACE_ROCK,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,tp,0) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and s.selfsptg(e,tp,eg,ep,ev,re,r,rp,0) then c:AddMonsterAttribute(TYPE_EFFECT|TYPE_TRAP) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) --Special Summon 1 Continuous Trap, except "Tiki Peace", from your GY or banishment as a Normal Monster and its name becomes "Tiki Peace" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) 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:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCost(Cost.PayLP(800)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) c:AddMonsterAttributeComplete() end Duel.SpecialSummonComplete() end function s.spfilter(c,tp) return c:IsContinuousTrap() and c:IsFaceup() and not c:IsCode(id) and Duel.IsPlayerCanSpecialSummonMonster(tp,id,nil,TYPE_MONSTER|TYPE_NORMAL,1000,1000,4,RACE_ROCK,ATTRIBUTE_EARTH) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) 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,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,tp):GetFirst() if not sc then return end sc:AssumeProperty(ASSUME_CODE,id) if Duel.SpecialSummonStep(sc,0,tp,tp,true,false,POS_FACEUP) then --Special Summon it as Normal Monster (Rock/EARTH/Level 4/ATK 1000/DEF 1000) and its name becomes "Tiki Peace" (even while face-down) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_NORMAL|TYPE_MONSTER) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) sc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_RACE) e2:SetValue(RACE_ROCK) sc:RegisterEffect(e2,true) local e3=e1:Clone() e3:SetCode(EFFECT_CHANGE_ATTRIBUTE) e3:SetValue(ATTRIBUTE_EARTH) sc:RegisterEffect(e3,true) local e4=e1:Clone() e4:SetCode(EFFECT_CHANGE_LEVEL) e4:SetValue(4) sc:RegisterEffect(e4,true) local e5=e1:Clone() e5:SetCode(EFFECT_SET_BASE_ATTACK) e5:SetValue(1000) sc:RegisterEffect(e5,true) local e6=e1:Clone() e6:SetCode(EFFECT_SET_BASE_DEFENSE) e6:SetValue(1000) sc:RegisterEffect(e6,true) local e7=e1:Clone() e7:SetCode(EFFECT_CHANGE_CODE) e7:SetValue(id) sc:RegisterEffect(e7,true) end Duel.SpecialSummonComplete() end