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:
"Gladiator Beast Vespasius" + 2 "Gladiator Beast" monsters Must first be Special Summoned (from your Extra Deck) by shuffling the above cards you control into the Deck. (You do not use "Polymerization".) Once per turn, when your opponent activates a monster effect (Quick Effect): You can negate the activation, and if you do, destroy it. You choose the attack targets for your opponent's attacks. At the end of the Battle Phase, if this card battled: You can return this card to the Extra Deck; Special Summon 1 "Gladiator Beast" monster from your Deck.
--剣闘獣ドミティアノス --Gladiator Beast Domitianus local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixN(c,true,true,88996322,1,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GLADIATOR),2) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.discon) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --Choose Attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_PATRICIAN_OF_DARKNESS) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(0,1) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.spcon) e3:SetCost(s.spcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.material_setcode=SET_GLADIATOR s.listed_series={SET_GLADIATOR} function s.contactfil(tp) return Duel.GetMatchingGroup(function(c) return c:IsMonster() and c:IsAbleToDeckOrExtraAsCost() end,tp,LOCATION_ONFIELD,0,nil) end function s.contactop(g,tp) Duel.ConfirmCards(1-tp,g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST|REASON_MATERIAL) end function s.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return ep==1-tp and re:IsMonsterEffect() 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():IsRelateToEffect(re) and re:GetHandler():IsDestructable() 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 function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToExtraAsCost() end Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_COST) end function s.filter(c,e,tp) return c:IsSetCard(SET_GLADIATOR) and c:IsCanBeSpecialSummoned(e,100,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)>-1 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) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,100,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT|RESETS_STANDARD_DISABLE,0,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target any face-up monster you control, except "Belial - Marquis of Darkness", for an attack, or with Spell/Trap effects.
--闇の侯爵ベリアル --Belial - Marquis of Darkness local s,id=GetID() function s.initial_effect(c) --Limit battle target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetValue(s.tg) c:RegisterEffect(e1) --Prevent effect target 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,0) e2:SetTarget(s.tg) e2:SetValue(s.tgval) c:RegisterEffect(e2) end function s.tg(e,c) return c:IsFaceup() and c:GetCode()~=id end function s.tgval(e,re,rp) return re:IsSpellTrapEffect() and rp==1-e:GetHandlerPlayer() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] When a monster(s) you control is destroyed by a card effect (except during the Damage Step): You can Special Summon this card from your Pendulum Zone. You can only use this effect of "Acrobatic Magician" once per turn. ---------------------------------------- [ Monster Effect ] If the activation of a Spell/Trap Card is negated (except during the Damage Step): You can Special Summon this card from your hand. When this card is destroyed by battle: You can place this card in your Pendulum Zone.
--曲芸の魔術師 --Acrobatic Magician local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_PZONE) e1:SetCode(EVENT_DESTROYED) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CHAIN_NEGATED) e2:SetRange(LOCATION_HAND) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.spcon2) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --pendulum set local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYED) e3:SetTarget(s.pentg) e3:SetOperation(s.penop) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,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 not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) and Duel.CheckPendulumZones(tp) then Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the turn this card is activated, if a Beast-Warrior-Type monster you control attacks a Defense Position monster, inflict piercing battle damage to your opponent. (This applies even if this card leaves the field.) All Beast-Warrior-Type monsters you control gain 300 ATK.
--炎舞-「開陽」 --Fire Formation - Kaiyo 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:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetOperation(s.activate) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_BEASTWARRIOR)) e2:SetValue(300) c:RegisterEffect(e2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_PIERCE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_BEASTWARRIOR)) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a card or effect that targets a monster(s) you control, except a Token: You can Tribute 1 monster; Special Summon 1 "Escapegoat Token" (Beast/EARTH/Level 1/ATK 0/DEF 0) in Defense Position. If a non-Token monster(s) you control would be destroyed by battle or card effect, you can destroy 1 Token in your Monster Zone instead.
--エスケープ・ゴート --Escapegoat --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) --Special Summon 1 "Escaped Sheep Token" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.tkcon) e2:SetCost(s.tkcost) e2:SetTarget(s.tktg) e2:SetOperation(s.tkop) c:RegisterEffect(e2) --Destruction replacement local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_SZONE) e3:SetTarget(s.desreptg) e3:SetValue(s.desrepval) e3:SetOperation(s.desrepop) c:RegisterEffect(e3) end s.listed_names={id+1} --"Escaped Sheep Token" function s.tgtfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and not c:IsType(TYPE_TOKEN) end function s.tkcon(e,tp,eg,ep,ev,re,r,rp) if not (rp==1-tp and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET)) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.tgtfilter,1,nil,tp) end function s.cstfilter(c,tp) return Duel.GetMZoneCount(tp,c)>0 end function s.tkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cstfilter,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.cstfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_BEAST,ATTRIBUTE_EARTH,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_BEAST,ATTRIBUTE_EARTH,POS_FACEUP_DEFENSE) then return end local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end function s.repfilter(c,tp) return c:IsControler(tp) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE) and c:IsLocation(LOCATION_MZONE) and not c:IsType(TYPE_TOKEN) end function s.desfilter(c,e) return c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED|STATUS_BATTLE_DESTROYED) end function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,0,nil,TYPE_TOKEN) if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp) and g:IsExists(s.desfilter,1,nil,e) end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local sg=g:FilterSelect(tp,s.desfilter,1,1,nil,e) e:SetLabelObject(sg:GetFirst()) Duel.HintSelection(sg,true) sg:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true) return true else return false end end function s.desrepval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.desrepop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() tc:SetStatus(STATUS_DESTROY_CONFIRMED,false) Duel.Destroy(tc,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Trakodon" + "Flame Viper"
--プラグティカル --Pragtical local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,42348802,2830619) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: Place 2 counters on it. It gains 500 ATK for each of these counters. If this card would be destroyed by battle, remove 1 of these counters instead.
--デス・モスキート --Des Mosquito local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x27) --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) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --attackup local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(s.attackup) c:RegisterEffect(e3) --destroy replace local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetCode(EFFECT_DESTROY_REPLACE) e4:SetRange(LOCATION_MZONE) e4:SetTarget(s.reptg) 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,1,0,0x27) end function s.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():AddCounter(0x27,2) end end function s.attackup(e,c) return c:GetCounter(0x27)*500 end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():IsCanRemoveCounter(tp,0x27,1,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x27,1,REASON_EFFECT) return true end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner monsters If this card is Special Summoned, or a Level 5 or higher monster(s) is Special Summoned to your opponent's side of the field: Target 1 Special Summoned monster your opponent controls; return that target to the hand. You can only use this effect of "Black Rose Moonlight Dragon" once per turn.
--月華竜 ブラック・ローズ --Black Rose Moonlight Dragon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --tohand 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCode(EVENT_CUSTOM+id) c:RegisterEffect(e2) --event local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.evcon) e3:SetOperation(s.evop) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:IsFaceup() and c:IsLevelAbove(5) and c:IsControler(tp) end function s.evcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter,1,nil,1-tp) end function s.evop(e,tp,eg,ep,ev,re,r,rp) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,re,r,rp,ep,ev) end function s.filter(c) return c:IsSpecialSummoned() and c:IsAbleToHand() end function s.thtg(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 true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,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:
When this card is Normal Summoned: You can target 1 "Utopia" monster in your Graveyard; Special Summon that target. You can target 1 "Number C39: Utopia Ray V" you control; equip this monster you control to that target. Once per turn, while this card is equipped to a monster: You can detach 1 Xyz Material from the equipped monster; negate the equipped monster's effects (even after this card leaves the field or the monster becomes unaffected by card effects), and if you do, destroy all monsters your opponent controls, and if you do that, inflict 1000 damage to your opponent for each monster destroyed by this effect.
--Vサラマンダー --V Salamander local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Utopia" monster from your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Equip this card to 1 "Number C39: Utopia Ray V" you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) --Destroy all monsters your opponent controls local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY+CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end) e3:SetCost(s.descost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_series={SET_UTOPIA} s.listed_names={66970002} function s.spfilter(c,e,tp) return c:IsSetCard(SET_UTOPIA) 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.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsCode(66970002) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsCode,66970002),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsCode,66970002),tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() or c:IsControler(1-tp) then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsControler(1-tp) or tc:IsFacedown() or not tc:IsRelateToEffect(e) or not tc:IsCode(66970002) then Duel.SendtoGrave(c,REASON_RULE) return end Duel.Equip(tp,c,tc,true) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetLabelObject(tc) e1:SetValue(function(e,c) return c==e:GetLabelObject() end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local ec=e:GetHandler():GetEquipTarget() if chk==0 then return ec:CheckRemoveOverlayCard(tp,1,REASON_COST) end ec:RemoveOverlayCard(tp,1,1,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local ec=e:GetHandler():GetEquipTarget() local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil) if chk==0 then return #g>0 and ec:IsNegatableMonster() end Duel.SetTargetCard(ec) Duel.SetOperationInfo(0,CATEGORY_DISABLE,ec,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*1000) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local ec=Duel.GetFirstTarget() if not (ec:IsRelateToEffect(e) and ec:IsNegatableMonster() and not ec:IsImmuneToEffect(e)) then return end ec:NegateEffects(e:GetHandler()) local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil) local ct=Duel.Destroy(g,REASON_EFFECT) if ct>0 then Duel.Damage(1-tp,ct*1000,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Return up to 3 "Volcanic" Monster Cards from your Graveyard to your Deck.
--ヴォルカニック・チャージ --Volcanic Recharge local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_VOLCANIC} function s.filter(c) return c:IsSetCard(SET_VOLCANIC) and c:IsMonster() and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) if #sg>0 then Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is discarded to the GY by card effect: Special Summon this card.
--暗黒界の尖兵 ベージ --Beiige, Vanguard of Dark World 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_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetPreviousLocation()==LOCATION_HAND and r&(REASON_DISCARD|REASON_EFFECT)==REASON_DISCARD|REASON_EFFECT 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,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),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 Standby Phases, inflict 100 points of damage to your opponent's Life Points for each of your opponent's monsters that have been removed from play.
--墓荒らしの報い --Graverobber's Retribution 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) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.filter(c) return c:IsFaceup() and c:IsMonster() 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.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local d=Duel.GetMatchingGroupCount(s.filter,tp,0,LOCATION_REMOVED,nil)*100 Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can equip 1 of your banished Level 4 LIGHT Machine monsters to this card as an Equip Spell, also you cannot Special Summon from the Extra Deck for the rest of this turn, except LIGHT monsters. Once per turn, you can either: Target 1 Machine monster you control; equip this card to that target, OR: Unequip this card and Special Summon it. If the equipped monster would be destroyed by battle or card effect, destroy this card instead.
--Z-ジリオン・キャタピラー --Z-Zillion Tank --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Equip 1 Level 4 LIGHT Machine monster from your hand or GY to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,function(ec,c,tp) return ec:IsControler(tp) and s.eqfilter(ec,tp) end,Card.EquipByEffectAndLimitRegister,e1) --Union procedure aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE)) end function s.eqfilter(c,tp) return c:IsLevel(4) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:CheckUniqueOnField(tp) and not c:IsForbidden() and c:IsFaceup() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_REMOVED,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_REMOVED) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:IsRelateToEffect(e) and c:IsFaceup() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_REMOVED,0,1,1,nil,tp):GetFirst() if ec then c:EquipByEffectAndLimitRegister(e,tp,ec,nil,true) end end --Cannot Special Summon from the Extra Deck for the rest of this turn, except LIGHT monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsAttribute(ATTRIBUTE_LIGHT) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalAttribute(ATTRIBUTE_LIGHT) end) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned. Neither player can activate monster effects.
--威光魔人 --Majesty's Fiend local s,id=GetID() function s.initial_effect(c) --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) --act limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetValue(s.aclimit) c:RegisterEffect(e2) end function s.aclimit(e,re,tp) return re:IsMonsterEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be treated as 2 Tributes for the Tribute Summon of a Dragon monster. You can banish this card from your GY, then target 1 Level 5 or higher Dragon monster in your GY; add it to your hand, then, immediately after this effect resolves, you can Tribute Summon that monster. You can only use this effect of "Samsara Dragon" once per turn.
--輪廻竜サンサーラ --Samsara Dragon --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Double tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DOUBLE_TRIBUTE) e1:SetValue(s.condition) c:RegisterEffect(e1) --Add 1 Dragon to the hand, then Normal Summon local e2=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.condition(e,c) return c:IsRace(RACE_DRAGON) end function s.thfilter(c) return c:IsRace(RACE_DRAGON) and c:IsLevelAbove(5) 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,e:GetHandler()) 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) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 then if tc:IsSummonable(true,nil,1) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Summon(tp,tc,true,nil,1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cyberse Link Monsters you control cannot be destroyed by your opponent's card effects. Once per turn, during the Battle Step, if your monster battles an opponent's monster: You can activate this effect; that opponent's monster's ATK becomes 0 until the end of this turn, also for that battle, monsters cannot be destroyed by battle and neither player takes battle damage. That opponent's monster must be face-up on the field to activate and to resolve this effect. When your opponent activates a card or effect during a Damage Step that your "Code Talker" monster is attacking in: You can banish this card from your GY; negate the activation, and if you do, your attacking monster gains 700 ATK.
--コード・ハック --Code Hack --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Cyberse Link monsters you control cannot be destroyed by your opponent's card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c:IsRace(RACE_CYBERSE) and c:IsLinkMonster() end) e1:SetValue(aux.indoval) c:RegisterEffect(e1) --Make that opponent's monster's ATK becomes 0 until the end of this turn, also for that battle, monsters cannot be destroyed by battle and neither player takes battle damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetHintTiming(TIMING_BATTLE_PHASE) e2:SetCondition(function() return Duel.IsPhase(PHASE_BATTLE_STEP) end) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --Negate the activation of an opponent's effect in the Damage Step local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_NEGATE+CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(s.negcon) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.negtg) e3:SetOperation(s.negop) c:RegisterEffect(e3) end s.listed_series={SET_CODE_TALKER} function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local sc,oc=Duel.GetBattleMonster(tp) if chk==0 then return sc and oc and oc:IsFaceup() and oc:GetAttack()>0 end Duel.SetTargetCard(Group.FromCards(oc,sc)) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tg=Duel.GetTargetCards(e) if #tg>0 then local oc=tg:GetFirst() if oc:IsControler(tp) then oc=tg:GetNext() end if oc and oc:IsFaceup() then --Change ATK to 0 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) oc:RegisterEffect(e1) end for tc in tg:Iter() do --Cannot be destroyed by that battle local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) tc:RegisterEffect(e2) end end --Take no battle damage from that battle local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetTargetRange(1,1) e3:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e3,tp) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) if Duel.GetCurrentPhase()&(PHASE_DAMAGE|PHASE_DAMAGE_CAL)==0 or Duel.IsDamageCalculated() then return false end local a=Duel.GetAttacker() return a:IsControler(tp) and a:IsSetCard(SET_CODE_TALKER) and ep==1-tp and Duel.IsChainNegatable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(Duel.GetAttacker()) Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) then local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToBattle() then --Gains 700 ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(700) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Dracotail" monster + 1+ monsters in the hand If this card is Fusion Summoned: You can target monsters on the field and/or GYs, up to the number of monsters used as material from the hand; return them to the hand. If 2 or more monsters are sent to the GY at the same time, while this card is in your GY (except during the Damage Step): You can Special Summon this card, but banish it when it leaves the field. You can only use each effect of "Dracotail Arthalion" once per turn.
--星辰爪竜アルザリオン --Dracotail Arthalion --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: 1 "Dragontail" monster + 1+ monsters in the hand Fusion.AddProcMixRep(c,true,true,aux.FilterBoolFunctionEx(Card.IsLocation,LOCATION_HAND),1,99,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_DRACOTAIL)) --Register how many materials are used from the hand local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_MATERIAL_CHECK) e0:SetValue(function(e,c) e:SetLabel(c:GetMaterial():FilterCount(Card.IsLocation,nil,LOCATION_HAND)) end) c:RegisterEffect(e0) --Return monsters on the field and/or in any GY(s) to the hand, up to the number of monsters used as material from 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():IsFusionSummoned() and e:GetLabelObject():GetLabel()>0 end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) e1:SetLabelObject(e0) c:RegisterEffect(e1) --Special Summon this card from the GY, but banish it when it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_CUSTOM+id) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Keep track of monsters being sent to the GY at the same time local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_TO_GRAVE) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e3:SetOperation(s.regop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_CHAINING) e4:SetOperation(function(e) e:GetHandler():ResetFlagEffect(id+1) end) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_CHAIN_SOLVED) c:RegisterEffect(e5) local e6=e4:Clone() e6:SetCode(EVENT_BREAK_EFFECT) c:RegisterEffect(e6) end s.listed_series={SET_DRACOTAIL} function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsMonster() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end local ct=e:GetLabelObject():GetLabel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.SendtoHand(tg,nil,REASON_EFFECT) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=eg:FilterCount(Card.IsMonster,nil) if ct==0 or eg:IsContains(c) then return end if ct>=2 or c:HasFlagEffect(id+1) then Duel.RaiseSingleEvent(c,EVENT_CUSTOM+id,re,r,rp,ep,ev) end local eff=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_EFFECT) if eff then c:RegisterFlagEffect(id+1,RESET_EVENT|RESETS_STANDARD|RESET_CHAIN,0,1) end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it when it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent's Life Points are higher than 3000: Inflict 1000 damage to your opponent.
--デス・メテオ --Meteor of Destruction local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(1-tp)>3000 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:
During your Main Phase, you can activate 1 "Attraction" Trap the turn it was Set. During the End Phase: You can send 1 "Attraction" Trap you control equipped to a monster to the GY, then target 1 of your "Attraction" Traps, with a different name, that is banished or in your GY; Set that card. You can only use each effect of "Amazement Precious Park" once per turn.
--アメイズメント・プレシャスパーク --Amazement Precious Park --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) --"Attraction" Trap cards can be activated during the turn they are set (during your Main Phase) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_SZONE,0) e2:SetCondition(function(e) return Duel.IsMainPhase() and Duel.IsTurnPlayer(e:GetHandlerPlayer()) end) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_ATTRACTION)) e2:SetDescription(aux.Stringid(id,0)) e2:SetCountLimit(1,id) c:RegisterEffect(e2) --Set 1 "Attraction" Trap that is banished or in the GY local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,{id,1}) e3:SetCost(s.setcost) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) end s.listed_series={SET_ATTRACTION} function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.eqfilter(c,ec) return c:GetEquipGroup():IsContains(ec) end function s.setfilter(c,ec) return c:IsTrap() and c:IsSetCard(SET_ATTRACTION) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and not c:IsCode(ec:GetCode()) and c:IsSSetable(true) end function s.cfilter(c,tp) return c:IsFaceup() and c:IsTrap() and c:IsSetCard(SET_ATTRACTION) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,c) and Duel.IsExistingTarget(s.setfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,c) end function s.settg(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.setfilter(chkc,e:GetLabelObject()) end if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return Duel.GetLocationCount(tp,LOCATION_SZONE)>-1 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_SZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local gc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_SZONE,0,1,1,nil,tp):GetFirst() e:SetLabelObject(gc) Duel.SendtoGrave(gc,REASON_COST) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,gc) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSSetable() then Duel.SSet(tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only as Chain Link 3 or higher (Quick Effect): You can Special Summon this card from your hand. Spell Cards that have been activated are banished instead of being sent to the GY. The ATK/DEF of this card are each equal to the number of Spells in your opponent's GY x 500. You can only control 1 "Winged Kuriboh LV9".
--ハネクリボー LV9 --Winged Kuriboh LV9 local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_TO_GRAVE_REDIRECT) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e2:SetTarget(s.rmtarget) e2:SetValue(LOCATION_REMOVED) c:RegisterEffect(e2) --atk,def local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_SET_ATTACK) e3:SetRange(LOCATION_MZONE) e3:SetValue(s.val) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_SET_DEFENSE) c:RegisterEffect(e4) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) ge1:SetCode(EVENT_CHAINING) ge1:SetOperation(s.checkop1) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_CHAIN_NEGATED) ge2:SetOperation(s.checkop2) Duel.RegisterEffect(ge2,0) end) end s.listed_names={id} --not standard, but required for Level Up! s.LVnum=9 s.LVset=SET_WINGED_KURIBOH function s.checkop1(e,tp,eg,ep,ev,re,r,rp) if re and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() then re:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end end function s.checkop2(e,tp,eg,ep,ev,re,r,rp) if re and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() then re:GetHandler():ResetFlagEffect(id) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain(true)>=2 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,id)==0 and 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) Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.rmtarget(e,c) return c:IsFaceup() and c:GetFlagEffect(id)>0 and Duel.IsPlayerCanRemove(e:GetHandlerPlayer(),c) end function s.val(e,c) return Duel.GetMatchingGroupCount(Card.IsSpell,c:GetControler(),0,LOCATION_GRAVE,nil)*500 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 9 monsters Once per turn: You can detach 1 material from this card, then target 1 card your opponent controls; destroy it, then, if it was a monster, inflict damage to your opponent equal to its original ATK.
--CNo.15 ギミック・パペット-シリアルキラー --Number C15: Gimmick Puppet Giant Hunter local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,9,3) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.xyz_number=15 function s.target(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(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,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) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and tc:IsPreviousLocation(LOCATION_MZONE) then local atk=tc:GetTextAttack() if atk<0 then atk=0 end Duel.Damage(1-tp,atk,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 8 monsters You can detach 1 material from this card, then target 1 monster on the field; Tribute it. This is a Quick Effect if this card has a Plant monster as material. You can only use this effect of "Teardrop the Rikka Queen" once per turn. Each time a monster(s) is Tributed: This card gains 200 ATK for each, until the end of this turn.
--六花聖ティアドロップ --Teardrop the Rikka Queen --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 8 monsters Xyz.AddProcedure(c,nil,8,2) --Tribute 1 monster on the field local e1a=Effect.CreateEffect(c) e1a:SetDescription(aux.Stringid(id,0)) e1a:SetCategory(CATEGORY_RELEASE) e1a:SetType(EFFECT_TYPE_IGNITION) e1a:SetProperty(EFFECT_FLAG_CARD_TARGET) e1a:SetRange(LOCATION_MZONE) e1a:SetCountLimit(1,id) e1a:SetCondition(aux.NOT(s.quickcon)) e1a:SetCost(Cost.DetachFromSelf(1)) e1a:SetTarget(s.tribtg) e1a:SetOperation(s.tribop) c:RegisterEffect(e1a) local e1b=e1a:Clone() e1b:SetType(EFFECT_TYPE_QUICK_O) e1b:SetCode(EVENT_FREE_CHAIN) e1b:SetCondition(s.quickcon) e1b:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1b) --This card gains 200 ATK for each monster Tributed, until the end of this turn local e2a=Effect.CreateEffect(c) e2a:SetDescription(aux.Stringid(id,1)) e2a:SetCategory(CATEGORY_ATKCHANGE) e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2a:SetCode(EVENT_CUSTOM+id) e2a:SetRange(LOCATION_MZONE) e2a:SetOperation(s.atkop) c:RegisterEffect(e2a) --Keep track of the number of Tributed monsters and raise the custom event using that number as the event value local e2b=Effect.CreateEffect(c) e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2b:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2b:SetCode(EVENT_RELEASE) e2b:SetRange(LOCATION_MZONE) e2b:SetOperation(s.regop) c:RegisterEffect(e2b) end function s.tribtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsReleasableByEffect() end if chk==0 then return Duel.IsExistingTarget(Card.IsReleasableByEffect,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectTarget(tp,Card.IsReleasableByEffect,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_RELEASE,g,1,tp,0) end function s.tribop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Release(tc,REASON_EFFECT) end end function s.quickcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_PLANT) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --This card gains 200 ATK for each, until the end of this turn c:UpdateAttack(ev*200,RESETS_STANDARD_DISABLE_PHASE_END) end end function s.atkconfilter(c) return c:IsPreviousLocation(LOCATION_MZONE) or (not c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsMonster()) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local ct=eg:FilterCount(s.atkconfilter,nil) if ct>0 then Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,re,r,rp,ep,ct) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each player draws 1 card, and neither player takes damage until the end of the opponent's next turn.
--一時休戦 --One Day of Peace local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_DRAW) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local d1=Duel.Draw(tp,1,REASON_EFFECT) local d2=Duel.Draw(1-tp,1,REASON_EFFECT) if d1==0 or d2==0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,1) e1:SetValue(0) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_NO_EFFECT_DAMAGE) e2:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e3:SetDescription(aux.Stringid(id,1)) e3:SetReset(RESET_PHASE|PHASE_END,2) e3:SetTargetRange(1,1) Duel.RegisterEffect(e3,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only activate this card when "Pot of Greed" is activated. Negate the effect of the "Pot of Greed" and draw 1 card from your Deck.
--壺盗み --Jar Robber local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={55144522} function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(55144522) and Duel.IsChainNegatable(ev) 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_DISABLE,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(ev) then Duel.Draw(tp,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target face-up cards your opponent controls, up to the number of "Ryzeal" Xyz Monsters you control; destroy them, then you can attach 1 "Ryzeal" card from your GY to 1 Rank 4 Xyz Monster you control. You can banish this card from your GY; immediately after this effect resolves, Xyz Summon 1 Xyz Monster using monsters you control, including a "Ryzeal" monster. You can only use each effect of "Ryzeal Plasma Hole" once per turn.
--ライゼオル・ホールスラスター --Ryzeal Plasma Hole --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Destroy face-up cards your opponent controls up to the number of "Ryzeal" Xyz monsters you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_LEAVE_GRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Xyz Summon using monsters you control, including a "Ryzeal" 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_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.xyztg) e2:SetOperation(s.xyzop) c:RegisterEffect(e2) end s.listed_series={SET_RYZEAL} function s.desconfilter(c) return c:IsSetCard(SET_RYZEAL) and c:IsType(TYPE_XYZ) and c:IsFaceup() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsFaceup() and chkc:IsControler(1-tp) end local ct=Duel.GetMatchingGroupCount(s.desconfilter,tp,LOCATION_MZONE,0,nil) if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,ct,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) end function s.attachfilter(c,tp) return c:IsSetCard(SET_RYZEAL) and Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil,c,tp) end function s.xyzfilter(c,mc,tp) return c:IsType(TYPE_XYZ) and c:IsRank(4) and c:IsFaceup() and mc:IsCanBeXyzMaterial(c,tp,REASON_EFFECT) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.attachfilter),tp,LOCATION_GRAVE,0,1,nil,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACH) local mc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.attachfilter),tp,LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() if not mc then return end Duel.HintSelection(mc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local xyzc=Duel.SelectMatchingCard(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil,mc,tp):GetFirst() if not xyzc:IsImmuneToEffect(e) then Duel.BreakEffect() Duel.Overlay(xyzc,mc) end end end function s.raizeolmatfilter(c,tp) return c:IsSetCard(SET_RYZEAL) and c:IsFaceup() and Duel.IsExistingMatchingCard(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,nil,c) end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.raizeolmatfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local g=Duel.SelectMatchingCard(tp,s.raizeolmatfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) if #g==0 then return end Duel.HintSelection(g) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xyzc=Duel.SelectMatchingCard(tp,Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,1,nil,g):GetFirst() if xyzc then Duel.XyzSummon(tp,xyzc,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent Special Summons a monster(s) with the same card type (Fusion, Synchro, Xyz, or Link) as a "D/D/D" monster you control (except during the Damage Step): You can inflict 1000 damage to your opponent, also, while this card is on the field, your opponent cannot Special Summon monsters with the same card type as that Special Summoned monster for the rest of this turn. If this card is sent to the GY: You can add 1 "D/D" monster from your GY, or 1 face-up "D/D" Pendulum Monster from your Extra Deck, to your hand. You can only use this effect of "Dark Contract with Patent License" once per turn.
--特許権の契約書類 --Dark Contract with Patent License --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) --Inflict 1000 Damage to the opponent and prevent Special Summons local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CUSTOM+id) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_FZONE) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --Keep track of the summoned monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetRange(LOCATION_FZONE) e3:SetLabelObject(e2) e3:SetOperation(s.regop) c:RegisterEffect(e3) --Add 1 "D/D" monster to the hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,id) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end s.listed_series={SET_DDD,SET_DD} function s.damcfilter(c,tp) local ty=c:GetType()&(TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ|TYPE_LINK) return c:IsSummonPlayer(1-tp) and ty~=0 and Duel.IsExistingMatchingCard(s.damcfilter2,tp,LOCATION_MZONE,0,1,nil,ty) end function s.damcfilter2(c,ty) return c:IsFaceup() and c:IsSetCard(SET_DDD) and c:IsType(ty) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local tg=eg:Filter(s.damcfilter,nil,tp) if #tg>0 then for tc in tg:Iter() do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=e:GetLabelObject() if chk==0 then return #g>0 and Duel.GetFlagEffect(tp,id)==0 end Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) 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 c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) local ty=0 local g=e:GetLabelObject() for tc in aux.Next(g) do ty=ty | tc:GetType() end ty=ty & (TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ|TYPE_LINK) --Cannot Special Summon monsters of the same type local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_FZONE) e1:SetTargetRange(0,1) e1:SetTarget(s.sumlimit) e1:SetLabel(ty) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp) local typ=e:GetLabel() if c:IsMonster() then return c:IsType(typ) else return c:IsOriginalType(typ) end end function s.thfilter(c) return c:IsMonster() and c:IsSetCard(SET_DD) and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA)) 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_EXTRA|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA|LOCATION_GRAVE) end function s.thop(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_EXTRA|LOCATION_GRAVE,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:
[ Pendulum Effect ] When a Pendulum Monster you control is destroyed by battle: You can Special Summon this card from your Pendulum Zone. ---------------------------------------- [ Monster Effect ] Once per turn, if a Pendulum Monster you control destroys an opponent's monster by battle, after damage calculation: You can make that monster you control gain 200 ATK until the end of the Battle Phase, and if you do, it can make a second attack in a row.
--EMファイア・マフライオ --Performapal Fire Mufflerlion local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetRange(LOCATION_PZONE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --chain attack local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLED) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.cacon) e3:SetOperation(s.caop) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:IsType(TYPE_PENDULUM) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,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 not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.cacon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not d then return false end if a:IsStatus(STATUS_OPPO_BATTLE) and d:IsControler(tp) then a,d=d,a end if a:IsType(TYPE_PENDULUM) and not a:IsStatus(STATUS_BATTLE_DESTROYED) and d:IsStatus(STATUS_BATTLE_DESTROYED) then e:SetLabelObject(a) return true else return false end end function s.caop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsFaceup() and tc:IsControler(tp) and tc:IsRelateToBattle() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(200) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e1) if tc:CanChainAttack() then Duel.ChainAttack() end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn: You can target 1 face-up monster your opponent controls; that face-up monster has its effects negated until the end of this turn (even if this card leaves the field). ---------------------------------------- [ Monster Effect ] When this card is Normal or Special Summoned: You can target 1 Set Spell/Trap Card your opponent controls; that Set card cannot be activated this turn. Neither player can activate cards or effects in response to this effect's activation.
--EMシール・イール --Performapal Seal Eel local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Disable effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --Lock S&T local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetTarget(s.lcktg) e2:SetOperation(s.lckop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end function s.distg(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:IsNegatableMonster() end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.disop(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 tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.lcktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(1-tp) and chkc:IsFacedown() end if chk==0 then return Duel.IsExistingTarget(Card.IsFacedown,tp,0,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) Duel.SelectTarget(tp,Card.IsFacedown,tp,0,LOCATION_SZONE,1,1,nil) Duel.SetChainLimit(aux.FALSE) end function s.lckop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If only your opponent controls a monster, or if you control an EARTH monster, you can Normal Summon this card without Tributing. If this card is Normal or Special Summoned: You can Special Summon 1 Level 5 EARTH Warrior monster from your hand. You can only use this effect of "Tenma the Sky Star" once per turn. Once per turn, when your opponent activates a card or effect that targets a Warrior monster you control (Quick Effect): You can make this card lose exactly 500 ATK, and if you do, negate the activation, and if you do that, destroy that card.
--天昇星テンマ --Tenma the Sky Star local s,id=GetID() function s.initial_effect(c) --summon with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) e1:SetValue(1) c:RegisterEffect(e1) --spsummon 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+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --negate local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.discon) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end function s.cfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_EARTH) end function s.ntcon(e,c,minc) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and ((Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0) or Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)) end function s.filter1(c,e,tp) return c:IsRace(RACE_WARRIOR) and c:IsLevel(5) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter1,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.filter1,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.filter2(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_WARRIOR) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if rp==tp or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(s.filter2,1,nil,tp) 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) local c=e:GetHandler() if c:IsFacedown() or c:GetAttack()<500 or not c:IsRelateToEffect(e) or Duel.GetCurrentChain()~=ev+1 or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-500) c:RegisterEffect(e1) if not c:IsImmuneToEffect(e1) and not c:IsHasEffect(EFFECT_REVERSE_UPDATE) then if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 face-up Level 4 Gemini monster, then target 1 card on the field; destroy it, and if you do, draw 1 card.
--デュアルスパーク --Gemini Spark local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_card_types={TYPE_GEMINI} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.spcheck(sg,tp,exg,dg) local a=0 for c in aux.Next(sg) do if dg:IsContains(c) then a=a+1 end for tc in aux.Next(c:GetEquipGroup()) do if dg:IsContains(tc) then a=a+1 end end end return #dg-a>=1 end function s.cfilter(c) return c:IsFaceup() and c:IsLevel(4) and c:IsType(TYPE_GEMINI) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler(),e) if chk==0 then if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return false end if e:GetLabel()==1 then e:SetLabel(0) return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,s.spcheck,nil,dg) else return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end end if e:GetLabel()==1 then local sg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,s.spcheck,nil,dg) Duel.Release(sg,REASON_COST) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.Draw(tp,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 LIGHT or DARK monster in either GY; banish it, and if you do, Special Summon this card from your hand. This is a Quick Effect if your opponent controls a monster. If this card is Special Summoned: You can activate this effect; during the End Phase of this turn, add 1 Dragon monster from your Deck or GY to your hand, except "Bystial Magnamhut". You can only use each effect of "Bystial Magnamhut" once per turn.
--深淵の獣マグナムート --Bystial Magnamhut --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand (Ignition) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(aux.NOT(s.spquickcon)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Summon itself from the hand (Quick if the opponent controls monsters) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCondition(s.spquickcon) c:RegisterEffect(e2) --Search 1 Dragon monster in the End Phase after it is Special Summoned local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.regtg) e3:SetOperation(s.regop) c:RegisterEffect(e3) end s.listed_names={id} function s.spfilter(c,tp) return c:IsAttribute(ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) and c:IsFaceup() and Duel.GetMZoneCount(tp,c)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.spfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_GRAVE,1,nil,tp) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_REMOVED) and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.spquickcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 end function s.regtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:IsRace(RACE_DRAGON) and not c:IsCode(id) and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent from the field to the GY: You can Special Summon 1 Level 4 or lower "Naturia" monster from your Deck in Attack Position.
--ナチュル・クリフ --Naturia Cliff 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_DAMAGE_STEP) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_NATURIA} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.filter(c,e,tp) return c:IsSetCard(SET_NATURIA) and c:IsLevelBelow(4) 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) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a Warrior or FIRE monster. It gains 300 ATK. At the end of the Damage Step, if the equipped monster attacked: You can send this card to the GY; during this Battle Phase, each of your Warrior monsters and FIRE monsters can make a second attack. If this card is sent to the GY, or banished, to activate a monster effect: You can add this card to your hand. You can only use this effect of "Phoenix Gearblade" once per turn.
--フェニックス・ギア・ブレード --Phoenix Gearblade --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Equip only to a FIRE or Warrior monster aux.AddEquipProcedure(c,nil,s.cfilter) --Increase ATK by 300 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(300) c:RegisterEffect(e1) --Your Warrior and FIRE monsters can make a second ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetRange(LOCATION_SZONE) e2:SetCondition(function(e) return e:GetHandler():GetEquipTarget()==Duel.GetAttacker() end) e2:SetCost(s.extratkcost) e2:SetOperation(s.extratkop) c:RegisterEffect(e2) --Add itself to the hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,id) e3:SetCondition(s.thcond) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_REMOVE) c:RegisterEffect(e4) end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) or c:IsRace(RACE_WARRIOR) end function s.extratkcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and not Duel.HasFlagEffect(tp,id) end Duel.SendtoGrave(c,REASON_COST) end function s.extratkop(e,tp,eg,ep,ev,re,r,rp) if Duel.HasFlagEffect(tp,id) then return end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) --Your Warrior and FIRE monsters can attack twice local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c:IsAttribute(ATTRIBUTE_FIRE) or c:IsRace(RACE_WARRIOR) end) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_BATTLE) Duel.RegisterEffect(e1,tp) end function s.thcond(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsMonsterEffect() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Standby Phase: Place 1 counter on this card. This card must be in face-up Defense Position to activate and to resolve this effect. You can banish cards in your GY equal to the number of counters on this card, then target that many Spells/Traps on the field; destroy them, then remove all counters from this card. * The above text is unofficial and describes the card's functionality in the OCG.
--ダーク・カタパルター --Dark Catapulter local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x28) --counter local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.addccon) e1:SetTarget(s.addct) e1:SetOperation(s.addc) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.addccon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and e:GetHandler():IsDefensePos() 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,1,0,0x28) end function s.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():AddCounter(0x28,1) end end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetHandler():GetCounter(0x28) if chk==0 then return ct>0 and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_GRAVE,0,ct,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,0,ct,ct,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.filter(c) return c:IsSpellTrap() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) end local ct=e:GetHandler():GetCounter(0x28) if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,ct,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,ct,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if g:FilterCount(Card.IsRelateToEffect,nil,e)==#g then Duel.Destroy(g,REASON_EFFECT) end local ct=e:GetHandler():GetCounter(0x28) e:GetHandler():RemoveCounter(tp,0x28,ct,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Tearlaments" monster or "Visas Starfrost" from your Deck or GY, then send 1 monster you control to the GY, with the same Type or Attribute as that Special Summoned monster. If this card is sent to the GY by card effect: You can target 1 of your banished "Tearlaments" Traps; add it to your hand. You can only use 1 "Tearlaments Grief" effect per turn, and only once that turn.
--壱世壊に渦巻く反響 --Tearlaments Grief --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+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 "Tearalaments" Trap to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsReason(REASON_EFFECT) end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={CARD_VISAS_STARFROST} s.listed_series={SET_TEARLAMENTS} function s.spfilter(c,e,tp) return (c:IsSetCard(SET_TEARLAMENTS) or c:IsCode(CARD_VISAS_STARFROST)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_MZONE) end function s.tgfilter(c,race,att) return c:IsFaceup() and (c:IsRace(race) or c:IsAttribute(att)) and c:IsAbleToGrave() end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if not sc or Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,sc:GetRace(),sc:GetAttribute()) if #g>0 then Duel.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT) end end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_TEARLAMENTS) and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,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:
During damage calculation, in either player's turn, if a "Six Samurai" monster you control battles: You can send this card from your hand to the Graveyard; that monster cannot be destroyed by battle this turn.
--紫炎の寄子 --Shien's Squire local s,id=GetID() function s.initial_effect(c) --Your battling "Six Samurai" monster cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCondition(s.con) e1:SetCost(s.cost) e1:SetOperation(s.op) c:RegisterEffect(e1) end s.listed_series={SET_SIX_SAMURAI} function s.con(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() return d and ((a:IsControler(tp) and a:IsSetCard(SET_SIX_SAMURAI)) or (d:IsControler(tp) and d:IsSetCard(SET_SIX_SAMURAI))) and Duel.GetFlagEffect(tp,id)==0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_DAMAGE_CAL,0,1) end function s.op(e,tp,eg,ep,ev,re,r,rp,chk) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not a:IsRelateToBattle() or not d:IsRelateToBattle() then return end --Cannot be destroyed by battle local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3000) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetOwnerPlayer(tp) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) if a:IsControler(tp) then a:RegisterEffect(e1) else d:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Cyberse monsters At the start of your Battle Phase: You can activate this effect; this Battle Phase, this card can make attacks on your opponent's monsters, up to the number of monsters this card currently points to +1, but this turn, when it attacks your opponent's only monster, this card loses 400 ATK during that damage calculation only. At the end of each Battle Phase: You can draw cards equal to the number of monsters this card destroyed by battle this turn.
--シューティングコード・トーカー --Shootingcode Talker --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Link summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2) --Must be properly summoned before reviving c:EnableReviveLimit() --Make multiple attacks this turn local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE|PHASE_BATTLE_START) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Draw cards equal to number of monsters this card destroyed local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCondition(aux.bdcon) e3:SetOperation(s.bdop) c:RegisterEffect(e3) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLinkedGroupCount()>0 end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local ct=c:GetLinkedGroupCount() if ct~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK_MONSTER) e1:SetValue(ct) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) c:RegisterEffect(e1) end local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCondition(s.atkcon) e2:SetValue(-400) e2:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e2) end function s.atkcon(e) local c=e:GetHandler() if Duel.GetAttackTarget()==nil then return end return Duel.IsPhase(PHASE_DAMAGE_CAL) and Duel.GetFieldGroupCount(e:GetHandlerPlayer(),0,LOCATION_MZONE)==1 end function s.bdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetFlagEffectLabel(id) then c:SetFlagEffectLabel(id,c:GetFlagEffectLabel(id)+1) else c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1,1) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffectLabel(id) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetHandler():GetFlagEffectLabel(id) if chk==0 then return Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ct) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) end function s.drop(e,tp,eg,ep,ev,re,r,rp,chk) 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:
Once per turn, during your End Phase, pay 500 LP or destroy this card. Each player receives effects, depending on the monster Attributes they control. ● LIGHT: Play with your hand revealed at all times. ● DARK: If you control 2 or more monsters, you cannot declare an attack. ● EARTH: During your Standby Phase, destroy 1 face-up Defense Position monster you control. ● WATER: During your End Phase, discard 1 card. ● FIRE: During your End Phase, take 1000 damage. ● WIND: You must pay 500 LP to activate a Spell Card.
--クリアー・ワールド --Clear World local s,id=GetID() function s.initial_effect(c) local fid=c:GetFieldID() local copying=c:IsStatus(STATUS_COPYING_EFFECT) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Maintenance cost: Pay 500 LP or destroy this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1) e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) e1:SetOperation(s.maintop) c:RegisterEffect(e1) --● LIGHT: Play with your hand revealed at all times local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_PUBLIC) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_HAND,LOCATION_HAND) e2:SetTarget(function(e,c) return s.PlayerIsAffectedByClearWorld(c:GetControler(),ATTRIBUTE_LIGHT) end) c:RegisterEffect(e2) --● DARK: If you control 2 or more monsters, you cannot declare an attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_FZONE) e3:SetTargetRange(1,0) e3:SetCondition(s.darkconyou) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCondition(s.darkconopp) e4:SetTargetRange(0,1) c:RegisterEffect(e4) --● EARTH: Destroy 1 face-up Defense Position monster you control local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_PHASE|PHASE_STANDBY) e5:SetRange(LOCATION_FZONE) e5:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and s.PlayerControlsAttributeOrIsAffectedByClearWall(tp,ATTRIBUTE_EARTH) and c:IsHasEffect(id) and not c:HasFlagEffect(id) and (not copying or c:IsFieldID(fid)) end) e5:SetOperation(s.desop) if copying then e5:SetReset(RESET_PHASE|PHASE_END) end Duel.RegisterEffect(e5,0) local e5b=e5:Clone() Duel.RegisterEffect(e5b,1) --● WATER: Discard 1 card local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,2)) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e6:SetCode(EVENT_PHASE+PHASE_END) e6:SetRange(LOCATION_FZONE) e6:SetCountLimit(1) e6:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and s.PlayerControlsAttributeOrIsAffectedByClearWall(tp,ATTRIBUTE_WATER) and c:IsHasEffect(id) and not c:HasFlagEffect(id+1) and (not copying or c:IsFieldID(fid)) end) e6:SetOperation(s.discardop) if copying then e6:SetReset(RESET_PHASE|PHASE_END) end Duel.RegisterEffect(e6,0) local e6b=e6:Clone() Duel.RegisterEffect(e6b,1) --● FIRE: Take 1000 damage local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(id,3)) e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e7:SetCode(EVENT_PHASE+PHASE_END) e7:SetRange(LOCATION_FZONE) e7:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and s.PlayerControlsAttributeOrIsAffectedByClearWall(tp,ATTRIBUTE_FIRE) and c:IsHasEffect(id) and not c:HasFlagEffect(id+2) and (not copying or c:IsFieldID(fid)) end) e7:SetOperation(s.damop) if copying then e7:SetReset(RESET_PHASE|PHASE_END) end Duel.RegisterEffect(e7,0) local e7b=e7:Clone() Duel.RegisterEffect(e7b,1) --● WIND: You must pay 500 Life Points to activate a Spell Card local e8=Effect.CreateEffect(c) e8:SetType(EFFECT_TYPE_FIELD) e8:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e8:SetCode(EFFECT_ACTIVATE_COST) e8:SetRange(LOCATION_FZONE) e8:SetTargetRange(1,0) e8:SetCondition(function(e) return s.PlayerIsAffectedByClearWorld(e:GetHandlerPlayer(),ATTRIBUTE_WIND) end) e8:SetTarget(function(e,te,tp) return te:IsSpellEffect() and te:IsHasType(EFFECT_TYPE_ACTIVATE) end) e8:SetCost(function(e,te_or_c,tp) return Duel.CheckLPCost(tp,500) end) e8:SetOperation(function(e,tp) Duel.PayLPCost(tp,500) end) c:RegisterEffect(e8) local e9=e8:Clone() e9:SetTargetRange(0,1) e9:SetCondition(function(e) return s.PlayerIsAffectedByClearWorld(1-e:GetHandlerPlayer(),ATTRIBUTE_WIND) end) c:RegisterEffect(e9) --Apply a dummy effect on itself to track whether the card's effects are currently active or not local e10=Effect.CreateEffect(c) e10:SetType(EFFECT_TYPE_SINGLE) e10:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e10:SetCode(id) e10:SetRange(LOCATION_FZONE) c:RegisterEffect(e10) end function s.maintop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) local b1=Duel.CheckLPCost(tp,500) local b2=true --Pay 500 LP or destroy this card local op=b1 and Duel.SelectEffect(tp, {b1,aux.Stringid(id,4)}, {b2,aux.Stringid(id,5)}) or 2 if op==1 then Duel.PayLPCost(tp,500) elseif op==2 then Duel.Destroy(e:GetHandler(),REASON_COST) end end function s.PlayerControlsAttributeOrIsAffectedByClearWall(player,attribute) return Duel.IsPlayerAffectedByEffect(1-player,EFFECT_CLEAR_WALL) or Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttribute,attribute),player,LOCATION_MZONE,0,1,nil) end function s.PlayerIsAffectedByClearWorld(player,attribute) return not Duel.IsPlayerAffectedByEffect(player,EFFECT_CLEAR_WORLD_IMMUNE) and s.PlayerControlsAttributeOrIsAffectedByClearWall(player,attribute) end function s.darkconyou(e) local affected_player=e:GetHandlerPlayer() return s.PlayerIsAffectedByClearWorld(affected_player,ATTRIBUTE_DARK) and Duel.GetFieldGroupCount(affected_player,LOCATION_MZONE,0)>=2 end function s.darkconopp(e) local affected_player=1-e:GetHandlerPlayer() return s.PlayerIsAffectedByClearWorld(affected_player,ATTRIBUTE_DARK) and Duel.GetFieldGroupCount(affected_player,LOCATION_MZONE,0)>=2 end function s.desop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) if not s.PlayerIsAffectedByClearWorld(tp,ATTRIBUTE_EARTH) or not Duel.IsExistingMatchingCard(Card.IsPosition,tp,LOCATION_MZONE,0,1,nil,POS_FACEUP_DEFENSE) then return end Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsPosition,tp,LOCATION_MZONE,0,1,1,nil,POS_FACEUP_DEFENSE) if #g==0 then return end Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end function s.discardop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id+1,RESETS_STANDARD_PHASE_END,0,1) if not s.PlayerIsAffectedByClearWorld(tp,ATTRIBUTE_WATER) or Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 then return end Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT|REASON_DISCARD) end function s.damop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id+2,RESETS_STANDARD_PHASE_END,0,1) if not s.PlayerIsAffectedByClearWorld(tp,ATTRIBUTE_FIRE) then return end Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Damage(tp,1000,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time you draw a card(s) for your normal draw in your Draw Phase, place 1 Greed Counter on this card. You can send this card with 2 or more Greed Counters to the GY; draw 2 cards.
--強欲なカケラ --Shard of Greed local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0xd) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_DRAW) e2:SetRange(LOCATION_SZONE) e2:SetOperation(s.ctop) c:RegisterEffect(e2) --draw local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.drcon) e3:SetCost(Cost.SelfToGrave) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) end s.counter_place_list={0xd} function s.ctop(e,tp,eg,ep,ev,re,r,rp) if ep==tp and r==REASON_RULE then e:GetHandler():AddCounter(0xd,1) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetCounter(0xd)>=2 end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
At the start of your Main Phase 1: Add 1 monster with 0 ATK from your Deck to your hand, but halve your LP. After adding it to your hand, until the end of the next turn after this card was activated, you cannot activate the added monster's effects, or the effects of cards with its name, until you Normal Summon that monster or a card with its name.
--ピリ・レイスの地図 --Piri Reis Map --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Search 1 monster with 0 ATK 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: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.IsPhase(PHASE_MAIN1) and not Duel.CheckPhaseActivity() end function s.thfilter(c) return c:IsMonster() and c:IsAttack(0) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(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) local tc=g:GetFirst() if tc:IsLocation(LOCATION_HAND) then Duel.SetLP(tp,math.ceil(Duel.GetLP(tp)/2)) local c=e:GetHandler() --Check Normal Summon for matching name local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetLabel(tc:GetCode()) e1:SetOperation(s.checkop) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) --Cannot activate effects of monsters with the same name local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetTargetRange(1,0) e2:SetValue(s.aclimit) e2:SetLabelObject(e1) e2:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e2,tp) end end end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local sc=eg:GetFirst() if sc:IsSummonPlayer(1-tp) then return end if sc:IsCode(e:GetLabel()) then e:SetLabel(-1) end end function s.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabelObject():GetLabel()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 1 monsters You can detach 1 Xyz Material from this card; excavate the top card of your Deck, and if it is a Spell/Trap, add it to your hand. Otherwise, send it to the GY. You can send 1 other Plant monster from your hand or face-up from your field to the GY, then target 1 "Sylvan" monster in your GY; Special Summon it. You can only use each effect of "Sylvan Princessprite" once per turn.
--森羅の姫芽宮 --Sylvan Princessprite local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure Xyz.AddProcedure(c,nil,1,2) --Excavate the top card of your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special Summon 1 "Sylvan" monster from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SYLVAN} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) and Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_DECK,0,1,nil) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end Duel.ConfirmDecktop(tp,1) local tc=Duel.GetDecktopGroup(tp,1):GetFirst() if tc:IsSpellTrap() and tc:IsAbleToHand() then Duel.DisableShuffleCheck() Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ShuffleHand(tp) else Duel.DisableShuffleCheck() Duel.SendtoGrave(tc,REASON_EFFECT|REASON_EXCAVATE) end end function s.cfilter(c,tp) return (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and c:IsRace(RACE_PLANT) and c:IsAbleToGraveAsCost() and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,c,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,c,tp) Duel.SendtoGrave(g,REASON_COST) end function s.filter(c,e,tp) return c:IsSetCard(SET_SYLVAN) 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.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.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:
If you control no monsters, you can Special Summon this card (from your hand), but its original ATK and DEF become halved. During each of your Standby Phases: Increase the Level of this card by 1. There can only be 1 "Solar Wind Jammer" on the field.
--太陽風帆船 --Solar Wind Jammer local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,1,id) --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:SetOperation(s.spop) c:RegisterEffect(e1) --level up local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.lvcon) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(400) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(1200) c:RegisterEffect(e2) end function s.lvcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Superheavy Samurai" monster Cannot be used as Link Material. While you have no Spells/Traps in your GY, you take no battle damage from attacks involving this card. If you have no Spells/Traps in your GY: You can discard 1 monster, then target 1 "Superheavy Samurai" monster in your GY; Special Summon it to your zone this card points to, in Defense Position. You can only use this effect of "Superheavy Samurai Scarecrow" once per turn.
--超重武者カカ-C --Superheavy Samurai Scarecrow --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_SUPERHEAVY_SAMURAI),1,1) --cannot link material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --battle dam 0 local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetCondition(s.condition) e2:SetValue(1) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.condition) e3:SetCost(s.cost) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_SUPERHEAVY_SAMURAI} function s.filter(c) return c:IsSpellTrap() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.filter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil) end function s.cfilter(c) return c:IsMonster() and c:IsDiscardable() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST|REASON_DISCARD) end function s.sfilter(c,e,tp,zone) return c:IsSetCard(SET_SUPERHEAVY_SAMURAI) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,tp,zone) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.sfilter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.sfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.sfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local zone=e:GetHandler():GetLinkedZone(tp) if zone==0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and zone~=0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE,zone) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Kashtira" Xyz Monster is on the field and a player controls 2 or more monsters: They must banish monsters they control, face-down, so they only control 1 monster. If this card is banished: You can target 1 "Kashtira" Xyz Monster you control; add 1 of your "Kashtira" monsters attached to it to your hand, then you can Special Summon that monster from your hand. You can only use each effect of "Kashtira Big Bang" once per turn.
--六世壊根清浄 --Kashtira Big Bang --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Make both players banish monsters face-down so they control only 1 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_BATTLE_START|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetCondition(s.rmvcond) e1:SetTarget(s.rmvtg) e1:SetOperation(s.rmvop) c:RegisterEffect(e1) --Return 1 monster attached to the hand and Special Summon it local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_REMOVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_KASHTIRA} function s.xyzfilter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(SET_KASHTIRA) end function s.rmvcond(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk) local g1=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) if chk==0 then return (#g1>1 and g1:IsExists(Card.IsAbleToRemove,1,nil,tp,POS_FACEDOWN,REASON_RULE)) or (#g2>1 and g2:IsExists(Card.IsAbleToRemove,1,nil,1-tp,POS_FACEDOWN,REASON_RULE)) end end function s.rmvop(e,tp,eg,ep,ev,re,r,rp) local p1=Duel.GetTurnPlayer() --used to make the turn player banish first local p2=1-Duel.GetTurnPlayer() local g1=Duel.GetFieldGroup(p1,LOCATION_MZONE,0) local rg1=g1:Filter(Card.IsAbleToRemove,nil,p1,POS_FACEDOWN,REASON_RULE) if #g1>1 and #rg1>0 then local ct=math.min(#g1-1,#rg1) Duel.Hint(HINT_SELECTMSG,p1,HINTMSG_REMOVE) local sg=rg1:Select(p1,ct,ct,nil) Duel.Remove(sg,POS_FACEDOWN,REASON_RULE,PLAYER_NONE,p1) end local g2=Duel.GetFieldGroup(p2,LOCATION_MZONE,0) local rg2=g2:Filter(Card.IsAbleToRemove,nil,p2,POS_FACEDOWN,REASON_RULE) if #g2>1 and #rg2>0 then local ct=math.min(#g2-1,#rg2) Duel.Hint(HINT_SELECTMSG,p2,HINTMSG_REMOVE) local sg=rg2:Select(p2,ct,ct,nil) Duel.Remove(sg,POS_FACEDOWN,REASON_RULE,PLAYER_NONE,p2) end end function s.thfilter(c,tp) return c:IsMonster() and c:IsSetCard(SET_KASHTIRA) and c:GetOwner()==tp and c:IsAbleToHand() end function s.tgfilter(c,tp) if not (c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(SET_KASHTIRA)) then return false end local g=c:GetOverlayGroup() return g:IsExists(s.thfilter,1,nil,tp) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tc=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_OVERLAY) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.thop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local g=tc:GetOverlayGroup() if #g==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sc=g:FilterSelect(tp,s.thfilter,1,1,nil,tp):GetFirst() if sc and Duel.SendtoHand(sc,nil,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) then Duel.ShuffleHand(tp) if not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end Duel.BreakEffect() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) you control would be destroyed by card effect, you can banish this card from your GY instead. You can only use each of the following effects of "Marincess Basilalima" once per turn. ● You can banish 1 "Marincess" Trap from your GY; add 1 "Marincess" Trap with a different name from your Deck to your hand. ● If this card is banished: You can target 1 face-up monster you control; it gains 600 ATK.
--海晶乙女 バシランリマ --Marincess Basilalima --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) --Add 1 "Marincess" Trap card to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Destruction replacement local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) --Increase the ATK of a monster by 600 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,{id,1}) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_MARINCESS} function s.cfilter(c,tp) return c:IsSetCard(SET_MARINCESS) and c:IsTrap() and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode()) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) e:SetLabel(g:GetFirst():GetCode()) end function s.thfilter(c,code) return c:IsSetCard(SET_MARINCESS) and c:IsTrap() and c:IsAbleToHand() and not c:IsCode(code) 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,e:GetLabel()) 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,e:GetLabel()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.repfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,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|REASON_REPLACE) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(600) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Flip monsters' effects cannot be activated, also their effects are negated.
--王宮の号令 --Royal Command 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) --disable effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_ACTIVATING) e2:SetRange(LOCATION_SZONE) e2:SetOperation(s.disop) c:RegisterEffect(e2) end function s.disop(e,tp,eg,ep,ev,re,r,rp) if re:IsActiveType(TYPE_FLIP) then Duel.NegateActivation(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "War-Lion Ritual".
--スーパー・ウォー・ライオン --Super War-Lion local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() end s.listed_names={54539105}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 "Six Samurai" monsters with different Attributes Must first be Special Summoned (from your Extra Deck) by sending the above cards you control to the GY. (You do not use "Polymerization".) Cannot be used as Fusion Material. Once per turn: You can banish 1 "Six Samurai" card from your hand or face-up from your field, then target 1 card on the field; banish it. If a "Six Samurai" monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead.
--影六武衆-リハン --Secret Six Samurai - Rihan local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon procedure Fusion.AddProcMixN(c,true,true,s.ffilter,3) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit) --Cannot be used as Fusion Material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetValue(1) c:RegisterEffect(e1) --Banish 1 card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --Destruction replacement for a "Six Samurai" monster local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_GRAVE) e3:SetTarget(s.reptg) e3:SetValue(s.repval) e3:SetOperation(s.repop) c:RegisterEffect(e3) end s.listed_series={SET_SIX_SAMURAI} s.material_setcode=SET_SIX_SAMURAI function s.ffilter(c,fc,sumtype,tp,sub,mg,sg) return c:IsSetCard(SET_SIX_SAMURAI,fc,sumtype,tp) and c:GetAttribute(fc,sumtype,tp)~=0 and (not sg or not sg:IsExists(s.fusfilter,1,c,c:GetAttribute(fc,sumtype,tp),fc,sumtype,tp)) end function s.contactfil(tp) return Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,nil) end function s.contactop(g) Duel.SendtoGrave(g,REASON_COST|REASON_MATERIAL) end function s.fusfilter(c,attr,fc,sumtype,tp) return c:IsAttribute(attr,fc,sumtype,tp) and not c:IsHasEffect(511002961) end function s.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function s.costfilter(c) return c:IsSetCard(SET_SIX_SAMURAI) and c:IsAbleToRemoveAsCost() and ((c:IsOnField() and c:IsFaceup()) or c:IsLocation(LOCATION_HAND)) and Duel.IsExistingTarget(Card.IsAbleToRemove,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_SIX_SAMURAI) and not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsControler(tp) and c:IsReason(REASON_EFFECT|REASON_BATTLE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,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|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 3 "Scrap" monsters in your Graveyard. Your opponent picks 1 of them, you Special Summon it to either player's side of the field, and remove the rest from play.
--ポンコツの意地 --Guts of Steel local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SCRAP} function s.filter(c,e,tp) return c:IsSetCard(SET_SCRAP) and c:IsAbleToRemove() and (c:IsCanBeSpecialSummoned(e,0,tp,false,false) or c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0) and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,3,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,3,3,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft2=Duel.GetLocationCount(1-tp,LOCATION_MZONE) if #g==0 or (ft1==0 and ft2==0) then return end Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local tc=g:Select(1-tp,1,1,nil):GetFirst() local s1=ft1>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) local s2=ft2>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) if s1 and s2 then op=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,1)) elseif s1 then op=Duel.SelectOption(tp,aux.Stringid(id,0)) elseif s2 then op=Duel.SelectOption(tp,aux.Stringid(id,1))+1 else op=2 end if op==0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) elseif op==1 then Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP) end g:RemoveCard(tc) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Tribute 1 or more "Vendread" monsters from your hand and/or field, then target 1 face-up monster you control; increase its Level by the number of monsters Tributed, until the end of this turn. When your attacking "Vendread" Ritual Monster destroys an opponent's monster by battle: You can have your monster gain 1000 ATK. You can only use this effect of "Vendread Nightmare" once per turn.
--ヴェンデット・ナイトメア --Vendread Nightmare 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) --Increase the level of 1 face-up monster you control by the number of monsters Tributed local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCost(s.lvcost) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) --You attacking "Vendread" Ritual Monster gains 1000 ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_VENDREAD} function s.lvcfilter(c) return c:IsMonster() and c:IsSetCard(SET_VENDREAD) end function s.lvfilter(c,e) return c:IsFaceup() and c:IsLevelAbove(1) and (not e or c:IsCanBeEffectTarget(e)) end function s.lvcost(e,tp,eg,ep,ev,re,r,rp,chk) local tg=Duel.GetMatchingGroup(s.lvfilter,tp,LOCATION_MZONE,0,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.lvcfilter,1,true,aux.ReleaseCheckTarget,nil,tg) end local g=Duel.SelectReleaseGroupCost(tp,s.lvcfilter,1,99,true,aux.ReleaseCheckTarget,nil,tg) e:SetLabel(#g) Duel.Release(g,REASON_COST) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.lvfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO) local g=Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g,1,tp,e:GetLabel()) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(e:GetLabel()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() return a:IsControler(tp) and (a:IsRitualMonster() and a:IsSetCard(SET_VENDREAD)) and a:GetBattleTarget():IsControler(1-tp) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetAttacker() if c:IsRelateToEffect(e) and tc:IsRelateToBattle() and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Genex Controller" + 1 or more non-Tuner EARTH monsters Once per turn, if you control a face-up Level 4 or lower "Genex" monster(s), you can switch the original ATK and DEF of this card until the End Phase, for as long as you control a face-up Level 4 or lower "Genex" monster(s).
--ジオ・ジェネクス --Geo Genex local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterSummonCode(68505803),1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_EARTH),1,99) c:EnableReviveLimit() --ad change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_SWAP_BASE_AD) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.valcon) c:RegisterEffect(e2) end s.material={68505803} s.listed_names={68505803} s.listed_series={SET_GENEX} function s.valcon(e) return e:GetHandler():GetFlagEffect(id)~=0 and Duel.IsExistingMatchingCard(s.cfilter,e:GetHandler():GetControler(),LOCATION_MZONE,0,1,nil) end function s.cfilter(c) return c:IsLevelBelow(4) and c:IsFaceup() and c:IsSetCard(SET_GENEX) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this Defense Position card is attacked and if the DEF of this card is higher than the ATK of the attacking monster, destroy the attacking monster at the end of the Damage Step.
--針千本 --Thousand Needles local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.GetAttackTarget()==c and ((c:IsOnField() and c:IsPosition(POS_DEFENSE)) or c:IsPreviousPosition(POS_DEFENSE)) and Duel.GetAttacker():GetAttack()<c:GetDefense() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,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.Destroy(a,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Standby Phase, if you have a Spellcaster monster on your side of the field or in your GY: You can place 1 "Spellbook" Spell Card from your GY on the bottom of your Deck, except "The Grand Spellbook Tower", then draw 1 card. When this card in your possession is destroyed by your opponent and sent to your GY: You can Special Summon 1 Spellcaster monster from your hand or Deck whose Level is less than or equal to the number of "Spellbook" Spell Cards in your GY. * The above text is unofficial and describes the card's functionality in the OCG.
--魔導書院ラメイソン --The Grand Spellbook Tower local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Place 1 "Spellbook" Spell from your GY on the bottom of your Deck, except "The Grand Spellbook Tower", and if you do, draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1) e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --Special Summon 1 Spellcaster monster from your hand or Deck whose Level is less than or equal to the number of "Spellbook" Spells in your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsReason(REASON_DESTROY) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SPELLBOOK} s.listed_names={id} function s.tdfilter(c) return c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() and c:IsAbleToDeck() and not c:IsCode(id) 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.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g==0 then return end Duel.HintSelection(g) if Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 then Duel.Draw(tp,1,REASON_EFFECT) end end function s.ctfilter(c) return c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() end function s.spfilter(c,e,tp,lv) return c:IsRace(RACE_SPELLCASTER) and c:IsLevelBelow(lv) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_GRAVE,0,nil) return ct>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp,ct) 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 false end local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_GRAVE,0,nil) if ct==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp,ct) 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:
2 Level 3 monsters If this card is Xyz Summoned: You can add 1 "Goblin" monster from your Deck to your hand. If material is detached from a monster(s) on the field (except during the Damage Step): You can target 1 face-up monster on the field, except this card; attach it to this card as material. During the End Phase: You can attach 1 "Goblin" monster from your Deck to this card as material. You can only use each effect of "Goblin Biker Big Gabonga" once per turn.
--百鬼羅刹 巨魁ガボンガ --Goblin Biker Big Gabonga --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Enable the material detaching event Duel.EnableGlobalFlag(GLOBALFLAG_DETACH_EVENT) --Xyz Summon procedure Xyz.AddProcedure(c,nil,3,2) --Search 1 "Goblin" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsXyzSummoned() end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Attack 1 other face-up monster to this card as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DETACH_MATERIAL) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return r&REASON_LOST_TARGET==0 end) e2:SetTarget(s.fldattchtg) e2:SetOperation(s.fldattchop) c:RegisterEffect(e2) --Attach 1 "Goblin" monster from your Deck to this card as material local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.dattchtg) e3:SetOperation(s.dattchop) c:RegisterEffect(e3) end s.listed_series={SET_GOBLIN} function s.thfilter(c) return c:IsSetCard(SET_GOBLIN) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) 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.fldattchfilter(c,xyzc,tp) return c:IsFaceup() and c:IsCanBeXyzMaterial(xyzc,tp,REASON_EFFECT) and (c:IsControler(tp) or c:IsAbleToChangeControler()) end function s.fldattchtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.fldattchfilter(chkc,c,tp) and chkc~=c end if chk==0 then return c:IsType(TYPE_XYZ) and Duel.IsExistingTarget(s.fldattchfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACH) Duel.SelectTarget(tp,s.fldattchfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c,c,tp) end function s.fldattchop(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 tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.Overlay(c,tc,true) end end function s.dattchfilter(c,xyzc,tp) return c:IsSetCard(SET_GOBLIN) and c:IsMonster() and c:IsCanBeXyzMaterial(xyzc,tp,REASON_EFFECT) end function s.dattchtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local c=e:GetHandler() return c:IsType(TYPE_XYZ) and Duel.IsExistingMatchingCard(s.dattchfilter,tp,LOCATION_DECK,0,1,nil,c,tp) end end function s.dattchop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACH) local g=Duel.SelectMatchingCard(tp,s.dattchfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.Overlay(c,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 card; until the end of this turn, each time you would take damage, gain that amount of LP instead.
--レインボー・ライフ --Rainbow Life 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:SetCost(s.cost) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.activate(e,tp,eg,ep,ev,re,r,rp) --damage conversion local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetCode(EFFECT_REVERSE_DAMAGE) e1:SetTargetRange(1,0) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned from the hand or Deck. Once per turn: You can discard 1 card and pay 1000 Life Points; this card gains 1000 ATK until the End Phase. When this card in your possession is destroyed by your opponent's card effect and sent to your Graveyard: Both players take damage equal to this card's ATK in the Graveyard.
--The big SATURN --The Big Saturn local s,id=GetID() function s.initial_effect(c) --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetRange(LOCATION_HAND|LOCATION_DECK) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.atcost) e2:SetOperation(s.atop) c:RegisterEffect(e2) --damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.damcon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.atcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,1000) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) Duel.PayLPCost(tp,1000) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (r&(REASON_DESTROY|REASON_EFFECT))==(REASON_DESTROY|REASON_EFFECT) and rp~=tp and c:IsPreviousControler(tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dam=e:GetHandler():GetAttack() Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) Duel.Damage(1-tp,d,REASON_EFFECT,true) Duel.Damage(tp,d,REASON_EFFECT,true) Duel.RDComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your "Code Talker" monster battles, your opponent cannot activate cards or effects until the end of the Damage Step. During your Main Phase, you can: Immediately after this effect resolves, Normal Summon 1 Cyberse monster, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Cyberse monsters (even if this card leaves the field). You can only use this effect of "Cynet Optimization" once per turn.
--サイバネット・オプティマイズ --Cynet Optimization --Script 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) --summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --actlimit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(0,1) e3:SetValue(1) e3:SetCondition(s.actcon) c:RegisterEffect(e3) end s.listed_series={SET_CODE_TALKER} function s.filter(c) return c:IsRace(RACE_CYBERSE) and c:IsSummonable(true,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Summon(tp,tc,true,nil) 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) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) end function s.splimit(e,c) return not c:IsRace(RACE_CYBERSE) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not c:IsOriginalRace(RACE_CYBERSE) end function s.cfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_CODE_TALKER) and c:IsControler(tp) end function s.actcon(e) local tp=e:GetHandlerPlayer() local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() return (a and s.cfilter(a,tp)) or (d and s.cfilter(d,tp)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 2 face-up monsters on the field; halve the ATK of 1 monster, and if you do, add that lost ATK to the other monster. These effects last until the end of this turn.
--フォース --Riryoku local s,id=GetID() function s.initial_effect(c) --Halve the ATK of a monster and increase the ATK of another by the same amount local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil) if #g==0 then return end local hc=g:GetFirst() if #g>1 then Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) hc=g:Select(tp,1,1,nil):GetFirst() end g:RemoveCard(hc) local c=e:GetHandler() local atk=hc:GetAttack() --Halve the ATK of one monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(atk/2) hc:RegisterEffect(e1) if not hc:IsImmuneToEffect(e1) and #g>0 then --Add that lost ATK to the other monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(atk/2) g:GetFirst():RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you have no monsters in your GY, you can Special Summon this card (from your hand). You can send 1 of your Equip Spells equipped to this card to the GY, then target up to 3 monsters in your opponent's GY; banish those targets, and if you do, this card gains 500 ATK for each monster banished by this effect, until the end of this turn.
--ガーディアン・エアトス --Guardian Eatos 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) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and not Duel.IsExistingMatchingCard(Card.IsMonster,c:GetControler(),LOCATION_GRAVE,0,1,nil) end function s.cfilter(c) return c:IsSpell() and c:IsAbleToGraveAsCost() end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetEquipGroup():IsExists(s.cfilter,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=e:GetHandler():GetEquipGroup():FilterSelect(tp,s.cfilter,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.rmfilter(c) return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) local ct=Duel.Remove(g,POS_FACEUP,REASON_EFFECT) local c=e:GetHandler() if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*500) 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:
You can Special Summon this card (from your hand) by sending 1 Xyz Monster from your Extra Deck to the GY. If Summoned this way, you cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 4 Xyz Monsters. You can only Special Summon "Ext Ryzeal" once per turn this way. If this card is Normal or Special Summoned and you control no face-up monsters, except Level/Rank 4 monsters: You can add 1 FIRE Thunder monster from your Deck to your hand. You can only use this effect of "Ext Ryzeal" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--エクス・ライゼオル --Ext Ryzeal --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon this card from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.selfspcon) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Add 1 FIRE Thunder monster from your Deck to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_RYZEAL} s.listed_names={id} function s.selfspconfilter(c) return c:IsType(TYPE_XYZ) and c:IsAbleToGraveAsCost() end function s.selfspcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local g=Duel.GetMatchingGroup(s.selfspconfilter,tp,LOCATION_EXTRA,0,nil) return #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.selfspconfilter,tp,LOCATION_EXTRA,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_TOGRAVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.selfspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_COST) --You cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 4 Xyz Monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not (c:IsType(TYPE_XYZ) and c:IsRank(4)) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard Check aux.addTempLizardCheck(c,tp,function(e,c) return not (c:IsOriginalType(TYPE_XYZ) and c:IsOriginalRank(4)) end) end function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_THUNDER) and c:IsAbleToHand() end function s.thconfilter(c) return c:IsFaceup() and not (c:IsLevel(4) or c:IsRank(4)) 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) and not Duel.IsExistingMatchingCard(s.thconfilter,tp,LOCATION_MZONE,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:
Target 1 monster that was Special Summoned by the effect of an "Evoltile" monster; this turn, it cannot be destroyed by battle or by card effects.
--進化の奇跡 --Evo-Miracle local s,id=GetID() function s.initial_effect(c) --Targeted monster cannot be destroyed by battle or card effect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_BATTLE_START|TIMING_END_PHASE) c:RegisterEffect(e1) end function s.filter(c) local st=c:GetSummonType() return c:IsFaceup() and st>=(SUMMON_TYPE_SPECIAL+150) and st<(SUMMON_TYPE_SPECIAL+180) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Cannot be destroyed by battle or card effect local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3008) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by placing 3 Spell Counters on it. Once per turn, during your turn: You can target 1 other face-up card on the field that you can place a Spell Counter on; remove 1 Spell Counter from this card, and if you do, place 1 Spell Counter on that target. When the last Spell Counter(s) is removed from this card, destroy it.
--漆黒のパワーストーン --Pitch-Black Power Stone local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(COUNTER_SPELL) --Activate local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_COUNTER) e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --counter local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_COUNTER) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_FREE_CHAIN) e3:SetCountLimit(1) e3:SetCondition(s.condition) e3:SetTarget(s.target2) e3:SetOperation(s.operation) c:RegisterEffect(e3) --self destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_SZONE) e4:SetCode(EFFECT_SELF_DESTROY) e4:SetCondition(s.descon) c:RegisterEffect(e4) end s.counter_place_list={COUNTER_SPELL} function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) end local c=e:GetHandler() if chk==0 then return Duel.IsCanAddCounter(tp,COUNTER_SPELL,3,c) end c:AddCounter(COUNTER_SPELL,3) if not Duel.IsDuelType(DUEL_USE_TRAPS_IN_NEW_CHAIN) and s.condition(e,tp,eg,ep,ev,re,r,rp) and s.target2(e,tp,eg,ep,ev,re,r,rp,0,chkc) and Duel.SelectEffectYesNo(tp,c,94) then e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c) c:RegisterFlagEffect(0,RESET_CHAIN,EFFECT_FLAG_CLIENT_HINT,1,0,65) c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) else e:SetProperty(0) end end function s.operation(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 tc and tc:IsRelateToEffect(e) and c:IsCanRemoveCounter(tp,COUNTER_SPELL,1,REASON_EFFECT) and tc:IsCanAddCounter(COUNTER_SPELL,1) then c:RemoveCounter(tp,COUNTER_SPELL,1,REASON_EFFECT) tc:AddCounter(COUNTER_SPELL,1) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.filter(c) return c:IsFaceup() and c:IsCanAddCounter(COUNTER_SPELL,1) end function s.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) end if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and e:GetHandler():IsCanRemoveCounter(tp,COUNTER_SPELL,1,REASON_EFFECT) and Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) end function s.descon(e) return e:GetHandler():GetCounter(COUNTER_SPELL)==0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Beast monsters, including an "Ojama" monster While "Ojama Country" is in a Field Zone, this card gains 3000 ATK, also it cannot be destroyed by card effects. Your opponent takes any battle damage you would have taken from attacks on this card, instead. You can target 1 non-Link "Ojama" monster in your GY; Special Summon it, also for the rest of this turn, you cannot Special Summon monsters from the Extra Deck, except Fusion Monsters. You can only use this effect of "Ojama Emperor" once per turn.
--おジャマ・エンペラー --Ojama Emperor local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_BEAST),3,nil,s.matcheck) --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.atkcon) e1:SetValue(3000) c:RegisterEffect(e1) --Cannot be destroyed local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetValue(1) e2:SetCondition(s.atkcon) c:RegisterEffect(e2) --Reflect battle damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE) e3:SetCondition(s.refcon) e3:SetValue(1) c:RegisterEffect(e3) --Special Summon local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCountLimit(1,id) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_OJAMA} s.listed_names={90011152} function s.matcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsSetCard,1,nil,SET_OJAMA,lc,sumtype,tp) end function s.ffilter(c) return c:IsFaceup() and c:IsCode(90011152) end function s.atkcon(e) return Duel.IsExistingMatchingCard(s.ffilter,e:GetHandlerPlayer(),LOCATION_FZONE,LOCATION_FZONE,1,nil) end function s.refcon(e) return Duel.GetAttackTarget()==e:GetHandler() end function s.filter(c,e,tp) return c:IsSetCard(SET_OJAMA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsLinkMonster() 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.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,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.filter,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 c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH) e2:SetDescription(aux.Stringid(id,1)) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetTargetRange(1,0) Duel.RegisterEffect(e2,tp) end function s.splimit(e,c) 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:
If you control no monsters, you can Special Summon this card (from your hand). You can Tribute this card; you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters, also Special Summon up to 3 "Baby Spider" from your hand and/or Deck, and if you do, they become Level 5, but cannot be used as material for an Xyz Summon, except the Xyz Summon of a DARK monster. You can only use this effect of "Mother Spider Splitter" once per turn.
--分裂するマザー・スパイダー --Mother Spider Splitter --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand 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:SetCondition(s.selfspcon) c:RegisterEffect(e1) --Special Summon up to 3 "Baby Spider" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_cards={60023855} function s.selfspcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end function s.spfilter(c,e,tp) return c:IsCode(60023855) 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.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Can only Special Summon Xyz monster from the Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(_,c) return not c:IsType(TYPE_XYZ) and c:IsLocation(LOCATION_EXTRA) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(_,c) return not c:IsOriginalType(TYPE_XYZ) end) --Special Summon "Baby Spider" from hand or Deck local ft=math.min(3,Duel.GetLocationCount(tp,LOCATION_MZONE)) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,ft,nil,e,tp) if #g==0 then return end for tc in g:Iter() do if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Level becomes 5 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(5) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) --Can only be used as Xyz material for a DARK monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e2:SetValue(s.xyzlimit) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end end Duel.SpecialSummonComplete() 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:
Target a number of monsters on the field and/or in the GYs, equal to the difference between your banished cards and your opponent's; banish them, then your opponent can Special Summon 1 monster from their Deck. You can only activate 1 "Gigantic Thundercross" per turn.
--ギガンティック・サンダークロス --Gigantic Thundercross --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Banish monster on the field/GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsMonster() and c:IsAbleToRemove() 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.filter(chkc) end local ct=math.abs(Duel.GetFieldGroupCount(tp,LOCATION_REMOVED,0)-Duel.GetFieldGroupCount(tp,0,LOCATION_REMOVED)) if chk==0 then return ct>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,ct,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_DECK) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local rg=Duel.GetTargetCards(e) if #rg==0 then return end if Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)>0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,1-tp,LOCATION_DECK,0,1,nil,e,1-tp) and Duel.SelectYesNo(1-tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(1-tp,s.spfilter,1-tp,LOCATION_DECK,0,1,1,nil,e,1-tp) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,1-tp,1-tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Sonic Tracker". Once per turn: You can reveal 1 Ritual Spell in your hand, add 1 Ritual Monster from your Deck to your hand whose name is listed on that card, and if you do, shuffle the revealed card into the Deck. Once per opponent's turn (Quick Effect): You can send 1 Ritual Spell from your Deck to the GY; this effect becomes that card's effect that Ritual Summons a monster when the card is activated. If this Ritual Summoned card is Tributed: You can target 1 face-up card your opponent controls; negate its effects until the end of this turn.
--トランソニックバード --Transonic Bird --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Add 1 Ritual monster from the Deck to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Perform a Ritual summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetCost(s.ritcost) e2:SetTarget(s.rittg) e2:SetOperation(s.ritop) c:RegisterEffect(e2) --Negate the effects of 1 face-up card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_RELEASE) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCondition(function(e) return e:GetHandler():IsRitualSummoned() end) e3:SetTarget(s.negtg) e3:SetOperation(s.negop) c:RegisterEffect(e3) end s.listed_names={17888577} function s.thfilter1(c,tp) return c:IsRitualSpell() and not c:IsPublic() and c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_DECK,0,1,nil,c) end function s.thfilter2(c,mc) return c:IsRitualMonster() and c:IsAbleToHand() and s.isfit(c,mc) end function s.isfit(c,mc) return (mc.fit_monster and c:IsCode(table.unpack(mc.fit_monster))) or mc:ListsCode(c:GetCode()) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter1,tp,LOCATION_HAND,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.thfilter1,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst() if not rc then return end Duel.ConfirmCards(1-tp,rc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,s.thfilter2,tp,LOCATION_DECK,0,1,1,nil,rc):GetFirst() if tc and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,tc) Duel.SendtoDeck(rc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.ritcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.ritfilter(c) return c:IsRitualSpell() and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(true,true,false)~=nil end function s.rittg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==0 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(s.ritfilter,tp,LOCATION_DECK,0,1,nil) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectMatchingCard(tp,s.ritfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() local te=tc:CheckActivateEffect(true,true,false) e:SetLabelObject(te) Duel.SendtoGrave(tc,REASON_COST) e:SetProperty(te:GetProperty()) local tg=te:GetTarget() if tg then tg(e,tp,eg,ep,ev,re,r,rp,1) end Duel.ClearOperationInfo(0) end function s.ritop(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() if not te then return end local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) end end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsNegatable() end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if ((tc:IsFaceup() and not tc:IsDisabled()) or tc:IsType(TYPE_TRAPMONSTER)) and tc:IsRelateToEffect(e) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) if tc:IsType(TYPE_TRAPMONSTER) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by Tributing 1 "Dracoslayer" monster and 1 "Dracoverlord" monster, and cannot be Special Summoned by other ways. Once per turn, during either player's turn, when a card or effect is activated: You can negate the activation, and if you do, destroy that card. If this card in its owner's control is destroyed by an opponent's card (by battle or card effect): You can Special Summon 1 "Dracoslayer" monster and 1 "Dracoverlord" monster from your Deck.
--真竜剣士マスターP --Master Peace, the True Dracoslayer local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --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) c:RegisterEffect(e0) --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) --Negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.discon) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) --summon 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_DAMAGE_STEP) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_DRACOSLAYER,SET_DRACOVERLORD} function s.rescon(sg,e,tp,mg) return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:IsExists(s.chk,1,nil,sg) end function s.chk(c,sg) return c:IsSetCard(SET_DRACOSLAYER) and sg:IsExists(Card.IsSetCard,1,c,SET_DRACOVERLORD) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetReleaseGroup(tp) local g1=rg:Filter(Card.IsSetCard,nil,SET_DRACOSLAYER) local g2=rg:Filter(Card.IsSetCard,nil,SET_DRACOVERLORD) local g=g1:Clone() g:Merge(g2) return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and #g1>0 and #g2>0 and #g>1 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetReleaseGroup(tp) local g1=rg:Filter(Card.IsSetCard,nil,SET_DRACOSLAYER) local g2=rg:Filter(Card.IsSetCard,nil,SET_DRACOVERLORD) g1:Merge(g2) local sg=aux.SelectUnselectGroup(g1,e,tp,2,2,s.rescon,1,tp,HINTMSG_RELEASE,nil,nil,true) if #sg>0 then sg:KeepAlive() e:SetLabelObject(sg) 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 function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end return 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():IsRelateToEffect(re) and re:GetHandler():IsDestructable() 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 function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.spfilter1(c,e,tp) return c:IsSetCard(SET_DRACOSLAYER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_DECK,0,1,c,e,tp) end function s.spfilter2(c,e,tp) return c:IsSetCard(SET_DRACOVERLORD) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_DECK,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_DECK,0,1,1,g1:GetFirst(),e,tp) g1:Merge(g2) if #g1==2 then Duel.SpecialSummon(g1,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 monsters Once per turn: You can detach 1 Xyz Material from this card to activate 1 of these effects; ● Send 1 card from your Deck to the Graveyard. ● Choose 1 monster from your Deck and place it on top of your Deck.
--ラヴァルバル・チェイン --Lavalval Chain local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure Xyz.AddProcedure(c,nil,4,2) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_DECK,0,1,nil) local b2=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>1 and Duel.IsExistingMatchingCard(Card.IsMonster,tp,LOCATION_DECK,0,1,nil) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_TOGRAVE) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) elseif op==2 then e:SetCategory(0) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Send 1 card from your Deck to the GY Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end elseif op==2 then --Place 1 monster from your Deck on top of your Deck local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0) if ct==0 then return end if ct==1 then return Duel.ConfirmDecktop(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local tc=Duel.SelectMatchingCard(tp,Card.IsMonster,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.ShuffleDeck(tp) Duel.MoveSequence(tc,0) Duel.ConfirmDecktop(tp,1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card was Special Summoned by the effect of "Ultimate Insect LV1", while it remains on the field all of your opponent's monsters lose 300 ATK. During your Standby Phase, by sending this face-up card to the Graveyard, Special Summon 1 "Ultimate Insect LV5" from your hand or Deck. (You cannot activate this effect the turn this card is Normal Summoned, Special Summoned, or flipped face-up.)
--アルティメット・インセクト LV3 --Ultimate Insect LV3 local s,id=GetID() function s.initial_effect(c) --atk down local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetCondition(s.con) e1:SetValue(-300) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfToGrave) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --reg local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetOperation(s.regop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=e3:Clone() e5:SetCode(EVENT_FLIP) c:RegisterEffect(e5) end s.listed_names={34830502} s.LVnum=3 s.LVset=SET_ULTIMATE_INSECT function s.con(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id+1,(RESET_EVENT|RESETS_STANDARD&~(RESET_TEMP_REMOVE|RESET_TURN_SET))|RESET_PHASE|PHASE_END,0,1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and e:GetHandler():GetFlagEffect(id+1)==0 end function s.spfilter(c,e,tp) return c:IsCode(34830502) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP)>0 then tc:RegisterFlagEffect(34830502,RESET_EVENT|RESETS_STANDARD&~(RESET_LEAVE|RESET_TEMP_REMOVE),0,0) tc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a LIGHT or DARK monster(s) is banished (except during the Damage Step): You can target 1 of those monsters; place that monster on the bottom of the Deck, and if you do, draw 1 card. You can only use this effect of "Branded Regained" once per turn. Once per turn, if your opponent Normal or Special Summons a monster (except during the Damage Step): You can target 1 "Bystial" monster in your GY; Special Summon it. You can only activate this effect of "Branded Regained" once per Chain.
--復烙印 --Branded Regained --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) --Return 1 banished LIGHT or DARK monster and draw 1 card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CUSTOM+id) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --Mass removal register local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_REMOVE) e3:SetRange(LOCATION_SZONE) e3:SetLabelObject(e2) e3:SetOperation(s.regop) c:RegisterEffect(e3) --Special Summon 1 "Byssted" monster local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e4:SetCondition(s.spcond) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e5) end s.listed_series={SET_BYSTIAL} function s.cfilter(c,e) return c:IsAttribute(ATTRIBUTE_DARK|ATTRIBUTE_LIGHT) and c:IsFaceup() and (not c:IsPreviousLocation(LOCATION_ONFIELD) or (c:GetPreviousTypeOnField()&TYPE_MONSTER>0 and c:GetPreviousAttributeOnField()&(ATTRIBUTE_DARK|ATTRIBUTE_LIGHT)>0)) and c:IsAbleToDeck() and c:IsCanBeEffectTarget(e) and c:IsLocation(LOCATION_REMOVED) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPhase(PHASE_DAMAGE) then return end local tg=eg:Filter(s.cfilter,nil,e) if #tg>0 then for tc in tg:Iter() do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) if Duel.GetFlagEffect(tp,id)==0 then Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=e:GetLabelObject():Filter(s.cfilter,nil,e) if chkc then return g:IsContains(chkc) and s.cfilter(chkc,e) end if chk==0 then return #g>0 and Duel.IsPlayerCanDraw(tp,1) end Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tg=g:Select(tp,1,1,nil) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TODECK,tg,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then Duel.Draw(tp,1,REASON_EFFECT) end end function s.spcond(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BYSTIAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.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) and Duel.GetFlagEffect(tp,id+1)==0 end Duel.RegisterFlagEffect(tp,id+1,RESET_CHAIN,0,1) 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,LOCATION_GRAVE) 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:
You can Ritual Summon this card with any "Vendread" Ritual Spell. This card's name becomes "Revendread Slayer" while on the field. While this Ritual Summoned card is on the field, your opponent cannot target cards you control with card effects, except this card. If this Ritual Summoned card is destroyed by battle, or is destroyed by an opponent's card effect while in its owner's Monster Zone: You can add 1 "Vendread" card from your Deck to your hand. You can only use this effect of "Revendread Executor" once per turn.
--リヴェンデット・エグゼクター --Revendread Executor local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --code 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) e1:SetValue(4388680) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_ONFIELD,0) e2:SetCondition(s.tgcon) e2:SetTarget(s.tgtg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,id) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_VENDREAD} function s.tgcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRitualSummoned() end function s.tgtg(e,c) return 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~=tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp))) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsRitualSummoned() end function s.thfilter(c) return c:IsSetCard(SET_VENDREAD) 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:
(This card is always treated as "Umi".) All WATER monsters gain 200 ATK/DEF. Once per turn, during your Main Phase: You can have all WATER monsters you currently control gain Levels equal to the number of WATER monsters you currently control, until the end of this turn.
--忘却の都 レミューリア --Lemuria, the Forgotten City 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) --Increase ATK/DEF local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_WATER)) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetValue(200) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --Increase Level local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_LVCHANGE) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_FZONE) e4:SetCountLimit(1) e4:SetTarget(s.lvtg) e4:SetOperation(s.lvop) c:RegisterEffect(e4) end function s.cfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) and c:HasLevel() end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local lv=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WATER),tp,LOCATION_MZONE,0,nil) if lv==0 then return end local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) local _,fid=g:GetMaxGroup(Card.GetFieldID) local c=e:GetHandler() --Increase Level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetRange(LOCATION_FZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.efftg) e1:SetValue(lv) e1:SetLabel(fid) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end function s.efftg(e,c) return c:GetFieldID()<=e:GetLabel() and c:IsAttribute(ATTRIBUTE_WATER) and c:HasLevel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner "Gusto" monsters When this card is Synchro Summoned: All "Gusto" monsters currently on the field gain 600 ATK.
--ダイガスタ・ファルコス --Daigusto Falcos local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsSetCard,SET_GUSTO),1,99) c:EnableReviveLimit() --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GUSTO} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_GUSTO) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(600) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Dragon Tuner + 1+ non-Tuner Winged Beast monsters Once per turn: You can add 1 Level 4 or lower Dragon or Winged Beast monster from your Deck to your hand, then discard 1 Dragon or Winged Beast monster.
--ドラグニティナイト-ガジャルグ --Dragunity Knight - Gae Dearg local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),1,1,Synchro.NonTunerEx(Card.IsRace,RACE_WINGEDBEAST),1,99) c:EnableReviveLimit() --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON|RACE_WINGEDBEAST) 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) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,1,tp,1) 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 return end Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.DiscardHand(tp,Card.IsRace,1,1,REASON_EFFECT|REASON_DISCARD,nil,RACE_DRAGON|RACE_WINGEDBEAST) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Destroy all monsters on the field, then both players reveal the top 5 cards from their Decks, then Special Summon all revealed Level 4 or lower monsters in face-up Attack Position or face-down Defense Position, also add any remaining cards to their hand. (If either player has less than 5 cards in their Deck, reveal as many as possible.)
--サイバーポッド --Cyber Jar --Scripted by edo9300 local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,PLAYER_ALL,LOCATION_DECK) end function s.spchk(c,e,tp) return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE) end local function summon(g,e,p,tograve,ft) if #g==0 then return end if ft==0 then tograve:Merge(g) return end if ft<#g then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_SPSUMMON) local newg=g:Select(p,ft,ft,nil) tograve:Merge(g:Sub(newg)) g=newg end for tc in g:Iter() do Duel.SpecialSummonStep(tc,0,p,p,false,false,POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,LOCATION_MZONE) Duel.Destroy(g,REASON_EFFECT) Duel.BreakEffect() local p=Duel.GetTurnPlayer() local summonable1,nonsummonable1=Duel.GetDecktopGroup(p,5):Split(s.spchk,nil,e,p) local summonable2,nonsummonable2=Duel.GetDecktopGroup(1-p,5):Split(s.spchk,nil,e,1-p) local ft1=Duel.GetLocationCount(p,LOCATION_MZONE) if ft1>1 and Duel.IsPlayerAffectedByEffect(p,CARD_BLUEEYES_SPIRIT) and #summonable1>1 then nonsummonable1:Merge(summonable1) summonable1:Clear() end local ft2=Duel.GetLocationCount(1-p,LOCATION_MZONE) if ft2>1 and Duel.IsPlayerAffectedByEffect(1-p,CARD_BLUEEYES_SPIRIT) and #summonable2>1 then nonsummonable2:Merge(summonable2) summonable2:Clear() end local tohand,tograve=nonsummonable1:Merge(nonsummonable2):Split(Card.IsAbleToHand,nil) Duel.DisableShuffleCheck() Duel.ConfirmDecktop(p,5) summon(summonable1,e,p,tograve,ft1) Duel.ConfirmDecktop(1-p,5) summon(summonable2,e,1-p,tograve,ft2) Duel.SpecialSummonComplete() if #tohand>0 then Duel.SendtoHand(tohand,nil,REASON_EFFECT) Duel.ShuffleHand(tp) Duel.ShuffleHand(1-tp) end if #tograve>0 then Duel.SendtoGrave(tograve,REASON_EFFECT) end local fg=Duel.GetMatchingGroup(Card.IsFacedown,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.ShuffleSetCard(fg) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is also always treated as a "Gaia The Fierce Knight" card.) If you control no monsters, or your opponent controls a monster with 2300 or more ATK, you can Normal Summon this card without Tributing. If this card is Normal or Special Summoned: You can Special Summon 1 Level 5 Dragon monster from your hand or GY in Defense Position. You can only use this effect of "Gaia the Magical Knight" once per turn.
--魔道騎士ガイア --Gaia the Magical Knight --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Normal Summon without tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) c:RegisterEffect(e1) --Special Summon 1 level 5 Dragon from hand or GY local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_GAIA_THE_FIERCE_KNIGHT} function s.ntcon(e,c,minc) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttackAbove,2300),tp,0,LOCATION_MZONE,1,nil)) end function s.spfilter(c,e,tp) return c:IsRace(RACE_DRAGON) and c:GetLevel()==5 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned from the Deck. If you control no monsters, you can Normal Summon this card without Tributing. Cannot be destroyed by battle or card effects. You take no battle damage from attacks involving this card. At the end of the Battle Phase, if this card battled: If your LP is lower than your opponent's, inflict damage to your opponent equal to the difference. Once per turn, during your Standby Phase: Shuffle this card into the Deck.
--時械神 ハイロン --Hailon, the Timelord --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetRange(LOCATION_DECK) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SUMMON_PROC) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) c:RegisterEffect(e2) --indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetValue(1) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e4) --damage val local e5=e3:Clone() e5:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) c:RegisterEffect(e5) --LP local e6=Effect.CreateEffect(c) e6:SetCategory(CATEGORY_DAMAGE) e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e6:SetCode(EVENT_PHASE|PHASE_BATTLE) e6:SetCountLimit(1) e6:SetRange(LOCATION_MZONE) e6:SetCondition(s.damcon) e6:SetTarget(s.damtg) e6:SetOperation(s.damop) c:RegisterEffect(e6) --to deck local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(id,1)) e7:SetCategory(CATEGORY_TODECK) e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e7:SetCode(EVENT_PHASE|PHASE_STANDBY) e7:SetProperty(EFFECT_FLAG_REPEAT) e7:SetCountLimit(1) e7:SetRange(LOCATION_MZONE) e7:SetCondition(s.tdcon) e7:SetTarget(s.tdtg) e7:SetOperation(s.tdop) c:RegisterEffect(e7) end function s.spcon(e,c) if c==nil then return true end return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLP(tp)<Duel.GetLP(1-tp) end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local val=Duel.GetLP(p)-Duel.GetLP(1-p) if val>0 then Duel.Damage(p,val,REASON_EFFECT) end end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() and c:IsAbleToDeck() then Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
An Xyz Monster that was Summoned using this card as Xyz Material gains this effect. ● If it is Xyz Summoned: It gains 1000 ATK.
--H・C エクストラ・ソード --Heroic Challenger - Extra Sword local s,id=GetID() function s.initial_effect(c) --effect gain local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(s.efcon) e1:SetOperation(s.efop) c:RegisterEffect(e1) end function s.efcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_XYZ end function s.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e2,true) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsXyzSummoned() 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_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters During the Main or Battle Phase, you can (Quick Effect): Immediately after this effect resolves, Synchro Summon 1 Dinosaur monster using this card you control. When a monster declares an attack: You can Special Summon 1 Dinosaur monster from your hand, ignoring its Summoning conditions, also you cannot Special Summon for the rest of this turn, except Dinosaur monsters. You can only use each effect of "Burial Bicorn Carnovorus" once per turn.
--葬角のカルノヴルス --Burial Bicorn Carnovorus --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Synchro Summon 1 Dinosaur monster using this card you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START|TIMING_BATTLE_END|TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsMainPhase() or Duel.IsBattlePhase() end) e1:SetTarget(s.synchtg) e1:SetOperation(s.synchop) c:RegisterEffect(e1) --Special Summon 1 Dinosaur monster from your hand, ignoring its Summoning conditions local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.handsptg) e2:SetOperation(s.handspop) c:RegisterEffect(e2) end function s.synchfilter(c,hc) return c:IsSynchroSummonable(hc) and c:IsRace(RACE_DINOSAUR) end function s.synchtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.synchfilter,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.synchop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsControler(tp) and c:IsFaceup()) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.synchfilter,tp,LOCATION_EXTRA,0,1,1,nil,c):GetFirst() if sc then Duel.SynchroSummon(tp,sc,c) end end function s.handspfilter(c,e,tp) return c:IsRace(RACE_DINOSAUR) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.handsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.handspfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.handspop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.handspfilter,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 --You cannot Special Summon for the rest of this turn, except Dinosaur monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return not c:IsRace(RACE_DINOSAUR) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a face-up Attack Position monster you control is destroyed by battle, during damage calculation, you can reduce the Battle Damage from this battle to 0 and Special Summon 1 Level 4 or lower Warrior-Type monster from your hand at the end of the Damage Step.
--死力のタッグ・チェンジ --Desperate Tag local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --no damage & spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() local bc=tc:GetBattleTarget() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() bc=Duel.GetAttacker() end if tc and tc:IsControler(1-tp) then return false end if not tc or not bc or not tc:IsPosition(POS_FACEUP_ATTACK) then return false end if tc:IsHasEffect(EFFECT_INDESTRUCTABLE_BATTLE) then local tcind={tc:GetCardEffect(EFFECT_INDESTRUCTABLE_BATTLE)} for i=1,#tcind do local te=tcind[i] local f=te:GetValue() if type(f)=='function' then if f(te,bc) then return false end else return false end end end if Duel.GetAttacker()==tc and bc:IsDefensePos() then return false end if bc:IsHasEffect(EFFECT_DEFENSE_ATTACK) then if bc:IsHasEffect(75372290) then return tc:GetAttack()<=bc:GetAttack() else return tc:GetAttack()<=bc:GetDefense() end else return tc:GetAttack()<=bc:GetAttack() end end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetTargetRange(1,0) e1:SetValue(1) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetReset(RESET_PHASE|PHASE_DAMAGE) e2:SetOperation(s.spop) Duel.RegisterEffect(e2,tp) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g~=0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster is Normal Summoned to your side of the field, except "Master of the Flaming Dragonswords": You can increase that monster's Level by 1, and this card gains 300 ATK until the End Phase.
--龍炎剣の使い手 --Master of the Flaming Dragonswords 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_TRIGGER_O+EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={id} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local tc=eg:GetFirst() if chk==0 then return tc:IsControler(tp) and not tc:IsCode(id) end tc:CreateEffectRelation(e) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=eg:GetFirst() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) if c:IsFaceup() and c:IsRelateToEffect(e) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(300) e2:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your GY: You can Tribute 2 monsters; Special Summon this card. If your opponent adds a card(s) to their hand (except during the Draw Phase or Damage Step): You can send 1 random card from their hand to the GY. If a monster(s) your opponent controls is sent to the GY by a card effect (except during the Damage Step): You can add 1 LIGHT or DARK Reptile monster from your Deck or GY to your hand, except "Aron, the Ogdoadic King". You can only use each effect of "Aron, the Ogdoadic King" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--溟界王-アロン --Aron, the Ogdoadic King --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Special Summon self from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Send random card from hand to GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_HAND) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.tgcon) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --Add LIGHT/DARK Reptile to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,2,false,aux.ReleaseCheckMMZ,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,2,2,false,aux.ReleaseCheckMMZ,nil) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()~=PHASE_DRAW and eg:IsExists(Card.IsControler,1,nil,1-tp) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,0,LOCATION_HAND,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,1,1,0,LOCATION_HAND) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):Filter(Card.IsAbleToGrave,nil) if #g>0 then local sg=g:RandomSelect(tp,1) Duel.SendtoGrave(sg,REASON_EFFECT) end end function s.lffilter(c,tp) return c:IsPreviousControler(tp) and c:IsMonster() and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.lffilter,1,nil,1-tp) end function s.thfilter(c) return c:IsRace(RACE_REPTILE) and (c:IsAttribute(ATTRIBUTE_LIGHT) or c:IsAttribute(ATTRIBUTE_DARK)) and c:IsAbleToHand() and not c:IsCode(id) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE|LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE|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,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE|LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,tp,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 Monster Card from your hand to the Graveyard. Select 1 monster on your side of the field with a lower Level than the discarded monster. The selected monster can attack twice this turn.
--ダブルアタック --Double Attack 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetLabel(0) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.filter1(c,tp) local lv=c:GetOriginalLevel() return lv>1 and c:IsMonster() and c:IsDiscardable() and c:IsAbleToGraveAsCost() and Duel.IsExistingTarget(s.filter2,tp,LOCATION_MZONE,0,1,nil,lv) end function s.filter2(c,lv) return c:IsFaceup() and c:IsLevelBelow(lv-1) and not c:IsHasEffect(EFFECT_EXTRA_ATTACK) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter2(chkc,e:GetLabel()) end if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_HAND,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local cg=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_HAND,0,1,1,nil,tp) Duel.SendtoGrave(cg,REASON_DISCARD|REASON_COST) local lv=cg:GetFirst():GetLevel() e:SetLabel(lv) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter2,tp,LOCATION_MZONE,0,1,1,nil,lv) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent from your hand or Deck to your Graveyard by an opponent's card effect: Special Summon this card.
--闇よりの恐怖 --Fear from the Dark 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_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND|LOCATION_DECK) and (r&REASON_EFFECT)~=0 and rp~=tp 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,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Field Spell Card is activated: You can Special Summon this card from your hand, then, if face-up cards are in both Field Zones, this card cannot be destroyed by battle or card effects this turn. You can only use this effect of "Meowseclick" once per turn. During your turn, the effects of the face-up card in your opponent's Field Zone are negated. During your opponent's turn, the effects of the face-up card in your Field Zone are negated.
--ニャータリング --Meowseclick --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Negate Field Spell effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_FZONE,LOCATION_FZONE) e1:SetTarget(function(_,c)return c:IsControler(1-Duel.GetTurnPlayer())end) c:RegisterEffect(e1) --Special Summon self local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return re:IsActiveType(TYPE_FIELD) and re:IsHasType(EFFECT_TYPE_ACTIVATE) 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) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(Card.IsFaceup,0,LOCATION_FZONE,LOCATION_FZONE,2,nil) then Duel.BreakEffect() --Cannot be destroyed by battle 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) c:RegisterEffect(e1) --Cannot be destroyed by card effects local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay 1000 Life Points to Special Summon 1 level 6 or lower Fusion Monster from your Extra Deck in face-up Attack or Defense Position. That Fusion Monster cannot attack your opponent's Life Points directly, and is returned to your Extra Deck at the end of the turn.
--魔導サイエンティスト --Magical Scientist local s,id=GetID() function s.initial_effect(c) --Special summon 1 level 6 or lower fusion monster from extra deck local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsType(TYPE_FUSION) and c:GetLevel()<=6 and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then --Cannot attack directly local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3207) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) --Return it to extra deck during end phase local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetOperation(s.retop) tc:RegisterEffect(e2) end end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKTOP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Monsters and "Tearlaments" monsters you control gain 500 ATK. If an Aqua "Tearlaments" monster is sent to your GY by card effect (except during the Damage Step): You can send 1 Level 4 or lower Aqua monster from your Deck to the GY, but if you sent a non-"Tearlaments" monster to the GY, for the rest of this turn you cannot activate cards, or the effects of cards, with the same name as that sent card. You can only use this effect of "Tearlaments Perlegia" once per turn.
--嫋々たる漣歌姫の壱世壊 --Tearlaments Perlegia --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) --Increase ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetRange(LOCATION_FZONE) e2:SetTarget(function(_,c) return c:IsSetCard(SET_TEARLAMENTS) or c:IsType(TYPE_FUSION) end) e2:SetValue(500) c:RegisterEffect(e2) --Send 1 Aqua monster from Deck to GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.grcon) e3:SetTarget(s.grtg) e3:SetOperation(s.grop) c:RegisterEffect(e3) end s.listed_series={SET_TEARLAMENTS} function s.cfilter(c,tp) return c:IsRace(RACE_AQUA) and c:IsSetCard(SET_TEARLAMENTS) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) end function s.grcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.grvfilter(c) return c:IsRace(RACE_AQUA) and c:IsLevelBelow(4) and c:IsAbleToGrave() end function s.grtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.grvfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.grop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.grvfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 then local tc=Duel.GetOperatedGroup():GetFirst() if tc:IsLocation(LOCATION_GRAVE) and not tc:IsSetCard(SET_TEARLAMENTS) then --Cannot activate card or effects with the same name if it's not a "Tearlaments" local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetLabel(tc:GetCode()) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end end function s.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabel()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your GY) by returning 1 "Dark World" monster you control to the hand, except "Grapha, Dragon Lord of Dark World". If this card is discarded to the GY by card effect: Target 1 card your opponent controls; destroy that target, then, if this card was discarded from your hand to your GY by an opponent's card effect, look at 1 random card in your opponent's hand, then, if it was a monster, you can Special Summon it to your field.
--暗黒界の龍神 グラファ --Grapha, Dragon Lord of Dark World 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_GRAVE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_DARK_WORLD} s.listed_names={id} function s.spfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_DARK_WORLD) and not c:IsCode(id) and c:IsAbleToHandAsCost() 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_MZONE,0,nil) local eff={c:GetCardEffect(EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then return false end end local tp=c:GetControler() return aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_RTOHAND,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.SendtoHand(g,nil,REASON_COST) g:DeleteGroup() end function s.descon(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(e:GetHandler():GetPreviousControler()) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and r&(REASON_DISCARD|REASON_EFFECT)==REASON_DISCARD|REASON_EFFECT 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 true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) if rp==tp then e:SetCategory(CATEGORY_DESTROY) else e:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and rp==1-tp and tp==e:GetLabel() then Duel.BreakEffect() local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #hg>0 then local cg=hg:RandomSelect(tp,1) local cc=cg:GetFirst() Duel.ConfirmCards(tp,cc) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and cc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.SpecialSummon(cc,0,tp,tp,false,false,POS_FACEUP) else Duel.ShuffleHand(1-tp) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Warrior Tuner + 1+ non-Tuner "Six Samurai" monsters If this card is Synchro Summoned: You can add 1 "Six Samurai" monster or "Shien" Effect Monster from your Deck or GY to your hand. You can only use this effect of "Legendary Lord Six Samurai - Shi En" once per turn. Once per turn, when your opponent activates a monster effect (Quick Effect): You can negate the activation, and if you do, destroy that card. If this card on the field would be destroyed by battle or card effect, you can destroy 1 monster you control instead.
--真魔六武衆-シエン --Legendary Lord Six Samurai - Shi En local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Warrior Tuner + 1+ non-Tuner "Six Samurai" monsters Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WARRIOR),1,1,Synchro.NonTunerEx(Card.IsSetCard,SET_SIX_SAMURAI),1,99) --Add 1 "Six Samurai" monster or "Shien" Effect Monster from your Deck or GY to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Negate the activation of an opponent's monster effect and destroy that monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and ep==1-tp and re:IsMonsterEffect() and Duel.IsChainNegatable(ev) end) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --If this card on the field would be destroyed by battle or card effect, you can destroy 1 other monster you control instead local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_MZONE) e3:SetTarget(s.desreptg) e3:SetOperation(s.desrepop) c:RegisterEffect(e3) end s.listed_series={SET_SIX_SAMURAI,SET_SHIEN} function s.thfilter(c) return (c:IsSetCard(SET_SIX_SAMURAI) or (c:IsSetCard(SET_SHIEN) and c:IsType(TYPE_EFFECT))) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.thop(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.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local rc=re:GetHandler() Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.repfilter(c,e) return c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED|STATUS_BATTLE_DESTROYED) end function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsReason(REASON_REPLACE) and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_MZONE,0,1,c,e) end if Duel.SelectEffectYesNo(tp,c,96) then Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local tc=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_MZONE,0,1,1,c,e):GetFirst() Duel.HintSelection(tc) e:SetLabelObject(tc) tc:SetStatus(STATUS_DESTROY_CONFIRMED,true) return true else return false end end function s.desrepop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() tc:SetStatus(STATUS_DESTROY_CONFIRMED,false) Duel.Destroy(tc,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each Player reveals 1 card from their hand. If one card is higher Level than the other, the card with the lower Level is sent to the Graveyard, and the player who revealed it takes 1000 damage. (Non-Monster Cards are treated as Level 0.)
--アンティ勝負 --Ante local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local h1=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) if e:GetHandler():IsLocation(LOCATION_HAND) then h1=h1-1 end local h2=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0) return (h1>0 and h2>0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 or Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g1=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONFIRM) local g2=Duel.SelectMatchingCard(1-tp,nil,1-tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g1) Duel.ConfirmCards(tp,g2) local atpsl=g1:GetFirst() local ntpsl=g2:GetFirst() local atplv=atpsl:IsMonster() and atpsl:GetLevel() or 0 local ntplv=ntpsl:IsMonster() and ntpsl:GetLevel() or 0 if atplv==ntplv then Duel.ShuffleHand(tp) Duel.ShuffleHand(1-tp) elseif atplv>ntplv then Duel.Damage(1-tp,1000,REASON_EFFECT) Duel.SendtoGrave(g2,REASON_EFFECT) Duel.ShuffleHand(tp) else Duel.Damage(tp,1000,REASON_EFFECT) Duel.SendtoGrave(g1,REASON_EFFECT) Duel.ShuffleHand(1-tp) 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 banish 1 LIGHT monster from your GY; draw 1 card. You can banish this card from your hand or field; add 1 Level 6 or lower WIND Beast monster from your Deck to your hand. You can only use 1 "Noble Knight's Shield-Bearer" effect per turn, and only once that turn.
--聖騎士の盾持ち --Noble Knight's Shield-Bearer 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_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_HAND|LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end 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) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.thfilter(c) return c:IsAbleToHand() and c:IsRace(RACE_BEAST) and c:IsAttribute(ATTRIBUTE_WIND) and c:IsLevelBelow(6) 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,chk) 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:
This card gains an effect based on your Main Monster Zone it is in. ● Leftmost: Increase its Level by 4. ● Rightmost: Increase its Level by 3. ● Center: Increase its Level by 2. ● Others: Increase its Level by 1.
--星向鳥 --Star Staring Starling --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetCondition(s.lvcon) e1:SetValue(s.lvval) c:RegisterEffect(e1) end s.levels={4,1,2,1,3} function s.lvcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSequence()<5 end function s.lvval(e,tp,eg,ep,ev,re,r,rp) return s.levels[e:GetHandler():GetSequence()+1] end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can pay 500 LP; add 1 "Vampire" monster from your Deck to your hand, except "Vampire Familiar". If this card is in your GY: You can send 1 "Vampire" card from your hand or face-up field to the GY; Special Summon this card, but banish it when it leaves the field. You can only use each effect of "Vampire Familiar" once per turn.
--ヴァンパイアの使い魔 --Vampire Familiar local s,id=GetID() function s.initial_effect(c) --If special summoned, add 1 "Vampire" monster from deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(Cost.PayLP(500)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special summon itself from GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_VAMPIRE} s.listed_names={id} function s.thfilter(c) return c:IsSetCard(SET_VAMPIRE) 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 function s.costfilter(c,tp) return c:IsSetCard(SET_VAMPIRE) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost() and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,1,nil,tp) Duel.SendtoGrave(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card declares an attack, your opponent cannot activate cards or effects. If this card attacks, it is changed to Defense Position at the end of the Battle Phase, and its battle position cannot be changed until the End Phase of your next turn.
--ゴブリン切り込み部隊 --Goblin Marauding Squad local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --to defense local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.poscon) e2:SetOperation(s.posop) c:RegisterEffect(e2) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(0,1) e1:SetValue(s.aclimit) e1:SetReset(RESET_CHAIN) Duel.RegisterEffect(e1,tp) end function s.aclimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:GetHandler():IsMonster() end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackedCount()>0 end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsAttackPos() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESETS_STANDARD_PHASE_END,3) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks, it gains 1200 ATK during the Damage Step only.
--ダッシュ・ウォリアー --Dash Warrior local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetCondition(s.condtion) e1:SetValue(1200) c:RegisterEffect(e1) end function s.condtion(e) local ph=Duel.GetCurrentPhase() return (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) and Duel.GetAttacker()==e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Set this card from your hand to your Spell & Trap Zone as a Spell. During your opponent's turn, if this Set card in the Spell & Trap Zone is destroyed and sent to your GY: Special Summon it. During your opponent's turn (Quick Effect): You can Tribute this card from your hand or face-up field; neither player can banish cards for the rest of this turn.
--アーティファクト-ロンギヌス --Artifact Lancea local s,id=GetID() function s.initial_effect(c) --Set local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MONSTER_SSET) e1:SetValue(TYPE_SPELL) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Prevent cards from being banished local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_HAND|LOCATION_MZONE) e3:SetCondition(s.rmcon) e3:SetCost(s.rmcost) e3:SetOperation(s.rmop) c:RegisterEffect(e3) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEDOWN) and c:IsReason(REASON_DESTROY) and Duel.IsTurnPlayer(1-tp) 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,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() and Duel.GetFlagEffect(0,id)==0 end Duel.Release(e:GetHandler(),REASON_COST) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_REMOVE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,1) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --30459350 chk local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(30459350) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,1,aux.Stringid(id,2),nil) Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an attack is declared involving your opponent's monster: Change that opponent's monster's ATK to 0, negate its effects, also it cannot change its battle position. You can banish this card from your GY; send 1 Level 5 or higher WATER monster from your Deck to the GY, then, you can add 1 WATER monster from your GY to your hand, also, until the end of your next turn after this effect resolves, you cannot Special Summon monsters, except WATER monsters. You can only use this effect of "Ice Barrier" once per turn.
--氷結界 --Ice Barrier --Scripted by fiftyfour local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Send 1 Level 5 or higher WATER monster from your Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local _,bc=Duel.GetBattleMonster(tp) if chk==0 then return bc and bc:IsFaceup() and (bc:IsAttackAbove(1) or bc:IsNegatableMonster() or not bc:IsHasEffect(EFFECT_CANNOT_CHANGE_POSITION)) end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,bc,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DISABLE,bc,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetFirstTarget() if not (bc:IsRelateToEffect(e) and bc:IsFaceup() and bc:IsRelateToBattle() and bc:IsControler(1-tp)) then return end local c=e:GetHandler() --Negate its effects bc:NegateEffects(c) --Change its ATK to 0 local e1=Effect.CreateEffect(c) e1:SetDescription(3313) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) bc:RegisterEffect(e1) --Cannot change its battle position local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION) bc:RegisterEffect(e2) end function s.tgfilter(c) return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_WATER) 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,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand() end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.IsTurnPlayer(tp) and 2 or 1 --Cannot Special Summon monsters, except WATER monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(_e,_c) return not _c:IsAttribute(ATTRIBUTE_WATER) end) e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,ct) Duel.RegisterEffect(e1,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tgc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if not (tgc and Duel.SendtoGrave(tgc,REASON_EFFECT)>0 and tgc:IsLocation(LOCATION_GRAVE)) then return end local thg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE,0,nil) if #thg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=thg:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during the Standby Phase of the next turn after this card was destroyed by battle and sent to the GY: You can pay 500 Life Points; Special Summon this card from the GY. If you do: It gains 500 ATK. * The above text is unofficial and describes the card's functionality in the OCG.
--カース・オブ・ヴァンパイア --Vampire's Curse local s,id=GetID() function s.initial_effect(c) --Destroyed by battle check local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.regcon) e1:SetOperation(s.regop) c:RegisterEffect(e1) --Special Summon itself local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.spcon) e2:SetCost(Cost.PayLP(500)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Increase ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(s.upcon) e3:SetOperation(s.upop) c:RegisterEffect(e3) end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 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,1,tp,false,false) end e:GetHandler():ResetFlagEffect(id) 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,1,tp,tp,false,false,POS_FACEUP) end end function s.upcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.upop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If all monsters you control are Normal Monsters (min. 1): Target 1 card your opponent controls; destroy it. If "Umi" is on the field, you can activate this card from your hand. You can banish this card from your Graveyard, then target 1 Normal Monster you control; equip that Normal Monster with all "Phantasm Spiral" Equip Spell Cards you control that can equip to it.
--幻煌龍の戦渦 --Phantasm Spiral Battle local s,id=GetID() function s.initial_effect(c) --Destroy 1 card the opponent controls local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Can be activated from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRAP_ACT_IN_HAND) e2:SetCondition(function() return Duel.IsEnvironment(CARD_UMI) end) c:RegisterEffect(e2) --Equip 1 Normal monster with all "Phantasm Spiral" Equip Spells you control local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_EQUIP) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_GRAVE) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.eqtg) e3:SetOperation(s.eqop) c:RegisterEffect(e3) end s.listed_series={SET_PHANTASM_SPIRAL} s.listed_names={CARD_UMI} function s.cfilter(c) return c:IsFacedown() or not c:IsType(TYPE_NORMAL) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)>0 and not Duel.IsExistingMatchingCard(s.cfilter,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:IsControler(1-tp) and chkc:IsOnField() 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.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.efilter(c,tp) return c:IsFaceup() and c:IsType(TYPE_NORMAL) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_SZONE,0,1,nil,c) end function s.eqfilter(c,tc) return c:IsFaceup() and c:IsEquipSpell() and c:IsSetCard(SET_PHANTASM_SPIRAL) and c:CheckEquipTarget(tc) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.efilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.efilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.efilter,tp,LOCATION_MZONE,0,1,1,nil,tp) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc or tc:IsFacedown() or not tc:IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.eqfilter,tp,LOCATION_SZONE,0,nil,tc) if #g==0 then return end for eq in g:Iter() do Duel.Equip(tp,eq,tc,true,true) end Duel.EquipComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Tribute 1 "Magician Girl" monster, except "Lemon Magician Girl"; add 1 Spellcaster-Type monster from your Deck to your hand. Once per turn, if this card is targeted for an attack: You can Special Summon 1 Spellcaster-Type monster from your hand, but its effects (if any) are negated, then change the attack target to it, and if you do, the attacking monster's ATK becomes half its current ATK.
--レモン・マジシャン・ガール --Lemon Magician Girl 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:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetCountLimit(1) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_MAGICIAN_GIRL} s.listed_names={id} function s.cfilter(c) return c:IsSetCard(SET_MAGICIAN_GIRL) and not c:IsCode(id) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil) Duel.Release(g,REASON_COST) end function s.filter(c) return 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.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spfilter(c,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() 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) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) local at=Duel.GetAttacker() if at and not at:IsImmuneToEffect(e) and Duel.ChangeAttackTarget(tc) then Duel.BreakEffect() local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SET_ATTACK_FINAL) e3:SetReset(RESET_EVENT|RESETS_STANDARD) e3:SetValue(math.ceil(at:GetAttack()/2)) at:RegisterEffect(e3) end Duel.SpecialSummonComplete() end end