instruction
stringclasses
1 value
input
stringlengths
10
1.11k
output
stringlengths
67
7.06k
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn, if you Pendulum Summon a "D/D/D" monster(s): You can target 3 monsters your opponent controls with the same Type or Attribute as each other; Tribute 2 of those 3 face-up monsters, and if you do, the third gains ATK/DEF equal to the total ATK/DEF the Tributed monsters had on the field. ---------------------------------------- [ Monster Effect ] You can discard 1 other "D/D" monster; Special Summon this card from your hand. If this card is Normal or Special Summoned: You can add 1 "D/D" monster with 0 ATK or DEF from your Deck to your hand. You can only use each effect of "D/D Count Surveyor" once per turn.
--DDカウント・サーベイヤー --D/D Count Surveyor --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Pendulum Summon procedure Pendulum.AddProcedure(c) --Tribute 2 monsters your opponent controls and another one gains ATK/DEF equal to the total ATK/DEF the Tributed monsters had on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RELEASE+CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCondition(s.tributecon) e1:SetTarget(s.tributetg) e1:SetOperation(s.tributeop) c:RegisterEffect(e1) --Special Summon this card from your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCost(Cost.Discard(function(c) return c:IsSetCard(SET_DD) and c:IsMonster() end,true)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Add 1 "D/D" monster with 0 ATK or DEF from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) end s.listed_series={SET_DD,SET_DDD} function s.tributeconfilter(c,tp) return c:IsPendulumSummoned() and c:IsSummonPlayer(tp) and c:IsSetCard(SET_DDD) end function s.tributecon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tributeconfilter,1,nil,tp) end function s.rescon(sg,e,tp,mg) return (sg:GetClassCount(Card.GetAttribute)==1 or sg:GetClassCount(Card.GetRace)==1) and sg:IsExists(Card.IsReleasableByEffect,2,nil) end function s.tributetg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeEffectTarget,e),tp,0,LOCATION_MZONE,nil) if chk==0 then return #g>=3 and aux.SelectUnselectGroup(g,e,tp,3,3,s.rescon,0) end local tg=aux.SelectUnselectGroup(g,e,tp,3,3,s.rescon,1,tp,HINTMSG_TARGET) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_RELEASE,tg,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,tg,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DEFCHANGE,tg,1,tp,0) end function s.tributeop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil) if #tg~=3 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local sg=tg:FilterSelect(tp,Card.IsReleasableByEffect,2,2,nil) if #sg~=2 then return end Duel.HintSelection(sg) tg:RemoveCard(sg) local atk=sg:GetSum(Card.GetAttack) local def=sg:GetSum(Card.GetDefense) if Duel.Release(sg,REASON_EFFECT)==2 then local c=e:GetHandler() local atkdef_c=tg:GetFirst() if atk>0 then atkdef_c:UpdateAttack(atk,RESET_EVENT|RESETS_STANDARD,c) end if def>0 then atkdef_c:UpdateDefense(def,RESET_EVENT|RESETS_STANDARD,c) end 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) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c) return c:IsSetCard(SET_DD) and c:IsMonster() and c:IsAbleToHand() and (c:IsAttack(0) or c:IsDefense(0)) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 Level 4 or lower "X-Saber" monster from your hand. Cannot be used as a Synchro Material, except for the Synchro Summon of an "X-Saber" Synchro Monster.
--XX-セイバー ボガーナイト --XX-Saber Boggart Knight local s,id=GetID() function s.initial_effect(c) --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) --synchro limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetValue(s.synlimit) c:RegisterEffect(e2) end function s.synlimit(e,c) if not c then return false end return not c:IsSetCard(SET_X_SABER) end function s.filter(c,e,tp) return c:GetLevel()<=4 and c:IsSetCard(SET_X_SABER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
At the start of your Main Phase 1: Add 1 "Abyss Actor" card and 1 "Abyss Script" Spell from your Deck to your hand. For the rest of this turn after this card resolves, you cannot Pendulum Summon monsters, except "Abyss Actor" monsters.
--魔界劇団のゲネプロ --Abyss Actors' Dress Rehearsal --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Add Add 1 "Abyss Actor" card and 1 "Abyss Script" Spell to the hand 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 s.listed_series={SET_ABYSS_ACTOR,SET_ABYSS_SCRIPT} 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:IsAbleToHand() and (c:IsSetCard(SET_ABYSS_ACTOR) or (c:IsSpell() and c:IsSetCard(SET_ABYSS_SCRIPT))) end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsSetCard,1,nil,SET_ABYSS_ACTOR) and sg:IsExists(function(c) return c:IsSpell() and c:IsSetCard(SET_ABYSS_SCRIPT) end,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) return #g>1 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_ATOHAND) if #rg>0 then Duel.SendtoHand(rg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,rg) end if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end --Cannot Pendulum Summon for the rest of the turn, except "Abyss Actor" monsters local e1=Effect.CreateEffect(e:GetHandler()) 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(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsSetCard(SET_ABYSS_ACTOR) and aux.penlimit(e,se,sump,sumtype) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 3 face-up Traps you control to the GY. This card gains 1000 ATK for each Continuous Trap in your GY. Once per turn: You can target 1 Set Spell/Trap your opponent controls; destroy that target. Neither player can activate Spell/Trap Cards in response to this effect's activation.
--神炎皇ウリア --Uria, Lord of Searing Flames local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Cannot be special summoned local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --Special summon procedure local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Increase ATK local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(s.atkval) c:RegisterEffect(e3) --Destroy Spell/Trap local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end function s.spfilter(c,tp) return c:IsFaceup() and c:IsTrap() and c:IsAbleToGraveAsCost() end function s.exfilter(c,tp) return c:IsTrap() and c:IsAbleToGraveAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=nil if Duel.IsPlayerAffectedByEffect(tp,16317140) then g=Duel.GetMatchingGroup(s.exfilter,tp,LOCATION_ONFIELD,0,nil) else g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_ONFIELD,0,nil) end return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and #g>2 and aux.SelectUnselectGroup(g,e,tp,3,3,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local g=nil if Duel.IsPlayerAffectedByEffect(tp,16317140) then g=Duel.GetMatchingGroup(s.exfilter,tp,LOCATION_ONFIELD,0,nil) else g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_ONFIELD,0,nil) end local sg=aux.SelectUnselectGroup(g,e,tp,3,3,aux.ChkfMMZ(1),1,tp,HINTMSG_TOGRAVE,nil,nil,true) local dg=sg:Filter(Card.IsFacedown,nil) if #dg>0 then Duel.ConfirmCards(1-tp,dg) end if #sg==3 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.SendtoGrave(g,REASON_COST) g:DeleteGroup() end function s.atkfilter(c) return c:IsContinuousTrap() end function s.atkval(e,c) return Duel.GetMatchingGroupCount(s.atkfilter,c:GetControler(),LOCATION_GRAVE,0,nil)*1000 end function s.destg(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_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFacedown,tp,0,LOCATION_SZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetChainLimit(s.chainlimit) end function s.chainlimit(e,rp,tp) return not e:IsHasType(EFFECT_TYPE_ACTIVATE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFacedown() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Plaguespreader Zombie" + 1+ non-Tuner Zombie monsters When this card is Special Summoned: You can target 1 Zombie monster in your opponent's GY; Special Summon that target to your field in Attack Position, but destroy it when this card leaves the field.
--デスカイザー・ドラゴン --Doomkaiser Dragon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterSummonCode(33420078),1,1,Synchro.NonTunerEx(Card.IsRace,RACE_ZOMBIE),1,99) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(s.desop) e2:SetLabelObject(e1) c:RegisterEffect(e2) end s.material={33420078} s.listed_names={33420078} function s.filter(c,e,tp) return c:IsRace(RACE_ZOMBIE) 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(1-tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsRace(RACE_ZOMBIE) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK)~=0 then if c:IsFacedown() or not c:IsRelateToEffect(e) then return end c:SetCardTarget(tc) e:SetLabelObject(tc) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0) c:RegisterFlagEffect(id,RESET_EVENT|RESET_TURN_SET|RESET_TOFIELD,0,0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject():GetLabelObject() if tc and tc:GetFlagEffect(id)~=0 and e:GetHandler():GetFlagEffect(id)~=0 then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned with the effect of a "Bonding" Spell/Trap. If this card is Special Summoned: You can activate this effect; Effect Monsters your opponent currently controls cannot activate their effects for the rest of this turn, also change their ATK to 0 until the end of this turn. (Quick Effect): You can Tribute this card; Special Summon 2 "Water Dragon" from your hand and/or Deck in Defense Position, ignoring their Summoning conditions.
--ウォーター・ドラゴン-クラスター --Water Dragon Cluster local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Must be special summoned with effect of "Bonding" spell/trap local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --Change opponent's monsters' ATK to 0, also cannot activate their effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --Special summon 2 "Water Dragons" from hand or deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={85066822} function s.splimit(e,se,sp,st) local sc=se:GetHandler() return sc and sc:IsSpellTrap() and sc:IsSetCard(SET_BONDING) end function s.atkfilter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkfilter,tp,0,LOCATION_MZONE,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.atkfilter,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do --Change their ATK to 0 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) --Cannot activate their effects local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(3302) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_TRIGGER) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.spfilter(c,e,tp) return c:IsCode(85066822) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEUP_DEFENSE) 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>1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,2,nil,e,tp) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,2,2,nil,e,tp) if #g==2 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster declares an attack: You can Special Summon this card from your hand in Defense Position. You can only use this effect of "Vampire Fraulein" once per turn. Once per battle, if your Zombie monster battles an opponent's monster, during that damage calculation (Quick Effect): You can pay LP in multiples of 100 (max. 3000); your battling monster gains that much ATK/DEF during that damage calculation only. At the end of the Battle Phase, if this card destroyed any monster(s) by battle: You can Special Summon them from the GYs to your field.
--ヴァンパイア・フロイライン --Vampire Fraulein local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg1) e1:SetOperation(s.spop1) c:RegisterEffect(e1) --Increase ATK/DEF per multiples of 100 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.atkcon) e2:SetCost(s.atkcost) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --Register when destroying a monster local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetOperation(s.regop) c:RegisterEffect(e3) --Special summon the monsters this card destroyed by battle local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PHASE|PHASE_BATTLE) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.spcon2) e4:SetTarget(s.sptg2) e4:SetOperation(s.spop2) c:RegisterEffect(e4) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) if Duel.GetAttackTarget()~=nil then return (Duel.GetAttacker():IsControler(tp) and Duel.GetAttacker():IsRace(RACE_ZOMBIE)) or (Duel.GetAttackTarget() and Duel.GetAttackTarget():IsControler(tp) and Duel.GetAttackTarget():IsRace(RACE_ZOMBIE)) end end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.CheckLPCost(tp,100) end local lp=Duel.GetLP(tp) local m=math.floor(math.min(lp,3000)/100) local t={} for i=1,m do t[i]=i*100 end local ac=Duel.AnnounceNumber(tp,table.unpack(t)) Duel.PayLPCost(tp,ac) e:SetLabel(ac) e:GetHandler():RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE_CAL,0,1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=Duel.GetAttacker() if c:IsControler(1-tp) then c=Duel.GetAttackTarget() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(e:GetLabel()) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id+1,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE,0,1) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id+1)~=0 end function s.spfilter2(c,e,tp,rc,tid) return c:IsReason(REASON_BATTLE) and c:GetReasonCard()==rc and c:GetTurnID()==tid and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) end local g=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,LOCATION_GRAVE) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=nil local tg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter2),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) if #tg>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) g=tg:Select(tp,ft,ft,nil) else g=tg end 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:
If you control no face-up monsters, or the only face-up monsters you control are "R.B." monsters, you can Special Summon this card (from your hand). You can only Special Summon "R.B. Ga10 Driller" once per turn this way. During the Main Phase, if this card is linked to an "R.B." Link Monster (Quick Effect): You can pay 500 LP, then target 1 monster your opponent controls; destroy both that monster and this card. You can only use this effect of "R.B. Ga10 Driller" once per turn.
-- --R.B. Ga10 Driller --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --If you control no face-up monsters, on the only face-up monsters you control are "R.B." monsters, you can Special Summon this card (from your hand) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Destroy both 1 monster your opponent controls and this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e2:SetCondition(s.descon) e2:SetCost(Cost.PayLP(500)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_RB} function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (#g==0 or g:FilterCount(Card.IsSetCard,nil,SET_RB)==#g) end function s.desconfilter(c,ec,lg) return c:IsSetCard(SET_RB) and c:IsLinkMonster() and c:IsFaceup() and (lg:IsContains(c) or c:GetLinkedGroup():IsContains(ec)) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsMainPhase() and Duel.IsExistingMatchingCard(s.desconfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c,c:GetLinkedGroup()) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil,tp)+e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsMonster() then Duel.Destroy(Group.FromCards(tc,c),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a Spell Card is activated, place 2 Spell Counters on this card when that Spell resolves. Once per turn: You can remove any number of Spell Counters from this card; Special Summon 1 Spellcaster monster from your hand or GY whose Level is equal to the number of Spell Counters you removed.
--マジカル・コンダクター --Magical Exemplar local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(COUNTER_SPELL) --add counter local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_CHAINING) e0:SetRange(LOCATION_MZONE) e0:SetOperation(aux.chainreg) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.acop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.counter_place_list={COUNTER_SPELL} function s.acop(e,tp,eg,ep,ev,re,r,rp) if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() and e:GetHandler():GetFlagEffect(1)>0 then e:GetHandler():AddCounter(COUNTER_SPELL,2) end end function s.filter(c,cc,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:HasLevel() and cc:IsCanRemoveCounter(tp,COUNTER_SPELL,c:GetLevel(),REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e:GetHandler(),e,tp) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_HAND|LOCATION_GRAVE,0,nil,e:GetHandler(),e,tp) local lvt={} local tc=g:GetFirst() for tc in aux.Next(g) do local tlv=tc:GetLevel() lvt[tlv]=tlv end local pc=1 for i=1,12 do if lvt[i] then lvt[i]=nil lvt[pc]=i pc=pc+1 end end lvt[pc]=nil Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local lv=Duel.AnnounceNumber(tp,table.unpack(lvt)) e:GetHandler():RemoveCounter(tp,COUNTER_SPELL,lv,REASON_COST) e:SetLabel(lv) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.sfilter(c,lv,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:GetLevel()==lv end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local lv=e:GetLabel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.sfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,lv,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:
Apply these effects, in sequence, depending on the number of "Ice Barrier" Synchro Monsters you control with different names; ● 1+: Banish 1 card your opponent controls. ● 2+: Banish 1 card from your opponent's GY. ● 3+: Banish 1 random card from your opponent's hand. When your opponent activates a card or effect that targets an "Ice Barrier" Synchro Monster(s) you control: You can banish this card from your GY; negate that effect. You can only use each effect of "Terror of Trishula" once per turn.
--トリシューラの鼓動 --Terror of Trishula --Scripted by DyXel local s,id=GetID() function s.initial_effect(c) --Banish based on numbers of "Ice Barrier" Synchro Monster(s) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.bantg) e1:SetOperation(s.banop) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --Negate effect that targets "Ice Barrier" Synchro Monster(s) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.discon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.distg) e2:SetOperation(function(_,_,_,_,ev) Duel.NegateEffect(ev) end) c:RegisterEffect(e2) end s.listed_series={SET_ICE_BARRIER} function s.smfilter(c,tp) return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsSetCard(SET_ICE_BARRIER) and c:IsType(TYPE_SYNCHRO) end function s.bancheck(tp,loc) return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,loc,1,nil) end function s.bantg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(s.smfilter,tp,LOCATION_MZONE,0,nil,tp) local dnc=math.min(g:GetClassCount(Card.GetCode),3) if dnc==0 then return false end local b1=dnc>0 and s.bancheck(tp,LOCATION_ONFIELD) local b2=dnc>1 and s.bancheck(tp,LOCATION_GRAVE) local b3=dnc>2 and s.bancheck(tp,LOCATION_HAND) return b1 or b2 or b3 end Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_ONFIELD|LOCATION_GRAVE|LOCATION_HAND) end function s.banlocop(tp,loc,gf) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,loc,nil) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local sg=gf(g,tp,1,1,nil) Duel.HintSelection(sg,true) return Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) end return 0 end function s.banop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.smfilter,tp,LOCATION_MZONE,0,nil,tp) local dnc=g:GetClassCount(Card.GetCode) if dnc==0 then return end local break_chk=0 if dnc>0 then break_chk=s.banlocop(tp,LOCATION_ONFIELD,Group.Select) end if dnc>1 then if break_chk>0 then Duel.BreakEffect() end break_chk=s.banlocop(tp,LOCATION_GRAVE,Group.Select) end if dnc>2 then if break_chk>0 then Duel.BreakEffect() end break_chk=s.banlocop(tp,LOCATION_HAND,Group.RandomSelect) end end function s.discon(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) or rp==tp then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg:IsExists(s.smfilter,1,nil,tp) and Duel.IsChainDisablable(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_DISABLE,eg,1,0,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can equip 1 Level 7 or 8 Dragon monster from your hand or Deck to this card. This card is unaffected by other monsters' effects, while equipped with an Equip Card. You can Tribute 1 monster and this card, then target 1 Level 7 or 8 Dragon monster in your GY; Special Summon it.
--巨竜の聖騎士 --Paladin of Felgrand local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e2) --immune local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_IMMUNE_EFFECT) e3:SetCondition(s.eqcon) e3:SetValue(s.efilter) c:RegisterEffect(e3) --spsummon 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:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.eqval(ec,c,tp) return ec:IsControler(tp) and ec:IsRace(RACE_DRAGON) and (ec:IsLevel(7) or ec:IsLevel(8)) end function s.filter(c) return c:IsRace(RACE_DRAGON) and (c:IsLevel(7) or c:IsLevel(8)) and not c:IsForbidden() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK|LOCATION_HAND) end function s.equipop(c,e,tp,tc) c:EquipByEffectAndLimitRegister(e,tp,tc,nil,true) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,c) local tc=g:GetFirst() if tc then s.equipop(c,e,tp,tc) end end function s.eqcon(e) local eg=e:GetHandler():GetEquipGroup() return #eg>0 end function s.efilter(e,te) return te:IsMonsterEffect() and te:GetOwner()~=e:GetOwner() end function s.spfilter(c,e,tp) return c:IsRace(RACE_DRAGON) and (c:IsLevel(7) or c:IsLevel(8)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsReleasable() and Duel.CheckReleaseGroupCost(tp,nil,1,false,aux.ReleaseCheckMMZ,c) end local rg=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,aux.ReleaseCheckMMZ,c) rg:AddCard(c) Duel.Release(rg,REASON_COST) 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)>-2 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 and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 "Frightfur" Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from your field or Graveyard. You can only activate 1 "Frightfur Fusion" per turn.
--魔玩具融合 --Frightfur Fusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsSetCard,SET_FRIGHTFUR),Fusion.OnFieldMat(Card.IsAbleToRemove),s.fextra,Fusion.BanishMaterial,nil,nil,nil,nil,nil,nil,nil,nil,nil,s.extratg) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) end function s.fextra(e,tp,mg) if not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToRemove),tp,LOCATION_GRAVE,0,nil) end return nil end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_MZONE|LOCATION_GRAVE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If "Clear World" is on the field: You can add 1 monster that mentions "Clear World" from your Deck to your hand. You can only use this effect of "Clear Wall" once per turn. Monsters that mention "Clear World" cannot be destroyed by battle, also you take no battle damage from that battle. While you control a Level 7 or higher monster that mentions "Clear World", your opponent receives all effects of "Clear World", regardless of the monster Attributes they control.
--クリアー・ウォール --Clear Wall --scripted by pyrQ 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) --Add 1 monster that mentions "Clear World" from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_CLEAR_WORLD),0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Monsters that mention "Clear World" cannot be destroyed by battle local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(function(e,c) return c:ListsCode(CARD_CLEAR_WORLD) end) e2:SetValue(1) c:RegisterEffect(e2) --You take no battle damage from battles involving monsters that mention "Clear World" local e3=e2:Clone() e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e3:SetValue(aux.ChangeBattleDamage(0,0)) c:RegisterEffect(e3) --All effects of "Clear World" are applied to your opponent regardless of the Attributes they control local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EFFECT_CLEAR_WALL) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(1,0) e4:SetCondition(s.clearwallcon) c:RegisterEffect(e4) end s.listed_names={CARD_CLEAR_WORLD} function s.thfilter(c) return c:ListsCode(CARD_CLEAR_WORLD) 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.clearwallconfilter(c) return c:IsLevelAbove(7) and c:ListsCode(CARD_CLEAR_WORLD) and c:IsFaceup() end function s.clearwallcon(e) return Duel.IsExistingMatchingCard(s.clearwallconfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While a face-up Level 3 or lower Normal Monster is on your side of the field, your opponent cannot select this card as an attack target. While this card is face-up on your side of the field, any Battle Damage to the controller of this card from battle involving a Level 3 or lower Normal Monster becomes 0.
--オアシスの使者 --Emissary of the Oasis local s,id=GetID() function s.initial_effect(c) --atk target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e1:SetCondition(s.atkcon) e1:SetValue(aux.imval1) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetTarget(s.cfilter2) e2:SetValue(1) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,LOCATION_MZONE) e3:SetCode(EFFECT_NO_BATTLE_DAMAGE) e3:SetTarget(s.cfilter2) c:RegisterEffect(e3) end function s.cfilter1(c) return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsLevelBelow(3) end function s.cfilter2(e,c) return c:IsType(TYPE_NORMAL) and c:IsLevelBelow(3) end function s.atkcon(e) return Duel.IsExistingMatchingCard(s.cfilter1,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can Special Summon 1 "Bubonic Vermin" from your Deck in face-down Defense Position. Then shuffle your Deck.
--デスハムスター --Bubonic Vermin local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.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.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstMatchingCard(s.filter,tp,LOCATION_DECK,0,nil,e,tp) if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate while the only monster you control is 1 face-up "X-Saber" monster. Equip this card to that monster. It gains 800 ATK. If it destroys your opponent's monster by battle, draw 1 card.
--身剣一体 --At One With the Sword local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(s.condition) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_X_SABER} function s.condition(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated() then return false end local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) local tc=g:GetFirst() e:SetLabelObject(tc) return #g==1 and tc:IsFaceup() and tc:IsSetCard(SET_X_SABER) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and e:GetLabelObject():IsCanBeEffectTarget(e) end Duel.SetTargetCard(e:GetLabelObject()) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) or not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=e:GetLabelObject() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) --draw local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCategory(CATEGORY_DRAW) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(800) c:RegisterEffect(e2) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(s.eqlimit) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) else c:CancelToGrave(false) end end function s.eqlimit(e,c) return c:IsSetCard(SET_X_SABER) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsContains(e:GetHandler():GetEquipTarget()) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is flipped face-up: You can target 1 other monster on the field; change it to face-up Attack Position or face-down Defense Position. You can only use this effect of "Swarm of Centipedes" once per turn. Once per turn, during your Main Phase: You can change this card to face-down Defense Position.
--ムカデの進軍 --Swarm of Centipedes --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Change the position of another monster on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FLIP) e1:SetCountLimit(1,id) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --Change itself to face-down local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.selfpostg) e2:SetOperation(s.selfposop) c:RegisterEffect(e2) end function s.posfilter(c) return c:IsCanTurnSet() or not c:IsPosition(POS_FACEUP_ATTACK) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.posfilter(chkc) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local opt=0 if (tc:IsPosition(POS_FACEDOWN) or tc:IsType(TYPE_TOKEN)) then opt=POS_FACEUP_ATTACK elseif tc:IsPosition(POS_FACEUP_ATTACK) then opt=POS_FACEDOWN_DEFENSE elseif tc:IsPosition(POS_FACEUP_DEFENSE) then opt=POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE end if opt==0 then return end local pos=Duel.SelectPosition(tp,tc,opt) if pos==0 then return end Duel.ChangePosition(tc,pos) end function s.selfpostg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and not c:HasFlagEffect(id) end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,tp,0) end function s.selfposop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Skull Servant" while in the GY. If a Level 3 or lower Zombie monster(s) you control would be destroyed by battle or card effect, you can discard this card, instead. If this card is sent to the GY: You can add 2 monsters with different names from your Deck to your hand, except "Wightbaking", that are either "Skull Servant" or mention it, then discard 1 card. You can only use this effect of "Wightbaking" once per turn.
--ワイトベイキング --Wightbaking --Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Name becomes "Skull Servant" while in GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_GRAVE) e1:SetValue(CARD_SKULL_SERVANT) c:RegisterEffect(e1) --Substitute destruction for a level 3 or lower zombie monster(s) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_HAND) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) --Add 2 "Skull Servant"/monsters that lists "Skull Servant" with different names from the Deck, then discard 1 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_HANDES) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end --Specifically lists "Skull Servant" and itself s.listed_names={CARD_SKULL_SERVANT,id} --Check for level 3 or lower zombie monsters function s.repfilter(c,tp) return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and c:IsLevelBelow(3) and c:IsControler(tp) and not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT|REASON_BATTLE) end --Activation legality function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDiscardable() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end --Discard itself as substitute for a level 3 or lower zombie monster's destruction function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT+REASON_DISCARD+REASON_REPLACE) end --Check for "Skull Servant" or a monster that lists "Skull Servant" function s.thfilter(c) return not c:IsCode(id) and c:IsAbleToHand() and (c:IsCode(CARD_SKULL_SERVANT) or (c:IsMonster() and c:ListsCode(CARD_SKULL_SERVANT))) end --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end --Add up to 2 "Skull Servant"/monsters that lists "Skull Servant" from deck, then discard 1 function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 then local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_ATOHAND) if #sg>0 and Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except by Tributing 1 face-up "Warrior of Zera" on your side of the field while "Pandemonium" is on the field. If "Pandemonium" is on your side of the field when you Special Summon this card, your opponent discards 3 random cards from their hand. If "Pandemonium" is not on your side of the field, this effect is not applied.
--デビルマゼラ --Mazera DeVille local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --handes local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_HANDES) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetTarget(s.hdtg) e3:SetOperation(s.hdop) c:RegisterEffect(e3) end s.listed_names={66073051,94585852} function s.spcon(e,c) if c==nil then return Duel.IsEnvironment(94585852) end return Duel.CheckReleaseGroup(c:GetControler(),aux.FaceupFilter(Card.IsCode,66073051),1,false,1,true,c,c:GetControler(),nil,false,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,aux.FaceupFilter(Card.IsCode,66073051),1,1,false,true,true,c,nil,nil,false,nil) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST) g:DeleteGroup() end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,3) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsEnvironment(94585852) then local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,3) Duel.SendtoGrave(g,REASON_EFFECT|REASON_DISCARD) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay 500 Life Points. Negate the activation of a Trap Card and return it to its original position.
--誤作動 --Malfunction local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(Cost.PayLP(500)) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsTrapEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if not re:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then return re:GetHandler():IsCanTurnSet() else return true end end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsStatus(STATUS_ACT_FROM_HAND) then Duel.SetOperationInfo(0,CATEGORY_TOHAND,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) then if rc:IsStatus(STATUS_ACT_FROM_HAND) then rc:CancelToGrave() Duel.SendtoHand(rc,nil,REASON_EFFECT) else if rc:IsCanTurnSet() then rc:CancelToGrave() Duel.ChangePosition(rc,POS_FACEDOWN) rc:SetStatus(STATUS_ACTIVATE_DISABLED,false) rc:SetStatus(STATUS_SET_TURN,false) Duel.RaiseEvent(rc,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While attacking, this card cannot be destroyed by battle. If this card attacks, after damage calculation, inflict damage equal to half the ATK of the attack target to your opponent.
--ワンショット・ロケット --Turbo Rocket local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --battle indestructable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetCondition(s.indcon) e2:SetValue(1) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler()==Duel.GetAttacker() and Duel.GetAttackTarget() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dam=Duel.GetAttackTarget():GetAttack()/2 Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,dam) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Damage(p,Duel.GetAttackTarget():GetAttack()/2,REASON_EFFECT) end function s.indcon(e) return e:GetHandler()==Duel.GetAttacker() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can Special Summon up to 2 copies of "Fluffal Mouse" from your Deck. This effect can only be used once while this card is face-up on the field. You cannot Special Summon monsters from the Extra Deck the turn you activate this effect, except "Frightfur" monsters.
--ファーニマル・マウス --Fluffal Mouse local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET) e1:SetCountLimit(1) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_FRIGHTFUR} function s.counterfilter(c) return c:IsSetCard(SET_FRIGHTFUR) or not c:IsSummonLocation(LOCATION_EXTRA) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 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_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsSetCard(SET_FRIGHTFUR) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not c:IsOriginalSetCard(SET_FRIGHTFUR) end function s.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if ft>2 then ft=2 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.filter,tp,LOCATION_DECK,0,1,ft,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:
Special Summon 2 "Geargiano" monsters from your Deck and increase their Levels by 1. You can only activate 1 "Geargiagear" per turn.
--ギアギアギア --Geargiagear local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsSetCard(SET_GEARGIANO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,2,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp) if #g>=2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,2,2,nil) local tc=sg:GetFirst() Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1) tc:RegisterEffect(e1) tc=sg:GetNext() Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e2=e1:Clone() tc:RegisterEffect(e2) Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Queen's Knight" + "Jack's Knight" + "King's Knight" A Fusion Summon of this card can only be done with the above materials. Once per turn, when a Spell/Trap Card, or monster effect, is activated that targets this face-up card on the field (Quick Effect): You can discard the same type of card (Monster, Spell, or Trap); negate the effect.
--アルカナ ナイトジョーカー --Arcana Knight Joker local s,id=GetID() function s.initial_effect(c) --Fusion Material c:EnableReviveLimit() Fusion.AddProcMix(c,false,false,CARD_QUEEN_KNIGHT,CARD_JACK_KNIGHT,CARD_KING_KNIGHT) --Negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.discon) e1:SetCost(s.discost) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and tg and tg:IsContains(c) and Duel.IsChainDisablable(ev) end function s.filter(c,tpe) return c:IsType(tpe) and c:IsDiscardable() end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) local rtype=(re:GetActiveType()&(TYPE_MONSTER|TYPE_SPELL|TYPE_TRAP)) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,rtype) end Duel.DiscardHand(tp,s.filter,1,1,REASON_COST|REASON_DISCARD,nil,rtype) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp,chk) Duel.NegateEffect(ev) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Dracotail" monster from your Deck to your hand, then if your opponent controls a monster, you can Fusion Summon 1 Dragon or Spellcaster monster from your Extra Deck, using monsters from your hand or field. You can only activate 1 "Ketu Dracotail" per turn.
--計都星辰 --Ketu Dracotail --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Add 1 "Dragontail" monster from your Deck to your hand, then, if your opponent controls a monster, you can Fusion Summon 1 Dragon or Spellcaster monster from your Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={SET_DRACOTAIL} function s.thfilter(c) return c:IsSetCard(SET_DRACOTAIL) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) 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 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) Duel.ShuffleDeck(tp) if Duel.GetMatchingGroupCount(nil,tp,0,LOCATION_MZONE,nil)>0 then local params={fusfilter=aux.FilterBoolFunction(Card.IsRace,RACE_DRAGON|RACE_SPELLCASTER)} if Fusion.SummonEffTG(params)(e,tp,eg,ep,ev,re,r,rp,0) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Fusion.SummonEffOP(params)(e,tp,eg,ep,ev,re,r,rp) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
4 Level 9 monsters Must be Special Summoned with a "Rank-Up-Magic" Spell targeting "Number 88: Gimmick Puppet of Leo". Neither player can target this card on the field with card effects. Once per turn: You can detach 1 material from this card; inflict 1000 damage to your opponent. During your End Phase, if your opponent's LP are 2000 or less, and this card has no materials, you win the Duel.
--CNo.88 ギミック・パペット-ディザスター・レオ --Number C88: Gimmick Puppet Disaster Leo local s,id=GetID() function s.initial_effect(c) --xyz summon c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --prevent target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetValue(1) c:RegisterEffect(e2) --damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCost(Cost.DetachFromSelf(1)) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) --win local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetCountLimit(1) e4:SetCondition(s.wincon) e4:SetOperation(s.winop) c:RegisterEffect(e4) end s.listed_series={SET_RANK_UP_MAGIC} s.listed_names={48995978} s.xyz_number=88 s.rum_limit=function(c,e) return c:IsCode(48995978) end s.rum_xyzsummon=function(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetDescription(1073) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetRange(c:GetLocation()) e1:SetCondition(Xyz.Condition(nil,9,4,4,false)) e1:SetTarget(Xyz.Target(nil,9,4,4,false)) e1:SetOperation(Xyz.Operation(nil,9,4,4,false)) e1:SetValue(SUMMON_TYPE_XYZ) e1:SetReset(RESET_CHAIN) c:RegisterEffect(e1) return e1 end --target check is in RUM magic cards function s.splimit(e,se,sp,st) return se:GetHandler():IsSetCard(SET_RANK_UP_MAGIC) and se:GetHandler():IsSpell() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.wincon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and Duel.GetLP(1-tp)<=2000 and e:GetHandler():GetOverlayCount()==0 end function s.winop(e,tp,eg,ep,ev,re,r,rp) Duel.Win(tp,WIN_REASON_DISASTER_LEO) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters from your hand, Deck, or field as Fusion Material, including a "Red-Eyes" monster that it lists as material, and if you do, its name becomes "Red-Eyes Black Dragon". You cannot Normal or Special Summon other monsters the turn you activate this card. You can only activate 1 "Red-Eyes Fusion" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--真紅眼融合 --Red-Eyes Fusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff({handler=c,fusfilter=aux.FilterBoolFunction(Card.ListsArchetypeAsMaterial,SET_RED_EYES), extrafil=s.fextra,stage2=s.stage2,extratg=s.extratg}) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) c:RegisterEffect(e1) end s.listed_names={CARD_REDEYES_B_DRAGON} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SUMMON)==0 and Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetDescription(aux.Stringid(id,1)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetLabelObject(e) e2:SetTarget(s.splimit) Duel.RegisterEffect(e2,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return se~=e:GetLabelObject() end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,0,tp,LOCATION_DECK) end function s.fextra(e,tp,mg,sumtype) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToGrave),tp,LOCATION_DECK,0,nil),s.fcheck end function s.stage2(e,tc,tp,mg,chk) if chk==1 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(CARD_REDEYES_B_DRAGON) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.fcheck(tp,sg,fc,sumtype,tp) return sg:IsExists(s.ffilter,1,nil,fc,sumtype,tp) end function s.ffilter(c,fc,sumtype,tp) return c:IsSetCard(SET_RED_EYES,fc,sumtype,tp) and (not fc.material or c:IsSummonCode(fc,sumtype,tp,fc.material)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The equipped monster gains 300 ATK for each monster your opponent controls. If it would be destroyed by battle, you can destroy this card instead.
--ファイティング・スピリッツ --Fighting Spirit local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(s.value) c:RegisterEffect(e2) --desrep local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.value(e,c) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),0,LOCATION_MZONE)*300 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local tg=c:GetEquipTarget() if chk==0 then return c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED) and tg and tg:IsReason(REASON_BATTLE) end return Duel.SelectEffectYesNo(tp,c,96) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The first time this card would be destroyed by battle each turn, it is not destroyed. You can only use each of the following effects of "Dream Shark" once per turn. If you control no monsters, or if all monsters you control are WATER: You can Special Summon this card from your hand. When a card or effect that would inflict damage to you is activated, while this card is in your GY (except during the Damage Step): You can Special Summon this card, and if you do, make that effect damage to you 0. If Summoned this way, it loses 1000 DEF, also banish it when it leaves the field.
--ドリーム・シャーク --Dream Shark --scripted by Naim local s,id=GetID() function s.initial_effect(c) --The first time it would be destroyed by battle, it is not local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetCountLimit(1) e1:SetValue(s.valcon) c:RegisterEffect(e1) --Special summon itself from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,{id,0}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Special summon itself from the GY if an effect would inflict damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,{id,1}) e4:SetCondition(aux.damcon1) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end s.listed_series={SET_HEROIC} function s.valcon(e,re,r,rp) return (r&REASON_BATTLE)~=0 end function s.cfilter(c) return c:IsFacedown() or not c:IsAttribute(ATTRIBUTE_WATER) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) 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.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_GRAVE) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then --Decrease DEF by 1000 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(-1000) c:RegisterEffect(e1,true) --Banish it if it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(3300) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetValue(LOCATION_REMOVED) e2:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e2,true) --Take no damage from the activated effect local cid=Duel.GetChainInfo(ev,CHAININFO_CHAIN_ID) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CHANGE_DAMAGE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetLabel(cid) e3:SetValue(s.damval) e3:SetReset(RESET_CHAIN) Duel.RegisterEffect(e3,tp) end Duel.SpecialSummonComplete() end function s.damval(e,re,val,r,rp,rc) local cc=Duel.GetCurrentChain() if cc==0 or (r&REASON_EFFECT)==0 then return val end local cid=Duel.GetChainInfo(0,CHAININFO_CHAIN_ID) if cid~=e:GetLabel() then return val end return 0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 8 or higher "Myutant" monsters When a card or effect is activated (Quick Effect): You can banish 1 "Myutant" card from your hand, GY, or face-up field, of the same type (Monster, Spell, or Trap); negate the activation, and if you do, banish that card. If this Fusion Summoned card you control is destroyed by an opponent's card: You can add up to 3 of your banished "Myutant" cards (up to 1 each of Monster, Spell, and Trap) to your hand. You can only use each effect of "Myutant Ultimus" once per turn.
--究極体ミュートリアス --Myutant Ultimus --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: 3 Level 8 or higher "Myutant" monsters Fusion.AddProcMixN(c,true,true,s.ffilter,3) --Negate the activation of card/effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.negcon) e1:SetCost(s.negcost) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) aux.DoubleSnareValidity(c,LOCATION_MZONE) --Add up to 3 of your banished "Myutant" cards 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:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_MYUTANT} function s.ffilter(c,fc,sumtype,tp) return c:IsLevelAbove(8) and c:IsSetCard(SET_MYUTANT,fc,sumtype,tp) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function s.cfilter(c,rtype) return c:IsSetCard(SET_MYUTANT) and (not c:IsOnField() or c:IsFaceup()) and c:IsType(rtype) and c:IsAbleToRemoveAsCost() end function s.negcost(e,tp,eg,ep,ev,re,r,rp,chk) local rtype=(re:GetActiveType()&(TYPE_MONSTER|TYPE_SPELL|TYPE_TRAP)) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,nil,rtype) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,1,nil,rtype) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) local rc=re:GetHandler() local relation=rc:IsRelateToEffect(re) if chk==0 then return rc:IsAbleToRemove(tp) or (not relation and Duel.IsPlayerCanRemove(tp)) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if relation then Duel.SetOperationInfo(0,CATEGORY_REMOVE,rc,1,rc:GetControler(),rc:GetLocation()) else Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,0,rc:GetPreviousLocation()) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Remove(eg,POS_FACEUP,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsFusionSummoned() and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MYUTANT) and c:IsAbleToHand() end function s.ctcheck(sg,e,tp) return sg:GetClassCount(Card.GetMainCardType)==#sg end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_REMOVED) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_REMOVED,0,nil) if #g==0 then return end local sg=aux.SelectUnselectGroup(g,e,tp,1,3,s.ctcheck,1,tp,HINTMSG_ATOHAND) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 "Destiny HERO - Plasma" from your Deck or GY to your hand. While you control "Destiny HERO - Plasma", apply the following effects. ● You cannot draw during the Draw Phase. ● Your opponent cannot target cards you control with card effects. ● Each "Destiny HERO - Plasma" you control gains 100 ATK for each monster in the GYs, cannot be destroyed by your opponent's card effects, also can make a second attack during each Battle Phase.
--D-フォース --D - Force --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) e0:SetTarget(s.target) e0:SetOperation(s.activate) c:RegisterEffect(e0) --Cannot draw local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_DRAW) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(1,0) e1:SetCondition(aux.AND(s.plasmacon,s.drawcon)) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_DRAW_COUNT) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(1,0) e2:SetCondition(s.plasmacon) e2:SetValue(0) c:RegisterEffect(e2) --Your cards cannot be targeted local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetTargetRange(LOCATION_ONFIELD,0) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e3:SetRange(LOCATION_SZONE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetCondition(s.plasmacon) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) --ATK up,effect indestructible,and double attack local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetCondition(s.plasmacon) e4:SetTarget(aux.TargetBoolFunction(Card.IsCode,83965310)) e4:SetValue(s.val) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e5:SetValue(aux.indoval) c:RegisterEffect(e5) local e6=e4:Clone() e6:SetCode(EFFECT_EXTRA_ATTACK) e6:SetValue(1) c:RegisterEffect(e6) end s.listed_names={83965310} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.thfilter(c) return c:IsCode(83965310) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.plasmacon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,83965310),e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) end function s.drawcon(e) return Duel.IsPhase(PHASE_DRAW) end function s.val(e,c) return Duel.GetMatchingGroupCount(Card.IsMonster,0,LOCATION_GRAVE,LOCATION_GRAVE,nil)*100 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 monster in your opponent's GY; Special Summon it to your opponent's field, but negate its effects, also equip it with this card. When this card leaves the field, destroy that monster. The equipped monster cannot attack or be targeted for an attack. If this card is sent to the GY because the equipped monster was used as material for a Fusion, Synchro, Xyz, or Link Summon: You can take control of that Summoned monster. You can only activate 1 "Two Toads with One Sting" per turn.
--一惜二跳 --Two Toads with One Sting --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_LEAVE_FIELD_P) e2:SetOperation(s.checkop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetOperation(s.desop) e3:SetLabelObject(e2) c:RegisterEffect(e3) --Limit attack local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_EQUIP) e4:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e5:SetValue(aux.imval1) c:RegisterEffect(e5) --Change control local e6=Effect.CreateEffect(c) e6:SetCategory(CATEGORY_CONTROL) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetProperty(EFFECT_FLAG_DELAY) e6:SetCode(EVENT_TO_GRAVE) e6:SetCondition(s.ctcon) e6:SetTarget(s.cttg) e6:SetOperation(s.ctop) c:RegisterEffect(e6) end function s.spfilter(c,e,tp) return 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(1-tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,0,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,1-tp,false,false,POS_FACEUP) then Duel.Equip(tp,c,tc) --Add Equip limit local e0=Effect.CreateEffect(tc) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_EQUIP_LIMIT) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetReset(RESET_EVENT|RESETS_STANDARD) e0:SetValue(s.eqlimit) c:RegisterEffect(e0) 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=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) tc:RegisterEffect(e2) Duel.SpecialSummonComplete() end end function s.eqlimit(e,c) return e:GetOwner()==c end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() if c:IsReason(REASON_LOST_TARGET) and ec and ec:IsReason(REASON_SYNCHRO+REASON_FUSION+REASON_XYZ+REASON_LINK) then e:SetLabelObject(ec:GetReasonCard()) return true else return false end end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk) local tc=e:GetLabelObject() if chk==0 then return tc and tc:IsControler(1-tp) and tc:IsControlerCanBeChanged() end tc:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_CONTROL,tc,1,0,0) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc and tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be used as a substitute for any 1 Fusion Material whose name is specifically listed on the Fusion Monster Card, but the other Fusion Material(s) must be correct. Cannot be used as Fusion Material otherwise. If this card is Special Summoned (except during the Damage Step): You can Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Materials, including this card.
--パラサイト・フュージョナー --Fusion Parasite local s,id=GetID() function s.initial_effect(c) --fusion substitute local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_FUSION_SUBSTITUTE) e1:SetCondition(s.subcon) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(id) c:RegisterEffect(e2) --special summon local params = {nil,Fusion.OnFieldMat,nil,nil,Fusion.ForcedHandler} local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(s.spcon) e3:SetTarget(Fusion.SummonEffTG(table.unpack(params))) e3:SetOperation(Fusion.SummonEffOP(table.unpack(params))) c:RegisterEffect(e3) end function s.subcon(e) return e:GetHandler():IsLocation(LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate by discarding 1 card, then target up to 2 monsters in your GY; Special Summon them. When any of those monsters leaves the field, destroy this card. When this card leaves the field, destroy those monster(s). You can only activate 1 "Double Hooking" per turn.
--ダブル・フッキング --Double Hooking --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Destroy this card when any of the targeted monsters leave the field local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.selfdescon) e2:SetOperation(function(e) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end) c:RegisterEffect(e2) --Destroy the targeted monsters when this card leaves the field local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_LEAVE_FIELD_P) e3:SetOperation(s.checkop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCondition(function(e) return e:GetLabelObject():GetLabel()==0 end) e4:SetOperation(s.mondesop) e4:SetLabelObject(e3) c:RegisterEffect(e4) 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.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end ft=math.min(ft,2) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,ft,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if #tg==0 or ft==0 then return end if #tg>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if #tg>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) tg=tg:Select(tp,1,1,nil) end local c=e:GetHandler() for tc in tg:Iter() do if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then c:SetCardTarget(tc) end end Duel.SpecialSummonComplete() end function s.selfdescon(e,tp,eg,ep,ev,re,r,rp) local tg=e:GetHandler():GetCardTarget() return tg and #tg>0 and #(eg&tg)>0 end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.mondesop(e,tp,eg,ep,ev,re,r,rp) local tg=e:GetHandler():GetCardTarget():Match(Card.IsLocation,nil,LOCATION_MZONE) if not tg or #tg==0 then return end Duel.Destroy(tg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card inflicts battle damage to your opponent: You can discard 1 card.
--暗黒界の狂王 ブロン --Brron, Mad King of Dark World local s,id=GetID() function s.initial_effect(c) --discard local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If you have 2 cards in your Pendulum Zones: You can Special Summon this card, then you can apply this effect. ● Shuffle 1 card from your Pendulum Zone into the Deck, then if it was added to your Extra Deck, you can Special Summon it, ignoring its Summoning conditions. You can only use this effect of "Odd-Eyes Arcray Dragon" once per turn. ---------------------------------------- [ Monster Effect ] 4 Dragon monsters (1 Fusion, 1 Synchro, 1 Xyz, and 1 Pendulum) (This card is always treated as "Supreme King Z-ARC".) This face-down card in the Extra Deck must first be either Fusion Summoned, or Special Summoned by Tributing 1 Level 12 DARK "Supreme King Z-ARC". If this card is Special Summoned from the Extra Deck: You can place 1 Pendulum Monster from your Deck in your Pendulum Zone. If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone.
--覇王天龍オッドアイズ・アークレイ・ドラゴン --Odd-Eyes Arcray Dragon --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c,false) c:EnableReviveLimit() --4 Dragon monsters (1 Fusion, 1 Synchro, 1 Xyz, and 1 Pendulum) Fusion.AddProcMix(c,true,true,s.matfilter(TYPE_FUSION),s.matfilter(TYPE_SYNCHRO),s.matfilter(TYPE_XYZ),s.matfilter(TYPE_PENDULUM)) --Must be either Fusion Summoned or Special Summoned by alternate procedure local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(s.splimit) c:RegisterEffect(e0) --Alternate Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_EXTRA) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Place 1 Pendulum Monster in the Pendulum Zone local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(function(e) return e:GetHandler():IsSummonLocation(LOCATION_EXTRA) end) e3:SetTarget(s.pltg) e3:SetOperation(s.plop) c:RegisterEffect(e3) --Place itself into pendulum zone local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(s.pencon) e4:SetTarget(s.pentg) e4:SetOperation(s.penop) c:RegisterEffect(e4) end s.listed_names={CARD_ZARC} s.miracle_synchro_fusion=true function s.matfilter(typ) return function(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(typ,fc,sumtype,tp) end end function s.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or aux.fuslimit(e,se,sp,st) or aux.penlimit(e,se,sp,st) end function s.hspfilter(c,tp,sc) return c:IsCode(CARD_ZARC) and c:IsLevel(12) and c:IsAttribute(ATTRIBUTE_DARK) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 end function s.hspcon(e,c) if not c then return true end if c:IsFaceup() then return false end local tp=c:GetControler() return Duel.CheckReleaseGroup(tp,s.hspfilter,1,false,1,true,c,tp,nil,nil,nil,tp,c) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local g=Duel.SelectReleaseGroup(tp,s.hspfilter,1,1,false,true,true,c,tp,nil,false,nil,tp,c) if not g then return false end g:KeepAlive() e:SetLabelObject(g) return true end function s.hspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST|REASON_MATERIAL) g:DeleteGroup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldCard(tp,LOCATION_PZONE,0) and Duel.GetFieldCard(tp,LOCATION_PZONE,1) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_PZONE) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_PZONE,0,nil) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,3)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sc=g:Select(tp,1,1,nil):GetFirst() if not sc then return end Duel.BreakEffect() if Duel.SendtoDeck(sc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_EXTRA) and sc:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,nil,sc)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,4)) then Duel.BreakEffect() Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP) end end function s.plfilter(c) return c:IsType(TYPE_PENDULUM) and not c:IsForbidden() end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil) end end function s.plop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return false end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsFaceup() and c:IsPreviousLocation(LOCATION_MZONE) end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return false end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 DARK Dragon monsters Neither player can target this Xyz Summoned card with monster effects, except its own. Once per turn: You can detach 1 material from this card, then target 1 face-up monster on the field; it loses 600 ATK/DEF, then, you can Special Summon 1 "Borrel" monster from your GY, but banish it during the End Phase, also you cannot Special Summon other monsters or attack directly for the rest of this turn.
--ヴァレルロード・X・ドラゴン --Borreload eXcharge Dragon --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,s.mfilter,4,2) --Cannot be targeted by monsters effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.tgcon) e1:SetValue(s.tgval) c:RegisterEffect(e1) --Decrease ATK/DEF and special summon 1 "Borrel" monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_BORREL} function s.mfilter(c,lc,sumtype,tp) return c:IsRace(RACE_DRAGON,lc,sumtype,tp) and c:IsAttribute(ATTRIBUTE_DARK,lc,sumtype,tp) end function s.tgcon(e) return e:GetHandler():IsXyzSummoned() end function s.tgval(e,re,rp) local rc=re:GetHandler() return re:IsMonsterEffect() and e:GetHandler()~=rc end function s.atkfilter(c) return c:IsFaceup() and (c:GetAttack()>0 or c:GetDefense()>0) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BORREL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsImmuneToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-600) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp) if #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=g:Select(tp,1,1,nil):GetFirst() if Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)~=0 then sc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetLabelObject(sc) e3:SetCondition(s.rmcon) e3:SetOperation(s.rmop) Duel.RegisterEffect(e3,tp) end end end local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD) ge1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) ge1:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_PLAYER_TARGET) ge1:SetTargetRange(1,0) ge1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(ge1,tp) local ge2=Effect.CreateEffect(c) ge2:SetType(EFFECT_TYPE_FIELD) ge2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) ge2:SetProperty(EFFECT_FLAG_OATH+EFFECT_FLAG_IGNORE_IMMUNE) ge2:SetTargetRange(LOCATION_MZONE,0) ge2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(ge2,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffect(id)~=0 then return true else e:Reset() return false end end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned, you can add 1 Level 1 "Genex" monster from your Deck to your hand.
--レアル・ジェネクス・ターボ --R-Genex Turbo 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_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:GetLevel()==1 and c:IsSetCard(SET_GENEX) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell Card, Trap Card, or monster effect is activated: Tribute all "Mecha Phantom Beast Tokens" you control; negate the activation, and if you do, destroy it.
--弾幕回避 --Do a Barrel Roll local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={TOKEN_MECHA_PHANTOM_BEAST} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsChainNegatable(ev) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) end function s.filter(c) return c:IsReleasable() and not c:IsStatus(STATUS_BATTLE_DESTROYED) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsCode,tp,LOCATION_MZONE,0,nil,TOKEN_MECHA_PHANTOM_BEAST) if chk==0 then return #g>0 and g:FilterCount(s.filter,nil)==#g end Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card must attack if able. When this face-up card is selected as an attack target, change its battle position. When this card destroys an opponent's monster by battle and sends it to the Graveyard, select 1 Level 4 or lower "Karakuri" monster in your Graveyard, and Special Summon it in face-up Defense Position.
--カラクリ忍者 九壱九 --Karakuri Ninja mdl 919 "Kuick" local s,id=GetID() function s.initial_effect(c) --must attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MUST_ATTACK) c:RegisterEffect(e1) --pos change local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_BE_BATTLE_TARGET) e3:SetOperation(s.posop) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_BATTLE_DESTROYED) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return #eg==1 and tc:GetReasonCard()==e:GetHandler() and tc:IsLocation(LOCATION_GRAVE) and tc:IsReason(REASON_BATTLE) end function s.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsSetCard(SET_KARAKURI) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return true 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 and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Fusion, Synchro, Xyz, or Link Monster on the field; return that face-up monster to the Extra Deck, then, based on its card type, you can Special Summon 1 appropriate monster from either GY to your field. ● Fusion: Monster with the same Attribute. ● Synchro: Monster with a lower Level. ● Xyz: Monster with the same Level as its Rank. ● Link: Monster with the same Type. You can only activate 1 "Starry Dragon's Cycle" per turn.
--星宵竜転 --Starry Dragon's Cycle --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Return 1 monster to the Extra Deck and Special Summon 1 appropriate monster from either GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.texfilter(c) return c:IsFaceup() and c:IsType(TYPE_EXTRA) and c:IsAbleToExtra() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.texfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.texfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local g=Duel.SelectTarget(tp,s.texfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,g,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spfilter(c,e,tp,card_type,attr,lvl,rnk,race) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ((card_type&TYPE_FUSION>0 and c:IsAttribute(attr)) or (card_type&TYPE_SYNCHRO>0 and c:HasLevel() and c:GetLevel()<lvl) or (card_type&TYPE_XYZ>0 and c:HasLevel() and c:IsLevel(rnk)) or (card_type&TYPE_LINK>0 and c:IsRace(race))) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp,tc:GetType(),tc:GetAttribute(),tc:GetLevel(),tc:GetRank(),tc:GetRace()) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] While you control an "Amorphage" monster, neither player takes any effect damage. Once per turn, during your Standby Phase, Tribute 1 monster or destroy this card. ---------------------------------------- [ Monster Effect ] If this card is Pendulum Summoned or flipped face-up, neither player can Special Summon monsters from the Extra Deck while this card is face-up on the field, except "Amorphage" monsters.
--アモルファージ・ヒュペル --Amorphage Pride local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --flip local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_FLIP) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetOperation(s.flipop) c:RegisterEffect(e1) --maintenance cost local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.descon) e2:SetOperation(s.desop) c:RegisterEffect(e2) --special summon limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,1) e3:SetTarget(s.sumlimit) c:RegisterEffect(e3) --no effect damage local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CHANGE_DAMAGE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetRange(LOCATION_PZONE) e4:SetTargetRange(1,1) e4:SetCondition(s.damcon) e4:SetValue(s.damval) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_NO_EFFECT_DAMAGE) c:RegisterEffect(e5) --Lizard check aux.addContinuousLizardCheck(c,LOCATION_MZONE,s.lizfilter,0xff,0xff) end s.listed_series={SET_AMORPHAGE} function s.flipop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.HintSelection(Group.FromCards(c),true) if Duel.CheckReleaseGroup(tp,Card.IsReleasableByEffect,1,c) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then local g=Duel.SelectReleaseGroup(tp,Card.IsReleasableByEffect,1,1,c) Duel.Release(g,REASON_COST) else Duel.Destroy(c,REASON_COST) end end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLocation(LOCATION_EXTRA) and not c:IsSetCard(SET_AMORPHAGE) and (e:GetHandler():IsPendulumSummoned() or e:GetHandler():GetFlagEffect(id)~=0) end function s.damcon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_AMORPHAGE),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.damval(e,re,val,r,rp,rc) if (r&REASON_EFFECT)~=0 then return 0 end return val end function s.lizfilter(e,c) return not c:IsOriginalSetCard(SET_AMORPHAGE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 monsters If a monster(s) is Tributed (except during the Damage Step): You can detach 1 material from this card, then target 1 monster in either GY; Special Summon it, but negate its effects, also it becomes a Plant monster. If a Plant monster(s) you control would be destroyed by a card effect, you can Tribute 1 Plant monster from your hand or field instead. You can only use each effect of "Kanzashi the Rikka Queen" once per turn.
--六花聖カンザシ --Kanzashi the Rikka Queen --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,nil,6,2) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_RELEASE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end function s.spconfilter(c) return c:IsMonster() or c:GetPreviousTypeOnField()&TYPE_MONSTER==TYPE_MONSTER end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) tc:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_CHANGE_RACE) e3:SetValue(RACE_PLANT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) tc:RegisterEffect(e3) Duel.SpecialSummonComplete() end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsRace(RACE_PLANT) and c:IsReason(REASON_EFFECT) end function s.cfilter(c,e,tp) return c:IsRace(RACE_PLANT) and c:IsControler(tp) and c:IsReleasableByEffect(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED+STATUS_BATTLE_DESTROYED) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=eg:FilterCount(s.repfilter,nil,tp) if chk==0 then return ct>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,e,tp) and Duel.GetFlagEffect(tp,id)==0 end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local tg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,1,1,nil,e,tp) Duel.SetTargetCard(tg) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) return true else return false end 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.Hint(HINT_CARD,1-tp,id) local tc=Duel.GetFirstTarget() Duel.Release(tc,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This face-up card on the field is returned to the owner's hand during the End Phase of your turn.
--邪悪なるワーム・ビースト --The Wicked Worm Beast local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCategory(CATEGORY_TOHAND) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.retcon) e1:SetTarget(s.rettg) e1:SetOperation(s.retop) c:RegisterEffect(e1) end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function s.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If the only monster you control is 1 Level 5 monster: Tribute that monster; Special Summon 5 monsters (1 "Kuribah", 1 "Kuribee", 1 "Kuriboo", 1 "Kuribeh", and 1 "Kuriboh") from your hand, Deck, and/or GY, but they cannot be Tributed for a Tribute Summon. You can only activate 1 "Five Star Twilight" per turn.
--ティンクル・ファイブスター --Five Star Twilight --OCG/TCG converted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={44632120,71036835,7021574,34419588,CARD_KURIBOH} function s.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) return #g==1 and g:GetFirst():IsLevel(5) and g:GetFirst():IsFaceup() end function s.cfilter(c,ft,tp) return c:IsLevel(5) and (ft>=5 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup()) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>=4 and Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,ft,tp) end local rg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,ft,tp) Duel.Release(rg,REASON_COST) end function s.filter(c,e,tp,code) return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local locs=LOCATION_DECK|LOCATION_HAND|LOCATION_GRAVE if chk==0 then if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<5 then return false end e:SetLabel(0) return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.filter,tp,locs,0,1,nil,e,tp,44632120) and Duel.IsExistingMatchingCard(s.filter,tp,locs,0,1,nil,e,tp,71036835) and Duel.IsExistingMatchingCard(s.filter,tp,locs,0,1,nil,e,tp,7021574) and Duel.IsExistingMatchingCard(s.filter,tp,locs,0,1,nil,e,tp,34419588) and Duel.IsExistingMatchingCard(s.filter,tp,locs,0,1,nil,e,tp,CARD_KURIBOH) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,5,tp,locs) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local locs=LOCATION_DECK|LOCATION_HAND|LOCATION_GRAVE if Duel.GetLocationCount(tp,LOCATION_MZONE)<5 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end local g1=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,locs,0,nil,e,tp,44632120) local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,locs,0,nil,e,tp,71036835) local g3=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,locs,0,nil,e,tp,7021574) local g4=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,locs,0,nil,e,tp,34419588) local g5=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,locs,0,nil,e,tp,CARD_KURIBOH) if #g1>0 and #g2>0 and #g3>0 and #g4>0 and #g5>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg1=g1:Select(tp,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg2=g2:Select(tp,1,1,nil) sg1:Merge(sg2) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg3=g3:Select(tp,1,1,nil) sg1:Merge(sg3) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg4=g4:Select(tp,1,1,nil) sg1:Merge(sg4) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg5=g5:Select(tp,1,1,nil) sg1:Merge(sg5) for tc in aux.Next(sg1) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1) tc:RegisterEffect(e1,true) end Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you draw this card: You can reveal it; Special Summon it from your hand. If this card is Special Summoned from the hand: You can target 1 monster you control; send it to the GY, and if you do, Special Summon 1 Level 1 Spellcaster monster from your Deck. You can only use each effect of "Fortune Fairy Hikari" once per turn.
--占い魔女 ヒカリちゃん --Fortune Fairy Hikari --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DRAW) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Send to the graveyard and special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.tgcon) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsPublic() 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,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.tgcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function s.tgfilter(c,tp) return c:IsAbleToGrave() and Duel.GetMZoneCount(tp,c)>0 end function s.spfilter(c,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsLevel(1) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the Graveyard, you can add 1 "Iron Core of Koa'ki Meiru" or 1 Level 4 or lower "Koa'ki Meiru" monster from your Deck to your hand.
--コアキメイル・ロック --Koa'ki Meiru Boulder 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_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={36623431} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return (c:IsCode(36623431) or (c:IsLevelBelow(4) and c:IsSetCard(SET_KOAKI_MEIRU))) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is not equipped with an Equip Card, you take no damage from battles involving this card. If this card is equipped with an Equip Card, it cannot be destroyed by battle and your opponent takes any battle damage you would have taken from battles involving this card. While you control an Equip Card, your opponent cannot target "Mikanko" cards you control with card effects. If either player equips an Equip Card(s) to this card: You can add 1 "Mikanko" Trap from your Deck to your hand. You can only use this effect of "Hu-Li the Jewel Mikanko" once per turn.
--珠の御巫 フゥリ --Hu-Li the Jewel Mikanko --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Take no battle damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetCondition(aux.NOT(s.eqcon)) e1:SetValue(1) c:RegisterEffect(e1) --Cannot be destroyed by battle local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetCondition(s.eqcon) c:RegisterEffect(e2) --Reflect battle damage local e3=e2:Clone() e3:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE) c:RegisterEffect(e3) --Opponent cannot target "Mikanko" cards local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e4:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(LOCATION_ONFIELD,0) e4:SetCondition(s.immcon) e4:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_MIKANKO)) e4:SetValue(aux.tgoval) c:RegisterEffect(e4) --Search 1 "Mikanko" Trap local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetCode(EVENT_EQUIP) e5:SetCountLimit(1,id) e5:SetTarget(s.thtg) e5:SetOperation(s.thop) c:RegisterEffect(e5) end s.listed_series={SET_MIKANKO} function s.eqcon(e) return e:GetHandler():GetEquipCount()>0 end function s.immcon(e) return Duel.IsExistingMatchingCard(Card.IsType,e:GetHandlerPlayer(),LOCATION_STZONE,0,1,nil,TYPE_EQUIP) end function s.thfilter(c) return c:IsSetCard(SET_MIKANKO) and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 "Number C39" monster you control; equip this monster from your hand or your side of the field to that target. The equipped monster cannot be destroyed by battle. At the end of the Damage Step, when the equipped monster attacks an opponent's monster, but the opponent's monster was not destroyed by the battle: You can make the opponent's monster's ATK 0 (even after this card leaves the field or the monster becomes unaffected by card effects), and if you do, the equipped monster can make a second attack on the same monster in a row.
--DZW-魔装鵺妖衣 --DZW - Chimera Clad local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddZWEquipLimit(c,nil,function(tc,c,tp) return s.filter(tc) and tc:IsControler(tp) end,aux.EquipAndLimitRegister,e1) --destroy sub local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) 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_DAMAGE_STEP_END) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_NUMBER_C39} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_NUMBER_C39) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not tc:IsRelateToEffect(e) or tc:IsFacedown() or tc:GetControler()~=tp or not c:CheckUniqueOnField(tp) then Duel.SendtoGrave(c,REASON_EFFECT) return end aux.EquipAndLimitRegister(c,e,tp,tc) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local at=Duel.GetAttackTarget() return at and a==e:GetHandler():GetEquipTarget() and at:IsRelateToBattle() and at:GetAttack()>0 and a:CanChainAttack() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttackTarget() local c=e:GetHandler() local ec=c:GetEquipTarget() if at:IsRelateToBattle() and not at:IsImmuneToEffect(e) and at:GetAttack()>0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) at:RegisterEffect(e1) Duel.ChainAttack(at) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Inflict 400 damage to your opponent each time you activate a Normal Spell Card.
--連弾の魔術師 --Rapid-Fire Magician local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if re:GetActiveType()==TYPE_SPELL and re:IsHasType(EFFECT_TYPE_ACTIVATE) and rp==tp then Duel.Damage(1-tp,400,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If at least 5 of your monsters are banished: Target 3 of them; return them to the GY.
--奇跡の発掘 --Miracle Dig local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsMonster() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_REMOVED,0,5,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,3,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=tg:Filter(Card.IsRelateToEffect,nil,e) if #sg>0 then Duel.SendtoGrave(sg,REASON_EFFECT|REASON_RETURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay half your LP, then target 1 Normal Trap in your opponent's GY, except "Transaction Rollback"; this effect becomes that card's activation effect. You can banish this card from your GY and pay half your LP, then target 1 Normal Trap in your GY, except "Transaction Rollback"; this effect becomes that card's activation effect. You can only use 1 "Transaction Rollback" effect per turn, and only once that turn.
--トランザクション・ロールバック --Transaction Rollback local s,id=GetID() function s.initial_effect(c) --Copy the activation effect of a Normal Trap from your opponent's GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DRAW_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Copy the activation effect of a Normal Trap from your GY local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_GRAVE) e2:SetCost(s.gycost) e2:SetTarget(s.gytg) c:RegisterEffect(e2) end s.listed_names={id} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.PayLPCost(tp,Duel.GetLP(tp)//2) end function s.tgfilter(c) return c:IsNormalTrap() and not c:IsCode(id) and c:CheckActivateEffect(false,true,false)~=nil end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local te=e:GetLabelObject() local tg=te:GetTarget() return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,0,LOCATION_GRAVE,1,nil) end e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.tgfilter,tp,0,LOCATION_GRAVE,1,1,nil) local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true) Duel.ClearTargetCard() g:GetFirst():CreateEffectRelation(e) local tg=te:GetTarget() e:SetProperty(te:GetProperty()) if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end te:SetLabelObject(e:GetLabelObject()) e:SetLabelObject(te) Duel.ClearOperationInfo(0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() if not te or not te:GetHandler():IsRelateToEffect(e) then return end e:SetLabelObject(te:GetLabelObject()) local op=te:GetOperation() if op then op(e,tp,eg,ep,ev,re,r,rp) end end function s.gycost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() end Duel.PayLPCost(tp,Duel.GetLP(tp)//2) Duel.Remove(c,POS_FACEUP,REASON_COST) end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local te=e:GetLabelObject() local tg=te:GetTarget() return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_GRAVE,0,1,c) end e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_GRAVE,0,1,1,c) local te,ceg,cep,cev,cre,cr,crp=g:GetFirst():CheckActivateEffect(false,true,true) Duel.ClearTargetCard() g:GetFirst():CreateEffectRelation(e) local tg=te:GetTarget() e:SetProperty(te:GetProperty()) if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end te:SetLabelObject(e:GetLabelObject()) e:SetLabelObject(te) Duel.ClearOperationInfo(0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent from the field to the Graveyard: You can send 1 LIGHT monster from your Deck to the Graveyard. If this card is sent from your Deck to the Graveyard: Target 1 LIGHT monster in your Graveyard; place that target on the top of your Deck. You can only use 1 "Dawn Knight" effect per turn, and only once that turn.
--曙光の騎士 --Dawn Knight local s,id=GetID() function s.initial_effect(c) --to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --to deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetCondition(s.tdcon) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.tgfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) end function s.tdfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, when this card inflicts battle damage to your opponent: You can Set 1 "Fire Formation" Spell directly from your Deck. Once per turn: You can send 1 face-up "Fire Formation" Spell/Trap you control to the GY, then target 1 monster on the field; destroy that target.
--暗炎星-ユウシ --Brotherhood of the Fire Fist - Bear local s,id=GetID() function s.initial_effect(c) --set local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCountLimit(1) e1:SetCondition(s.setcon) e1:SetTarget(s.settg) e1:SetOperation(s.setop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_FIRE_FORMATION} function s.setcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.filter(c) return c:IsSetCard(SET_FIRE_FORMATION) and c:IsSpell() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SSet(tp,g:GetFirst()) end end function s.filter1(c) return c:IsFaceup() and c:IsSetCard(SET_FIRE_FORMATION) and c:IsSpellTrap() and c:IsAbleToGraveAsCost() and Duel.IsExistingTarget(aux.TRUE,0,LOCATION_MZONE,LOCATION_MZONE,1,c) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) end local nc=Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_ONFIELD,0,1,nil) if chk==0 then if Duel.IsPlayerAffectedByEffect(tp,CARD_FIRE_FIST_EAGLE) then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) else return nc end end if nc and not (Duel.IsPlayerAffectedByEffect(tp,CARD_FIRE_FIST_EAGLE) and Duel.SelectYesNo(tp,aux.Stringid(CARD_FIRE_FIST_EAGLE,0))) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g1=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g1,REASON_COST) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g2,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can equip 1 Level 4 LIGHT Machine monster from your hand or GY 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.
--Y-ドラゴン・イアヘッド --Y-Yare Head --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() 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_HAND|LOCATION_GRAVE,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) 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,aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_HAND|LOCATION_GRAVE,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:
If you control 6 "Six Samurai" monsters with different Attributes: Skip your opponent's next turn.
--忍の六武 --The Six Shinobi --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Skip the opponent's next turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SIX_SAMURAI} function s.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_SIX_SAMURAI),tp,LOCATION_MZONE,0,nil) return g:GetClassCount(Card.GetAttribute)==6 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(1-tp,EFFECT_SKIP_TURN) end end function s.activate(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_SKIP_TURN) e1:SetTargetRange(0,1) e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN,Duel.IsTurnPlayer(tp) and 1 or 2) 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 an "Amazement" monster(s) you control: Target 1 of those "Amazement" monsters you control; return it to the hand, then, you can Special Summon 1 "Amazement" monster from your hand.
--アメイズメント・スペシャルショー --Amazement Special Show --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Return 1 of your targeted "Amazement" monsters to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_series={SET_AMAZEMENT} function s.thfilter(c,tp,e) return c:IsFaceup() and c:IsSetCard(SET_AMAZEMENT) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and (not e or c:IsCanBeEffectTarget(e)) and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) if rp==tp or 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.thfilter,1,nil,tp,e) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if chkc then return eg:IsContains(chkc) and s.thfilter(chkc,tp,e) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local sg=g:FilterSelect(tp,s.thfilter,1,1,nil,tp,e) Duel.SetTargetCard(sg) Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,1,0,0) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_AMAZEMENT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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 local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 7 monsters If you activate any of this card's effects, your opponent takes no further damage this turn. Once per turn: You can target 1 monster your opponent controls; equip that target to this card as an Equip Spell Card whose effect makes this monster gain 1000 ATK. If this card has "Number 6: Chronomaly Atlandis" as an Xyz Material, it gains this effect. ● You can detach 3 Xyz Materials from this card and send all "Number" monsters equipped by this card's effect to the Graveyard (min. 1); make your opponent's Life Points 100.
--CNo.6 先史遺産カオス・アトランタル --Number C6: Chronomaly Chaos Atlandis local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 7 monsters Xyz.AddProcedure(c,nil,7,3) --Equip 1 monster your opponent controls to this card as an Equip Spell Card whose effect makes this monster gain 1000 ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,function(ec,_,tp) return ec:IsControler(1-tp) end,s.equipop,e1) --Make your opponent's Life Points 100 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCondition(function(e,tp) return Duel.GetLP(1-tp)~=100 and e:GetHandler():GetOverlayGroup():IsExists(Card.IsCode,1,nil,9161357) end) e2:SetCost(Cost.AND(Cost.DetachFromSelf(3),s.lpcost)) e2:SetOperation(s.lpop) c:RegisterEffect(e2) end s.listed_series={SET_NUMBER} s.xyz_number=6 s.listed_names={9161357} function s.nodamage(e,tp) if Duel.HasFlagEffect(tp,id) then return end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) --Your opponent takes no further damage this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetTargetRange(0,1) e1:SetValue(0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToChangeControler() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) end function s.equipop(c,e,tp,tc) if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end --Equipped monster gains 1000 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1000) tc:RegisterEffect(e1) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then s.equipop(c,e,tp,tc) end s.nodamage(e,tp) end function s.lpcostfilter(c) return c:HasFlagEffect(id) and c:IsSetCard(SET_NUMBER) and c:IsFaceup() and c:IsAbleToGraveAsCost() end function s.lpcost(e,tp,eg,ep,ev,re,r,rp,chk) local eqg=e:GetHandler():GetEquipGroup():Filter(s.lpcostfilter,nil) if chk==0 then return #eqg>0 end Duel.SendtoGrave(eqg,REASON_COST) end function s.lpop(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(1-tp,100) s.nodamage(e,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Buster Blader" from your Deck or GY to your hand.
--竜破壊の証 --Emblem of Dragon Destroyer local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_BUSTER_BLADER} function s.filter(c) return c:IsCode(CARD_BUSTER_BLADER) 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|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),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:
Fusion Summon 1 "Shaddoll" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. You can only activate 1 "El Shaddoll Fusion" per turn.
--神の写し身との接触 --El Shaddoll Fusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsSetCard,SET_SHADDOLL)) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) end s.listed_series={SET_SHADDOLL}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 Level 4 or lower monster you control; it can attack your opponent directly this turn. Send it to the Graveyard at the end of the Battle Phase.
--ウィルスメール --Infected Mail 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) --direct attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.atcon) e2:SetTarget(s.attg) e2:SetOperation(s.atop) c:RegisterEffect(e2) end function s.atcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.filter(c) return c:IsFaceup() and c:IsLevelBelow(4) and c:CanAttack() and not c:IsHasEffect(EFFECT_DIRECT_ATTACK) end function s.attg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCountLimit(1) e2:SetLabelObject(tc) e2:SetCondition(s.tgcon) e2:SetOperation(s.tgop) Duel.RegisterEffect(e2,tp) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffect(id)~=0 then return true else e:Reset() return false end end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.SendtoGrave(tc,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 Continuous Spell/Trap you control; send it to the GY, and if you do, halve the ATK of 2 face-up monsters on the field, until the end of this turn. If a card(s) your opponent controls is destroyed by battle or card effect: You can target 1 "Ancient Warriors" card in your GY, except "Ancient Warriors - Deceptive Jia Wen"; add it to your hand. You can only use each effect of "Ancient Warriors - Deceptive Jia Wen" once per turn.
--戦華の詭-賈文 --Ancient Warriors - Deceptive Jia Wen --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Send a card to the GY and decrease ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Add a target from the GY to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcond) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_ANCIENT_WARRIORS} function s.tgfilter(c) return c:IsFaceup() and c:IsType(TYPE_CONTINUOUS) and c:IsSpellTrap() and c:IsAbleToGrave() end function s.atkfilter(c) return c:IsFaceup() and c:GetAttack()>0 end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.tgfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,nil,2,0,0) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACK) local sg=Duel.SelectMatchingCard(tp,s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,2,2,nil) if #sg>0 then Duel.HintSelection(sg) for card in aux.Next(sg) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(card:GetAttack()//2) e1:SetReset(RESETS_STANDARD_PHASE_END) card:RegisterEffect(e1) end end end end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetPreviousControler()==1-tp and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.thcond(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.thfilter(c) return c:IsSetCard(SET_ANCIENT_WARRIORS) and c:IsAbleToHand() and not c:IsCode(id) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) 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:
If your opponent controls a monster and you control no monsters, you can Special Summon this card (from your hand). You can only Special Summon "Kaiser Sea Snake" once per turn this way. When Summoned this way: You can Special Summon 1 Level 8 Sea Serpent monster from your hand or GY, but its ATK/DEF become 0. If this card is Special Summoned, its Level becomes 4 and original ATK becomes 0.
--カイザー・シースネーク --Kaiser Sea Snake 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:SetValue(1) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.hspcon) 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_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --change level local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SPSUMMON_COST) e3:SetOperation(s.lvop) c:RegisterEffect(e3) end function s.hspcon(e,c) if c==nil then return true end return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0 and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.spfilter(c,e,tp) return c:IsRace(RACE_SEASERPENT) and c:GetLevel()==8 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE_FINAL) tc:RegisterEffect(e2,true) end Duel.SpecialSummonComplete() end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(4) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_BASE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(0) e2:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) c:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Destroy all "Amazoness" monsters you control, then, you can Special Summon Level 4 or lower "Amazoness" monsters from your GY in face-up Defense Position, up to the number of monsters destroyed by this effect.
--アマゾネス転生術 --Amazoness Shamanism local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_AMAZONESS} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_AMAZONESS),tp,LOCATION_MZONE,0,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsSetCard(SET_AMAZONESS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_AMAZONESS),tp,LOCATION_MZONE,0,nil) if #dg==0 then return end local ct=Duel.Destroy(dg,REASON_EFFECT) local ft=math.min(ct,Duel.GetLocationCount(tp,LOCATION_MZONE)) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,ft,nil) Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish 1 "Gimmick Puppet" monster from your GY; all monsters you currently control become that banished monster's Level, until the end of this turn (even if this card leaves the field). If a face-up "Gimmick Puppet" monster(s) you control is destroyed by battle or an opponent's card effect and sent to the GY: You can target 1 of your banished "Gimmick Puppet" monsters; Special Summon it. You can only use each effect of "Perform Puppet" once per turn.
--パフォーム・パペット --Perform Puppet 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) --level change local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCost(s.lvcost) e2:SetOperation(s.lvop) 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:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_GIMMICK_PUPPET} function s.rfilter(c,tp) local lv=c:GetLevel() return lv>0 and c:IsAbleToRemoveAsCost() and c:IsSetCard(SET_GIMMICK_PUPPET) and aux.SpElimFilter(c,true) and Duel.IsExistingMatchingCard(s.tfilter,tp,LOCATION_MZONE,0,1,c,lv) end function s.tfilter(c,clv) local lv=c:GetLevel() return lv>0 and lv~=clv and c:IsFaceup() end function s.lvcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.rfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) local lv=g:GetFirst():GetLevel() Duel.SetTargetParam(lv) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) local lv=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(lv) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.cfilter(c,tp) return c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY) and (c:IsReason(REASON_BATTLE) or c:GetReasonPlayer()==1-tp and c:IsReason(REASON_DESTROY)) and c:IsSetCard(SET_GIMMICK_PUPPET) and c:IsPreviousPosition(POS_FACEUP) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c,e,tp) return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and c:IsSetCard(SET_GIMMICK_PUPPET) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is destroyed by battle and sent to the GY: Target 1 "Elemental HERO" card and 1 "Polymerization" in your GY; add them to your hand.
--フレンドッグ --Wroughtweiler local s,id=GetID() function s.initial_effect(c) --Add 1 "Elemental HERO" card and 1 "Polymerization" from your GY to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(function(e) return e:GetHandler():IsLocation(LOCATION_GRAVE) end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_series={SET_ELEMENTAL_HERO} s.listed_names={CARD_POLYMERIZATION} function s.thfilter(c,e) return (c:IsSetCard(SET_ELEMENTAL_HERO) or c:IsCode(CARD_POLYMERIZATION)) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e) end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsSetCard,1,nil,SET_ELEMENTAL_HERO) and sg:IsExists(Card.IsCode,1,nil,CARD_POLYMERIZATION) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return true end local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_GRAVE,0,nil,e) local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_ATOHAND) if #tg>0 then Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TOHAND,tg,2,tp,0) end end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if tg and #tg>0 then Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent controls a face-up Xyz Monster, you can Special Summon this card (from your hand). If you do, this card's Level becomes 8.
--半月竜ラディウス --Radius, the Half-Moon Dragon local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_HAND) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetCondition(s.spcon) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,c:GetControler(),0,LOCATION_MZONE,1,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) --change base attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(8) e1:SetReset(RESET_EVENT|RESET_DISABLE|RESET_TURN_SET|RESET_TOGRAVE|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TOHAND|RESET_TODECK|RESET_LEAVE) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control an "Evil Eye" monster: Target 1 monster on the field, or up to 2 instead if "Evil Eye of Selene" is in your Spell & Trap Zone; return them to the hand. You can only activate 1 "Evil Eye Defeat" per turn.
--妬絶の呪眼 --Evil Eye Defeat local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_EVIL_EYE} s.listed_names={CARD_EVIL_EYE_SELENE} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_EVIL_EYE),tp,LOCATION_MZONE,0,1,nil) end function s.evilcond(c) return c:IsFaceup() and c:IsCode(CARD_EVIL_EYE_SELENE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local fc=Duel.IsExistingMatchingCard(s.evilcond,tp,LOCATION_SZONE,0,1,nil) local ct=1 if fc then ct=2 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 Fusion Monster in your Extra Deck and Special Summon, from your hand or Deck, 1 of the Fusion Materials whose name is specifically listed on that card. You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate this card. You can only activate 1 "Fusion Deployment" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--融合派兵 --Fusion Deployment --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end --Part of "Fusion" archetype s.listed_series={SET_FUSION} --Haven't summoned any non-fusions function s.counterfilter(c) return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsType(TYPE_FUSION) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end --Cannot Special Summon from the Extra Deck, except Fusion Monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) end --Can only special summon fusions from extra deck function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not c:IsOriginalType(TYPE_FUSION) end --Check for fusion monster with listed material function s.exfilter(c,e,tp) return c.material and c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp,c) end --Check if listed material can be special summoned function s.spfilter(c,e,tp,fc) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsCode(table.unpack(fc.material)) end --Activation legality 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.exfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end --Special summon listed material from hand or deck function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local cg=Duel.SelectMatchingCard(tp,s.exfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #cg==0 then return end Duel.ConfirmCards(1-tp,cg) 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,cg:GetFirst()) 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 4 monsters Unaffected by Trap effects while it has material. "Traptrix" monsters you control, except "Traptrix Rafflesia", cannot be destroyed by battle or card effects. Your opponent cannot target "Traptrix" monsters you control, except "Traptrix Rafflesia", with card effects. Once per turn (Quick Effect): You can detach 1 material from this card and send 1 "Hole" Normal Trap that meets its activation conditions from your Deck to the GY; this effect becomes that Trap Card's effect when that card is activated.
--フレシアの蟲惑魔 --Traptrix Rafflesia local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 4 monsters Xyz.AddProcedure(c,nil,4,2) --Unaffected by Trap effects while it has material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetCondition(function(e) return e:GetHandler():GetOverlayCount()>0 end) e1:SetValue(function(e,te) return te:IsTrapEffect() end) c:RegisterEffect(e1) --"Traptrix" monsters you control, except "Traptrix Rafflesia", cannot be destroyed by battle or card effects local e2a=Effect.CreateEffect(c) e2a:SetType(EFFECT_TYPE_FIELD) e2a:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2a:SetRange(LOCATION_MZONE) e2a:SetTargetRange(LOCATION_MZONE,0) e2a:SetTarget(function(e,c) return c:IsSetCard(SET_TRAPTRIX) and not c:IsCode(id) end) e2a:SetValue(1) c:RegisterEffect(e2a) local e2b=e2a:Clone() e2b:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2b) --Your opponent cannot target "Traptrix" monsters you control, except "Traptrix Rafflesia", with card effects local e2c=e2a:Clone() e2c:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2c:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2c:SetValue(aux.tgoval) c:RegisterEffect(e2c) --This effect becomes that sent "Hole" Normal Trap's effect when that card is activated local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_FREE_CHAIN) e3:SetCountLimit(1) e3:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMING_BATTLE_START|TIMING_MSET|TIMINGS_CHECK_MONSTER_E) e3:SetCost(Cost.AND(Cost.DetachFromSelf(1),s.effcost)) e3:SetTarget(s.efftg) e3:SetOperation(s.effop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_TRAPTRIX,SET_TRAP_HOLE,SET_HOLE} function s.copyfilter(c) return c:IsNormalTrap() and c:IsSetCard({SET_HOLE,SET_TRAP_HOLE}) and c:IsAbleToGraveAsCost() and c:CheckActivateEffect(false,true,true)~=nil end function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(-100) if chk==0 then --Storing the legal group before detaching due to rulings (Q&A #16286) local g=Duel.GetMatchingGroup(s.copyfilter,tp,LOCATION_DECK,0,nil) e:SetLabelObject(g) return #g>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sc=e:GetLabelObject():Select(tp,1,1,nil):GetFirst() e:SetLabelObject(sc) Duel.SendtoGrave(sc,REASON_COST) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local te,ceg,cep,cev,cre,cr,crp=table.unpack(e:GetLabelObject()) return te and te:GetTarget() and te:GetTarget()(e,tp,ceg,cep,cev,cre,cr,crp,chk,chkc) end if chk==0 then local res=e:GetLabel()==-100 e:SetLabel(0) return res end local sc=e:GetLabelObject() local te,ceg,cep,cev,cre,cr,crp=sc:CheckActivateEffect(true,true,true) e:SetLabel(te:GetLabel()) e:SetLabelObject(te:GetLabelObject()) local tg=te:GetTarget() if tg then e:SetProperty(te:GetProperty()) tg(e,tp,ceg,cep,cev,cre,cr,crp,1) te:SetLabel(e:GetLabel()) te:SetLabelObject(e:GetLabelObject()) Duel.ClearOperationInfo(0) end e:SetLabel(0) e:SetLabelObject({te,ceg,cep,cev,cre,cr,crp}) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local te,ceg,cep,cev,cre,cr,crp=table.unpack(e:GetLabelObject()) if not te then return end local op=te:GetOperation() if op then e:SetLabel(te:GetLabel()) e:SetLabelObject(te:GetLabelObject()) op(e,tp,ceg,cep,cev,cre,cr,crp) end e:SetLabel(0) e:SetLabelObject(nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 WATER monster; look at your opponent's hand, then send 1 card from their hand to the GY.
--水霊術-「葵」 --Spiritual Water Art - Aoi local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_TOHAND) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsAttribute,1,false,nil,nil,ATTRIBUTE_WATER) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsAttribute,1,1,false,nil,nil,ATTRIBUTE_WATER) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local g=Duel.GetFieldGroup(p,0,LOCATION_HAND) if #g>0 then Duel.ConfirmCards(p,g) Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TOGRAVE) local sg=g:Select(p,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT) Duel.ShuffleHand(1-p) 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 removing from play 1 Spirit monster from your hand. Spirit monsters you control do not have to have their effects that return them to the hand activated.
--伊弉凪 --Izanagi local s,id=GetID() function s.initial_effect(c) --Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Spirit monster do not have to return to the hand local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPIRIT_MAYNOT_RETURN) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) c:RegisterEffect(e2) end s.listed_card_types={TYPE_SPIRIT} function s.filter(c) return c:IsType(TYPE_SPIRIT) and c:IsAbleToRemoveAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local rg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_HAND,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #rg>0 and aux.SelectUnselectGroup(rg,e,tp,1,1,nil,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local rg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_HAND,0,nil,tp) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,nil,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned from the hand by the effect of a "Raidraptor" card, or Normal Summoned: You can inflict 600 damage to your opponent. When an opponent's monster declares an attack that targets this card: You can Special Summon up to 2 "Raidraptor" monsters from your hand, and if you do, monsters your opponent controls cannot target those monsters for attacks this turn.
--RR-ラダー・ストリクス --Raidraptor - Rudder Strix local s,id=GetID() function s.initial_effect(c) --If normal summoned, inflict 600 damage local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Same as above, but if special summoned from hand by effect of "Raidraptor" card local e2=e1:Clone() e2:SetCondition(s.damcon) e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special summon up to 2 "Raidraptor" monsters from hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_BE_BATTLE_TARGET) e3:SetCountLimit(1) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsSetCard(SET_RAIDRAPTOR) and e:GetHandler():IsPreviousLocation(LOCATION_HAND) 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(600) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_RAIDRAPTOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_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 ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end if ft>2 then ft=2 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,ft,nil,e,tp) local tc=g:GetFirst() for tc in aux.Next(g) do if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Cannot be targeted for attacks local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3007) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e1:SetValue(aux.imval1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 Cyberse monster with 2300 ATK in your hand or Extra Deck, and add 1 "@Ignister" monster with the same Attribute from your Deck to your hand. During the End Phase of this turn, take 2300 damage if you did not Special Summon the revealed monster, or a monster with the same name, after you resolved this effect. You cannot activate monster effects for the rest of this turn after this card resolves, except Cyberse monsters. You can only activate 1 "A.I. Meet You" per turn.
--めぐり-Ai- --A.I. Meet You --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Reveal 1 Cyberse monster and add 1 "@Ignister" monster to the hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_IGNISTER} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.cfilter(c,tp) return c:IsRace(RACE_CYBERSE) and c:GetAttack()==2300 and not c:IsPublic() and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,c) end function s.filter(c,rc) return c:IsSetCard(SET_IGNISTER) and c:IsAttribute(rc:GetAttribute()) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_EXTRA,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_EXTRA,0,1,1,nil,tp):GetFirst() if rc then Duel.ConfirmCards(1-tp,rc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,rc) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetOperation(s.regop) e1:SetLabel(rc:GetCode()) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetCondition(s.damcon) e2:SetOperation(s.damop) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetLabelObject(e1) Duel.RegisterEffect(e2,tp) end --Can only activate the effects of Cyberse monsters local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH) e3:SetDescription(aux.Stringid(id,0)) e3:SetTargetRange(1,0) e3:SetValue(s.aclimit) e3:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e3,tp) end function s.aclimit(e,re,tp) local rc=re:GetHandler() return re:IsMonsterEffect() and not rc:IsRace(RACE_CYBERSE) end function s.nmfilter(c,tp,code) return c:IsCode(code) and c:IsSummonPlayer(tp) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 then return end if eg:IsExists(s.nmfilter,1,nil,tp,e:GetLabel()) then e:SetLabel(0) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabelObject():GetLabel()~=0 end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(tp,2300,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 "Rokket" monster in your GY; Special Summon it and equip it with this card, but banish it when this card leaves the field. If this card is sent to the GY because the equipped monster is destroyed: You can draw 1 card. You can only use each effect of "Borrel Regenerator" once per turn.
--ヴァレル・リロード --Borrel Regenerator local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Banish the equipped monster when this card leaves the field local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --Draw 1 card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.drcon) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) end s.listed_series={SET_ROKKET} function s.spfilter(c,e,tp) return c:IsSetCard(SET_ROKKET) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,tp,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and c:IsRelateToEffect(e) and Duel.Equip(tp,c,tc) then --Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetValue(function(e,c) return c==tc end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsReason(REASON_DESTROY) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Red-Eyes Black Dragon" while on the field or in the GY. If your opponent Special Summons a monster(s) (except during the Damage Step): You can send this card from your hand or field to the GY; Special Summon 1 "Red-Eyes" monster from your hand or Deck, except "Red-Eyes Soul". You can only use this effect of "Red-Eyes Soul" once per turn. (Quick Effect): You can target 1 "Red-Eyes Black Dragon" you control; inflict damage to your opponent equal to that monster's original ATK. You can only use this effect of "Red-Eyes Soul" once per Duel.
--真紅き魂 --Red-Eyes Soul --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Change name local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e1:SetValue(CARD_REDEYES_B_DRAGON) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_HAND|LOCATION_MZONE) e2:SetCountLimit(1,{id,0}) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfToGrave) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1},EFFECT_COUNT_CODE_DUEL) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end s.listed_names={CARD_REDEYES_B_DRAGON,id} s.listed_series={SET_RED_EYES} function s.spcon(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_RED_EYES) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.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) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.damfilter(c) return c:IsFaceup() and c:IsCode(CARD_REDEYES_B_DRAGON) and c:GetBaseAttack()>0 end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.damfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.damfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.damfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetFirst():GetBaseAttack()) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Damage(1-tp,tc:GetBaseAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner WATER monsters Each time another monster(s) you control is destroyed by your opponent's attack or card effect: Inflict 600 damage to your opponent. During the Battle Phase, when your opponent activates a card or effect while you control another monster (Quick Effect): You can negate that effect, and if you do, destroy that card. You can only use this effect of "Glacial Beast Iceberg Narwhal" once per turn.
--極氷獣アイスバーグ・ナーワル --Glacial Beast Iceberg Narwhal --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_WATER),1,99) --Inflict 600 damage to your opponent local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Negate an opponent's card or effect and destroy that card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.discon) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) end function s.cfilter(c,tp) return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY) and ((c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp) or (c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp))) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(600) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() and ep==1-tp and Duel.IsExistingMatchingCard(nil,tp,LOCATION_MZONE,0,1,e:GetHandler()) and Duel.IsChainDisablable(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_DISABLE,eg,1,0,0) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Special Summoned: You can add from your Deck to your hand, 1 "Six Samurai" monster with a different Attribute from every monster you control. If exactly 1 "Six Samurai" monster you control (and no other cards) would be destroyed by card effect, you can banish this card from your GY instead.
--影六武衆-キザル --Secret Six Samurai - Kizaru local s,id=GetID() function s.initial_effect(c) --Add 1 "Six Samurai" monster from the Deck to the 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:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Destruction replacement for exactly 1 "Six Samurai" monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end s.listed_series={SET_SIX_SAMURAI} function s.filter(c,att) return c:IsFaceup() and c:IsAttribute(att) end function s.thfilter(c,tp) return c:IsSetCard(SET_SIX_SAMURAI) and c:IsMonster() and c:IsAbleToHand() and not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil,c:GetAttribute()) 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,tp) 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,tp) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_SIX_SAMURAI) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and #eg==1 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:
"Genex Controller" + 1 or more non-Tuner FIRE monsters This card gains 200 ATK for each FIRE monster in your Graveyard. If this card destroys an opponent's monster by battle, inflict 200 damage to your opponent for each "Genex" monster in your Graveyard.
--サーマル・ジェネクス --Thermal 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_FIRE),1,99) c:EnableReviveLimit() --atkup local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.val) 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:SetCode(EVENT_BATTLE_DESTROYING) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.material={68505803} s.listed_names={68505803} function s.val(e,c) return Duel.GetMatchingGroupCount(Card.IsAttribute,c:GetControler(),LOCATION_GRAVE,0,nil,ATTRIBUTE_FIRE)*200 end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRelateToBattle() and c:GetBattleTarget():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) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local d=Duel.GetMatchingGroupCount(Card.IsSetCard,tp,LOCATION_GRAVE,0,nil,SET_GENEX)*200 Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target face-down Defense Position monsters you control with card effects. Monsters you control that were flipped face-up while this card was face-up on the field gain 1500 ATK/DEF. If this card in its owner's Spell & Trap Zone is destroyed by an opponent's card effect: You can target 1 monster in your GY; Special Summon it in face-down Defense Position.
--地中界の厄災 --Terrors in the Hidden City --Scripted by DyXel 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) --Opponent cannot target your face-down Defense Position monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(function(_,c) return c:IsPosition(POS_FACEDOWN_DEFENSE) end) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --Register a flag to monsters that are flipped face-up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_FLIP) e3:SetRange(LOCATION_SZONE) e3:SetOperation(s.flipop) c:RegisterEffect(e3) --Increase the ATK/DEF of flipped monsters by 1500 local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(function(e,c) return c:GetFlagEffect(e:GetHandler():GetFieldID())>0 end) e4:SetValue(1500) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e5) --Special Summon 1 monster from GY in face-down Defense Position local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,0)) e6:SetCategory(CATEGORY_SPECIAL_SUMMON) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e6:SetCode(EVENT_DESTROYED) e6:SetCondition(s.spcon) e6:SetTarget(s.sptg) e6:SetOperation(s.spop) c:RegisterEffect(e6) end function s.flipop(e,tp,eg,ep,ev,re,r,rp) local fid=e:GetHandler():GetFieldID() --in case we have multiples, the id will not be enough for tc in eg:Iter() do tc:RegisterFlagEffect(fid,RESET_EVENT|RESETS_STANDARD,0,1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_SZONE) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only activate 1 "Onomatopaira" per turn. Send 1 card from your hand to the GY; choose up to 2 of these categories. For each chosen category, add one monster in that category from your Deck to your hand. ● 1 "Zubaba" monster ● 1 "Gagaga" monster ● 1 "Gogogo" monster ● 1 "Dododo" monster * The above text is unofficial and describes the card's functionality in the OCG.
--オノマト連携 --Onomatopaira local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GAGAGA,SET_GOGOGO,SET_DODODO,SET_ZUBABA} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,1,1,REASON_COST) end function s.filter(c) return c:IsMonster() and (c:IsSetCard(SET_GAGAGA) or c:IsSetCard(SET_GOGOGO) or c:IsSetCard(SET_DODODO) or c:IsSetCard(SET_ZUBABA)) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.rescon(sg,e,tp,mg) local t={SET_GAGAGA,SET_GOGOGO,SET_DODODO,SET_ZUBABA} local count = 0 for i, set in ipairs(t) do if sg:IsExists(Card.IsSetCard,1,nil,set) then count = count + 1 end end return count >= #sg end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g==0 then return end local tg=aux.SelectUnselectGroup(g,e,tp,1,2,s.rescon,1,tp,HINTMSG_ATOHAND) if #tg==0 then return end Duel.SendtoHand(tg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tg) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Machine-Type monster + 1 Pyro-Type monster Once per turn, during your Main Phase: You can inflict 300 damage to your opponent for each card on the field. This card cannot attack during the turn you activate this effect.
--重爆撃禽 ボム・フェネクス --Blaze Fenix, the Burning Bombardment Bird local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Fusion summon procedure Fusion.AddProcFun2(c,aux.FilterBoolFunction(Card.IsRace,RACE_MACHINE),aux.FilterBoolFunction(Card.IsRace,RACE_PYRO),true) --Inflict damage equal to number of cards on the field x 300 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.damcost) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end --Cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) e:GetHandler():RegisterEffect(e1,true) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local ct=Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ct*300) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ct=Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) Duel.Damage(p,ct*300,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can reveal 1 other "P.U.N.K." monster in your hand; Special Summon either the revealed monster or this card, and send the other to the GY. If this card is sent from the field to your GY: You can target 1 "P.U.N.K." monster in your GY, except a Level 5 monster; Special Summon it, but you cannot Special Summon "Noh-P.U.N.K. Deer Note" for the rest of this turn. You can only use each effect of "Noh-P.U.N.K. Deer Note" once per turn.
--No-P.U.N.K.ディア・ノート --Noh-P.U.N.K. Deer Note --Scripted by Yuno local s,id=GetID() function s.initial_effect(c) --Special Summon either the revealed "P.U.N.K." monster or this card, and send the other to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.Reveal(s.handspcostfilter,true,1,1,function(e,tp,og) local rc=og:GetFirst() e:SetLabelObject(rc) rc:CreateEffectRelation(e) end)) e1:SetTarget(s.handsptg) e1:SetOperation(s.handspop) c:RegisterEffect(e1) --Special Summon 1 "P.U.N.K." monster from your GY, except a Level 5 monster 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_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e2:SetTarget(s.gysptg) e2:SetOperation(s.gyspop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_PUNK} function s.handspcostfilter(c,e,tp) if not (c:IsSetCard(SET_PUNK) and c:IsMonster()) then return false end local hc=e:GetHandler() return (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and hc:IsAbleToGrave()) or (hc:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsAbleToGrave()) end function s.handsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end local g=Group.FromCards(e:GetHandler(),e:GetLabelObject()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,tp,0) end function s.handspop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Group.FromCards(e:GetHandler(),e:GetLabelObject()):Match(Card.IsRelateToEffect,nil,e) if #g~=2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:FilterSelect(tp,Card.IsCanBeSpecialSummoned,1,1,nil,e,0,tp,false,false) if #sg>0 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.SendtoGrave(g-sg,REASON_EFFECT) end end function s.gyspfilter(c,e,tp) return c:IsSetCard(SET_PUNK) and not c:IsLevel(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.gysptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.gyspfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.gyspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.gyspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.gyspop(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 --You cannot Special Summon "Noh-P.U.N.K. Deer Note" for the rest of this turn 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 c:IsCode(id) 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:
You can Tribute 1 monster, or no monsters, to Normal Summon (but not Set) this card. The ATK of this card becomes the combined original ATK of the Tributed monsters. Neither player can Tribute cards.
--霧の王 --Fog King local s,id=GetID() function s.initial_effect(c) --summon with 1 tribute local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_SUMMON_PROC) e0:SetCondition(s.ttcon) e0:SetOperation(s.ttop) e0:SetValue(SUMMON_TYPE_TRIBUTE) c:RegisterEffect(e0) --summon with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) c:RegisterEffect(e1) --tribute check local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_MATERIAL_CHECK) e2:SetValue(s.valcheck) c:RegisterEffect(e2) --give atk effect only when summon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SUMMON_COST) e3:SetOperation(s.facechk) e3:SetLabelObject(e2) c:RegisterEffect(e3) --cannot release local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_MZONE) e4:SetCode(EFFECT_CANNOT_RELEASE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetTargetRange(1,1) c:RegisterEffect(e4) end function s.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.ttcon(e,c,minc) if c==nil then return true end return minc<=1 and Duel.CheckTribute(c,1) end function s.ttop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectTribute(tp,c,1,1) c:SetMaterial(g) Duel.Release(g, REASON_SUMMON+REASON_MATERIAL) end function s.valcheck(e,c) local g=c:GetMaterial() local tc=g:GetFirst() local atk=0 for tc in aux.Next(g) do local catk=tc:GetTextAttack() atk=atk+(catk>=0 and catk or 0) end if e:GetLabel()==1 then e:SetLabel(0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESET_DISABLE|RESET_TURN_SET|RESET_TOGRAVE|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TOHAND|RESET_TODECK|RESET_LEAVE) c:RegisterEffect(e1) end end function s.facechk(e,tp,eg,ep,ev,re,r,rp) e:GetLabelObject():SetLabel(1) 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: Shuffle as many cards your opponent controls as possible into the Deck(s), then they draw cards equal to the number shuffled into their Main Deck. Once per turn, during your Standby Phase: Shuffle this card into the Deck.
--時械神 ガブリオン --Gabrion, 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) --to deck local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,1)) e6:SetCategory(CATEGORY_TODECK) 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.tdcon) e6:SetTarget(s.tdtg) e6:SetOperation(s.tdop) 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.rtdcon) e7:SetTarget(s.rtdtg) e7:SetOperation(s.rtdop) 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.tdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,#g) end function s.cfilter(c,p) return c:IsLocation(LOCATION_DECK) and c:IsControler(p) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil) if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 then local ct=Duel.GetOperatedGroup():FilterCount(s.cfilter,nil,1-tp) if ct>0 then Duel.ShuffleDeck(1-tp) Duel.BreakEffect() Duel.Draw(1-tp,ct,REASON_EFFECT) end end end function s.rtdcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.rtdtg(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.rtdop(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:
2+ Cyberse monsters Once per turn, before damage calculation, if your monster this card points to battles an opponent's monster with higher ATK than it: You can make that monster unable to be destroyed by that battle, also you take no battle damage from that battle. After that damage calculation, have this card or 1 monster it points to gain ATK equal to the ATK of that battled opponent's monster, until the end of this turn.
--エンコード・トーカー --Encode Talker --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2) --activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_CONFIRM) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local lg=e:GetHandler():GetLinkedGroup() local a=Duel.GetAttacker() local b=a:GetBattleTarget() if not b then return false end if a:IsControler(1-tp) then a,b=b,a end return a:GetControler()~=b:GetControler() and lg:IsContains(a) and a:IsFaceup() and b:IsFaceup() and b:GetAttack()>a:GetAttack() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local a=Duel.GetAttacker() local b=a:GetBattleTarget() if a:IsControler(1-tp) then a,b=b,a end if a:IsRelateToBattle() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) a:RegisterEffect(e1) end local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,0) e2:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_BATTLED) e3:SetLabelObject(b) e3:SetRange(LOCATION_MZONE) e3:SetOperation(s.atkop) e3:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) c:RegisterEffect(e3) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local b=e:GetLabelObject() if b:IsFacedown() or not b:IsRelateToBattle() then return end local lg=c:GetLinkedGroup() lg:AddCard(c) local tc=nil if #lg==1 then tc=lg:GetFirst() else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) tc=lg:Select(tp,1,1,nil):GetFirst() end Duel.HintSelection(Group.FromCards(tc)) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(b:GetAttack()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: You can banish this card; Special Summon 1 Level 4 or lower Fish monster from your Deck, except "Beautunaful Princess". You can only use this effect of "Beautunaful Princess" once per turn.
--鰤っ子姫 --Beautunaful Princess local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end function s.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_FISH) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
A "Black Luster Soldier" monster Ritual Summoned using this card gains these effects. You can only use this effect of "Beginning Knight" once per turn. ● Once per turn: You can target 1 monster your opponent controls; banish it. ● When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can activate this effect; this card can make a second attack in a row. If this card is banished from the Graveyard: You can add 1 Ritual Spell Card from your Deck to your hand. You can only use this effect of "Beginning Knight" once per turn.
--開闢の騎士 --Beginning Knight local s,id=GetID() function s.initial_effect(c) --gain local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_EVENT_PLAYER+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCountLimit(1,id) e1:SetCondition(s.mtcon) e1:SetOperation(s.mtop) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_REMOVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_BLACK_LUSTER_SOLDIER} function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_RITUAL and eg:IsExists(Card.IsSetCard,1,nil,SET_BLACK_LUSTER_SOLDIER) end function s.mtop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=eg:Filter(Card.IsSetCard,nil,SET_BLACK_LUSTER_SOLDIER) local rc=g:GetFirst() if not rc then return end local e1=Effect.CreateEffect(rc) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(rc) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(s.atcon) e2:SetOperation(s.atop) e2:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e2,true) if not rc:IsType(TYPE_EFFECT) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_ADD_TYPE) e3:SetValue(TYPE_EFFECT) e3:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e3,true) end rc:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3)) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,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.atcon(e,tp,eg,ep,ev,re,r,rp) return aux.bdogcon(e,tp,eg,ep,ev,re,r,rp) and e:GetHandler():CanChainAttack() end function s.atop(e,tp,eg,ep,ev,re,r,rp) Duel.ChainAttack() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE) end function s.thfilter(c) return c:IsRitualSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Ki-sikil" monster You can only Link Summon "Evil★Twin Ki-sikil Deal" once per turn. You can send 1 "Lil-la" monster from your Deck or Extra Deck to the GY; apply this effect this turn. ● Each time your opponent activates a card or effect in response to your "Ki-sikil" or "Lil-la" monster effect activation, draw 1 card when that card/effect resolves. You can only use this effect of "Evil★Twin Ki-sikil Deal" once per turn.
--Evil★Twin キスキル・ディール --Evil★Twin Ki-sikil Deal --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 1 "Ki-Sikil" monster Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_KI_SIKIL),1,1) --You can only Link Summon "Evil★Twin Ki-sikil Deal" once per turn local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_SPSUMMON_SUCCESS) e0:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end) e0:SetOperation(s.regop) c:RegisterEffect(e0) --Apply this effect for the rest of this turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(function(e,tp) return not Duel.HasFlagEffect(tp,id) end) e1:SetCost(s.effcost) e1:SetOperation(s.effop) c:RegisterEffect(e1) end s.listed_series={SET_KI_SIKIL,SET_LIL_LA} s.listed_names={id} function s.regop(e,tp,eg,ep,ev,re,r,rp) --Prevent another Link Summon of "Evil★Twin Ki-sikil Deal" that turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c,sump,sumtype) return c:IsCode(id) and sumtype&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.costfilter(c) return c:IsSetCard(SET_LIL_LA) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.effop(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) local c=e:GetHandler() --Draw 1 card immediately after it resolves local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetCondition(s.drawcon) e1:SetOperation(s.drawop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,1)) end function s.drawcon(e,tp,eg,ep,ev,re,r,rp) local chainlink=Duel.GetCurrentChain(true)-1 if not (chainlink>0 and ep==1-tp) then return false end local trig_p,trig_typ,setcodes=Duel.GetChainInfo(chainlink,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_TYPE,CHAININFO_TRIGGERING_SETCODES) if not (trig_p==tp and (trig_typ&TYPE_MONSTER)>0) then return false end for _,set in ipairs(setcodes) do if ((SET_KI_SIKIL&0xfff)==(set&0xfff) and (SET_KI_SIKIL&set)==SET_KI_SIKIL) or ((SET_LIL_LA&0xfff)==(set&0xfff) and (SET_LIL_LA&set)==SET_LIL_LA) then return true end end end function s.drawop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,1,REASON_EFFECT) 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 sent from the field to the GY: You can target 1 Special Summoned monster your opponent controls; send it to the GY. You can only use each effect of "Bystial Druiswurm" once per turn.
--深淵の獣ドルイドヴルム --Bystial Druiswurm --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) --Send 1 Special Summoned monster the opponent controls to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) end 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.tgfilter(c) return c:IsSpecialSummoned() and c:IsAbleToGrave() end function s.tgtg(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.tgfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.tgfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,tp,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoGrave(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 Spellcaster monsters Cannot be destroyed by battle or card effects while it has material. Your opponent takes any effect damage you would have taken, a number of times each turn up to the number of materials attached to this card. If this card has "Performage Trapeze Magician" as material, it gains this effect. ● You can detach 1 material from this card; this card can make up to 3 attacks during each Battle Phase this turn.
--Emトラピーズ・ハイ・マジシャン --Performage Trapeze High Magician --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 5 Spellcaster monsters Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),5,2) --Cannot be destroyed by battle or card effects while it has material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(function(e) return e:GetHandler():GetOverlayCount()>0 end) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2) --Your opponent takes any effect damage you would have taken instead local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_REFLECT_DAMAGE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(1,0) e3:SetCondition(s.reflectcond) e3:SetValue(s.reflectvalue) c:RegisterEffect(e3) --Can make up to 3 attacks this turn local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.atkcon) e4:SetCost(Cost.DetachFromSelf(1,1,nil)) e4:SetOperation(s.atkop) c:RegisterEffect(e4) end s.listed_names={17016362} --"Performage Trapeze Magician" function s.reflectcond(e) local c=e:GetHandler() return c:GetOverlayCount()>c:GetFlagEffect(id) end function s.reflectvalue(e,re,val,r,rp,rc) if (r&REASON_EFFECT)>0 then Duel.Hint(HINT_CARD,rp,id) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) return true end return false end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsAbleToEnterBP() and c:CanAttack() and c:GetEffectCount(EFFECT_EXTRA_ATTACK)<2 and c:GetOverlayGroup():IsExists(Card.IsCode,1,nil,17016362) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then --Can make up to 3 attacks during each Battle Phase this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(2) 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:
Target 1 face-up monster on the field; equip this card to that target. It gains 500 ATK. If the equipped monster battles while in Defense Position, it gains DEF equal to its ATK during damage calculation only.
--鎖付き尖盾 --Spikeshield with Chain local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) or not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) --Atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetCondition(s.defcon) e2:SetValue(s.defval) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) --Equip limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EQUIP_LIMIT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetValue(1) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) else c:CancelToGrave(false) end end function s.defcon(e) if Duel.GetCurrentPhase()~=PHASE_DAMAGE_CAL then return false end local eq=e:GetHandler():GetEquipTarget() return (eq==Duel.GetAttacker() or eq==Duel.GetAttackTarget()) and eq:IsDefensePos() end function s.defval(e,c) return c:GetAttack() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card battles a monster, neither can be destroyed by that battle. Each time a monster declares an attack, this card gains 1000 ATK. During your Main Phase: You can make this card lose exactly 5000 ATK, and if you do, destroy all other cards on the field. You can only use this effect of "Festiballoon" once per turn.
--フェスティバルーン --Festiballoon --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Neither monster can be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(s.indestg) e1:SetValue(1) c:RegisterEffect(e1) --Each time a monster declares an attack, this card gains 1000 ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetOperation(function(e) e:GetHandler():UpdateAttack(1000) end) c:RegisterEffect(e2) --Make this card lose exactly 5000 ATK, and if you do, destroy all other cards on the field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end function s.indestg(e,c) local handler=e:GetHandler() return c==handler or c==handler:GetBattleTarget() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)-c if chk==0 then return c:IsAttackAbove(5000) and #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup() and c:IsAttackAbove(5000) and c:UpdateAttack(-5000)==-5000) then return end local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)-c if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish 7 "Fire Formation" Spell/Trap Cards from your Graveyard; Special Summon as many "Fire Fist" monsters as possible from your Graveyard, then you can Set "Fire Formation" Spell/Trap Cards directly from your Deck, except "Ultimate Fire Formation - Seito", up to the number of monsters Special Summoned by this effect.
--極炎舞-「星斗」 --Ultimate Fire Formation - Seito local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsSetCard(SET_FIRE_FORMATION) and c:IsSpellTrap() and c:IsAbleToRemoveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,7,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,7,7,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.filter(c,e,tp) return c:IsSetCard(SET_FIRE_FIST) 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_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.sfilter(c) return c:IsSetCard(SET_FIRE_FORMATION) and c:GetCode()~=id and c:IsSpellTrap() and c:IsSSetable() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local tg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil,e,tp) if ft<=0 or #tg==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=tg:Select(tp,ft,ft,nil) local ct=Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) if ct>0 then local ft2=Duel.GetLocationCount(tp,LOCATION_SZONE) if ft2>ct then ft2=ct end if ft2<=0 then return end local sg=Duel.GetMatchingGroup(s.sfilter,tp,LOCATION_DECK,0,nil) if #sg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local setg=sg:Select(tp,1,ft2,nil) Duel.SSet(tp,setg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 3 monsters with different Attributes from your GY and/or face-up field. Cannot be destroyed by card effects. You can declare 1 monster Attribute on the field; destroy all monsters on the field with that Attribute, also until the end of the next turn, neither player can Special Summon monsters with that Attribute. You can only use this effect of "Archnemeses Protos" once per turn.
--アークネメシス・プロートス --Archnemeses Protos --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Cannot be destroyed by effects 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) c:RegisterEffect(e2) --Destroy monsters with the declared attribute local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.spfilter(c) return c:IsMonster() and (c:IsFaceup() or not c:IsOnField()) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true,true) end function s.rescon(sg,e,tp) return aux.ChkfMMZ(1)(sg,e,tp,nil) and sg:GetClassCount(Card.GetAttribute)==#sg,sg:GetClassCount(Card.GetAttribute)~=#sg end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and #rg>2 and aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local tc=g:GetFirst() local attr=0 for tc in aux.Next(g) do attr=(attr|tc:GetAttribute()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) local arc=Duel.AnnounceAttribute(tp,1,attr) e:SetLabel(arc) local dg=g:Filter(Card.IsAttribute,nil,arc) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local arc=e:GetLabel() local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttribute,arc),tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end --disable spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,1) e1:SetTarget(s.sumlimit(arc)) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) end function s.sumlimit(arc) return function(e,c,sump,sumtype,sumpos,targetp) return c:IsAttribute(arc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Remove from play any number of Monster Cards in your Graveyard to destroy 1 face-up monster on the field whose Level is equal to the number of the cards you removed from play.
--死霊の巣 --Skull Lair local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) c:RegisterEffect(e1) --Destroy monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e2:SetCost(s.descost) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.cfilter(c) return c:IsMonster() and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c) end function s.rescon(fg) return function(sg,e,tp,mg) return fg:IsExists(Card.IsLevel,1,sg,#sg),not fg:IsExists(Card.IsLevelAbove,1,sg,#sg) end end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local cg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local fg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsLevelBelow,#cg),tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return aux.SelectUnselectGroup(cg,e,tp,nil,nil,s.rescon(fg),0) end local rg=aux.SelectUnselectGroup(cg,e,tp,nil,nil,s.rescon(fg),1,tp,HINTMSG_REMOVE,s.rescon(fg)) Duel.Remove(rg,POS_FACEUP,REASON_COST) Duel.SetTargetParam(#rg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,fg:Filter(Card.IsLevel,rg,#rg),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local lv=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) if lv==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.FaceupFilter(Card.IsLevel,lv),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Despia" monster or 1 Level 8 or higher Fusion Monster in your GY; Special Summon it, then you can apply this effect. ● Fusion Summon 1 Level 8 or higher Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from either field. You can only activate 1 "Branded Banishment" per turn.
--烙印追放 --Branded Banishment --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Despia" or level 8+ fusion monster from GY local fparams={aux.FilterBoolFunction(Card.IsLevelAbove,8),Fusion.OnFieldMat(Card.IsAbleToRemove),s.fextra,Fusion.BanishMaterial,nil,nil} local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON+CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate(Fusion.SummonEffTG(table.unpack(fparams)),Fusion.SummonEffOP(table.unpack(fparams)))) c:RegisterEffect(e1) end --Lists "Despia" archetype s.listed_series={SET_DESPIA} --Check for "Despia" or level 8+ monster function s.spfilter(c,e,tp) return (c:IsSetCard(SET_DESPIA) or (c:IsLevelAbove(8) and c:IsType(TYPE_FUSION))) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end --Activation legality 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.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 --Special Summon 1 "Despia" or level 8+ fusion monster from GY function s.activate(fustg,fusop) return function(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and fustg(e,tp,eg,ep,ev,re,r,rp,0) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then --Fusion Summon 1 level 8+ monster, by banishing monsters from either field Duel.BreakEffect() fusop(e,tp,eg,ep,ev,re,r,rp) end end end function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsFaceup,Card.IsAbleToRemove),tp,0,LOCATION_ONFIELD,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by having a Level 7 or higher "F.A." monster on the field, but no "F.A. Dark Dragster" in your Monster Zone. Gains ATK equal to its Level x 300. Each time a "F.A." Spell/Trap Card or effect is activated: You can increase this card's Level by 1. Once per turn: You can target 1 card on the field; reduce this card's Level by 3, and if you do, destroy that target.
--F.A.ダークネスマスター --F.A. Dark Dragster --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --increase ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.atkval) c:RegisterEffect(e2) --increase level local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_LVCHANGE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.lvcon) e4:SetOperation(s.lvop) c:RegisterEffect(e4) --destroy 1 card local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetCountLimit(1) e5:SetRange(LOCATION_MZONE) e5:SetTarget(s.rdtg) e5:SetOperation(s.rdop) c:RegisterEffect(e5) end s.listed_series={SET_FA} function s.spfilter(c) return c:IsSetCard(SET_FA) and c:IsLevelAbove(7) end function s.spcon(e,c) if c==nil then return true end if Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)<=0 or Duel.IsExistingMatchingCard(Card.IsCode,c:GetControler(),LOCATION_MZONE,0,1,nil,id) then return false end return Duel.IsExistingMatchingCard(s.spfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) end function s.atkval(e,c) return c:GetLevel()*300 end function s.lvcon(e,tp,eg,ep,ev,re,r,rp) return re:IsSpellTrapEffect() and re:GetHandler():IsSetCard(SET_FA) end function s.lvop(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_LEVEL) e1:SetValue(1) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.rdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return e:GetHandler():GetLevel()>3 and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.rdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not c:IsFacedown() and c:IsRelateToEffect(e) and not c:IsImmuneToEffect(e) and c:UpdateLevel(-3)~=0 and tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters If 3 or more "D/D/D" monsters are on the field, this card gains 3000 ATK. If another "D/D" monster(s) is Normal or Special Summoned to your field while this monster is on the field (except during the Damage Step): You can target 1 "D/D" monster in your GY; Special Summon it. You can only use this effect of "D/D/D Gust High King Alexander" once per turn.
--DDD疾風大王エグゼクティブ・アレクサンダー --D/D/D Gust High King Alexander local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --atk local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.atkcon) e3:SetValue(3000) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_DD) and c:IsControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_DD) 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.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_DDD) end function s.atkcon(e) return Duel.GetMatchingGroupCount(s.atkfilter,e:GetHandlerPlayer(),LOCATION_MZONE,LOCATION_MZONE,nil)>=3 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) is Normal or Special Summoned, and you control a "Tearlaments" monster or "Visas Starfrost" (except during the Damage Step): You can send the top 3 cards of your Deck to the GY, also, for the rest of this turn, all monsters your opponent controls lose 500 ATK. If this card is sent to the GY by card effect: You can add 1 "Tearlaments" Trap from your Deck to your hand. You can only use each effect of "Tearlaments Scream" once per turn.
--壱世壊を劈く弦声 --Tearlaments Scream --Scripted by Hatter 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) --Mill 3 cards local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Add 1 "Tearalaments" Trap to the hand 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_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(function(e) return e:GetHandler():IsReason(REASON_EFFECT) end) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_names={CARD_VISAS_STARFROST} s.listed_series={SET_TEARLAMENTS} function s.cfilter(c) return c:IsFaceup() and (c:IsCode(CARD_VISAS_STARFROST) or (c:IsSetCard(SET_TEARLAMENTS) and c:IsMonster())) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.DiscardDeck(tp,3,REASON_EFFECT) --Reduce ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(-500) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:IsSetCard(SET_TEARLAMENTS) and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.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