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:
FLIP: Apply these effects (simultaneously). ● You can destroy 1 card on the field. ● Send the top 3 cards of your Deck to the GY.
--ライトロード・ハンター ライコウ --Ryko, Lightsworn Hunter local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,1,nil) Duel.HintSelection(sg) Duel.Destroy(sg,REASON_EFFECT) end Duel.DiscardDeck(tp,3,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 card to target 2 of your banished Fish, Sea Serpent, or Aqua-Type monsters; add them to your hand.
--フィッシュアンドバックス --Fish and Swaps 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_FISH|RACE_AQUA|RACE_SEASERPENT) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) if #sg>0 then Duel.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:
1 Tuner + 1 or more non-Tuner monsters During either player's turn: You can Tribute this card; increase the Levels of all monsters currently on the field by 1, until the end of this turn. If this card is in your Graveyard and you control a "Speedroid" Tuner monster: You can Special Summon this card, also you cannot Special Summon monsters for the rest of this turn, except WIND monsters. You can only use this effect of "Hi-Speedroid Hagoita" once per turn.
--HSRマッハゴー・イータ --Hi-Speedroid Hagoita local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --level up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) --summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SPEEDROID} function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.hsfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SPEEDROID) and c:IsType(TYPE_TUNER) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.hsfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsAttribute(ATTRIBUTE_WIND) 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 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,2)) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 monsters If this card is Xyz Summoned: The ATK of all monsters your opponent currently controls become 0. Once per turn (Quick Effect): You can detach 1 material from this card, then target 1 face-up Xyz Monster you control and 1 "Utopia" monster in your GY; banish the first target, and if you do, Special Summon the second target, then gain 1250 LP.
--No.39 希望皇ビヨンド・ザ・ホープ --Number 39: Utopia Beyond local s,id=GetID() function s.initial_effect(c) c:AddSetcodesRule(id,true,SET_UTOPIA) --easier workaround so that Utopia Beyond (Anime) doesn't get the setcode --xyz summon Xyz.AddProcedure(c,nil,6,2) c:EnableReviveLimit() --atk local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON+CATEGORY_RECOVER) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_UTOPIA} s.xyz_number=39 function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsXyzSummoned() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.rmfilter(c,ft) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToRemove() and (ft>0 or c:GetSequence()<5) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_UTOPIA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.IsExistingTarget(s.rmfilter,tp,LOCATION_MZONE,0,1,nil,ft) and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectTarget(tp,s.rmfilter,tp,LOCATION_MZONE,0,1,1,nil,ft) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g2,1,0,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,0,0,tp,1250) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_REMOVE) local ex,g2=Duel.GetOperationInfo(0,CATEGORY_SPECIAL_SUMMON) local tc1=g1:GetFirst() if not tc1:IsRelateToEffect(e) or Duel.Remove(tc1,POS_FACEUP,REASON_EFFECT)==0 then return end local tc2=g2:GetFirst() if not tc2:IsRelateToEffect(e) or Duel.SpecialSummon(tc2,0,tp,tp,false,false,POS_FACEUP)==0 then return end Duel.BreakEffect() Duel.Recover(tp,1250,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, if your Spellcaster monster battles an opponent's monster (Quick Effect): You can reveal any number of Spells with different names in your hand, and if you do, your battling monster gains 1000 ATK/DEF for each card revealed, until the end of this turn. (Quick Effect): You can discard 1 Spell; negate the effects of all face-up monsters your opponent currently controls, until the end of this turn. You can only use each effect of "Witchcrafter Madame Verre" once per turn.
--ウィッチクラフトマスター・ヴェール --Witchcrafter Madame Verre --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Increase ATK/DEF of your battling Spellcaster monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.atkcon) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Negate the effects of monsters the opponent currently controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(aux.WitchcrafterDiscardCost) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local tc,bc=Duel.GetBattleMonster(tp) return tc and bc and tc:IsRace(RACE_SPELLCASTER) and bc:IsControler(1-tp) end function s.rvfilt(c) return c:IsSpell() and not c:IsPublic() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rvfilt,tp,LOCATION_HAND,0,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc,bc=Duel.GetBattleMonster(tp) if tc:IsRelateToBattle() and tc:IsFaceup() and tc:IsControler(tp) then local sg=Duel.GetMatchingGroup(s.rvfilt,tp,LOCATION_HAND,0,nil) local ct=sg:GetClassCount(Card.GetCode) local g=aux.SelectUnselectGroup(sg,e,tp,1,ct,aux.dncheck,1,tp,HINTMSG_CONFIRM) if #g>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(#g*1000) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end end function s.disfilter(c) return c:IsSpell() and c:IsDiscardable() end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,nil) local c=e:GetHandler() --Negate the effects of all face-up monsters your opponent currently controls, until the end of this turn for tc in g:Iter() do tc:NegateEffects(c,RESET_PHASE|PHASE_END) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Normal Summon 1 Level 4 LIGHT Thunder-Type monster from your hand, except "Mahunder", as an additional Normal Summon.
--OKaサンダー --Mahunder local s,id=GetID() function s.initial_effect(c) --summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsRace(RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==4 and c:GetCode()~=id and c:IsSummonable(true,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Summon(tp,tc,true,nil) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Armed Dragon LV5" while on the field or in the GY. You can only use each of the following effects of "Armed Dragon Thunder LV5" once per turn. You can send 1 monster from your hand to the GY; send this card from the field to the GY, and if you do, Special Summon 1 Level 7 or lower "Armed Dragon" monster from your hand or Deck. If this card is sent to the GY to activate a Dragon monster's effect: You can add 1 Level 5 or higher WIND Dragon monster from your Deck to your hand.
--アームド・ドラゴン・サンダー LV5 --Armed Dragon Thunder LV5 --Scripted by AlphaKretin Duel.LoadCardScript("c46384672.lua") local s,id=GetID() function s.initial_effect(c) --This card's name becomes "Armed Dragon LV5" while on the field or in the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e1:SetValue(46384672) c:RegisterEffect(e1) --Special Summon 1 Level 7 or lower "Armed Dragon" monster from your hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Add 1 Level 5 or higher WIND Dragon monster from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_names={46384672} --"Armed Dragon LV5" s.listed_series={SET_ARMED_DRAGON} s.LVnum=5 s.LVset=SET_ARMED_DRAGON_THUNDER function s.spcostfilter(c,e,tp,armd_lv5) return c:IsMonster() and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,c,e,tp,armd_lv5) end function s.spfilter(c,e,tp,armd_lv5) local ignore_sum_con=c:IsCode(73879377) and armd_lv5 return c:IsSetCard(SET_ARMED_DRAGON) and c:IsLevelBelow(7) and c:IsCanBeSpecialSummoned(e,0,tp,ignore_sum_con,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local armd_lv5=e:GetHandler():IsCode(46384672) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil,e,tp,armd_lv5) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,armd_lv5) Duel.SendtoGrave(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGrave() and Duel.GetMZoneCount(tp,c)>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,c,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local armd_lv5=false if c:IsCode(46384672) and c:IsFaceup() then armd_lv5=true else local trig_code1,trig_code2=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) armd_lv5=trig_code1==46384672 or trig_code2==46384672 end if Duel.SendtoGrave(c,REASON_EFFECT)>0 and c:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp,armd_lv5):GetFirst() if not sc then return end local armd_lv7=sc:IsCode(73879377) ignore_sum_con=armd_lv5 and armd_lv7 if Duel.SpecialSummon(sc,0,tp,tp,ignore_sum_con,false,POS_FACEUP)>0 and armd_lv7 then sc:CompleteProcedure() end end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) if not (e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsMonsterEffect()) then return false end local rc=re:GetHandler() if rc:IsRelateToEffect(re) and rc:IsFaceup() then return rc:IsRace(RACE_DRAGON) else return Duel.GetChainInfo(0,CHAININFO_TRIGGERING_RACE)&RACE_DRAGON>0 end end function s.thfilter(c) return c:IsLevelAbove(5) and c:IsAttribute(ATTRIBUTE_WIND) and c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack on a monster you control: You can target 1 "Revival Jam" you control; switch the attack target to that target.
--ディフェンド・スライム --Jam Defender local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_BATTLE_START) c:RegisterEffect(e1) --change target local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.atkcon) e2:SetTarget(s.atktg2) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_names={31709826} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.GetAttackTarget()~=nil end function s.filter(c,atg) return c:IsFaceup() and c:IsCode(31709826) and atg:IsContains(c) end function s.atktg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local atg=Duel.GetAttacker():GetAttackableTarget() local at=Duel.GetAttackTarget() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc~=at and s.filter(chkc,atg) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,at,atg) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,at,atg) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then Duel.ChangeAttackTarget(tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can send 1 "Atlantean" monster from your Deck to the Graveyard, except "Neptabyss, the Atlantean Prince"; add 1 "Atlantean" card from your Deck to your hand, except "Neptabyss, the Atlantean Prince". If this card is sent to the Graveyard to activate a WATER monster's effect: Target 1 "Atlantean" monster in your Graveyard, except "Neptabyss, the Atlantean Prince"; Special Summon it. You can only use each effect of "Neptabyss, the Atlantean Prince" once per turn.
--海皇子 ネプトアビス --Neptabyss, the Atlantean Prince local s,id=GetID() function s.initial_effect(c) --Add to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ATLANTEAN} s.listed_names={id} function s.cfilter(c,tp) return c:IsSetCard(SET_ATLANTEAN) and c:IsMonster() and not c:IsCode(id) and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,c) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_DECK,0,1,1,nil,tp) Duel.SendtoGrave(g,REASON_COST) end function s.filter(c) return c:IsSetCard(SET_ATLANTEAN) and not c:IsCode(id) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,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 function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_COST) and re:IsActivated() and re:IsMonsterEffect() and re:GetHandler():IsAttribute(ATTRIBUTE_WATER) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ATLANTEAN) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return true 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:
Target 1 face-up monster you control; destroy it, and if you do, Special Summon 1 monster from your Deck in Defense Position, with a different original Type and Attribute, whose Level is lower than that monster's original Level, but negate its effects. You can only activate 1 "Clear New World" per turn.
--新世壊 --Clear New World --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.desfilter(c,e,tp) return c:IsFaceup() and c:HasLevel() and Duel.GetMZoneCount(tp,c)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c) end function s.spfilter(c,e,tp,tc) return c:GetOriginalAttribute() & tc:GetOriginalAttribute()==0 and c:GetOriginalRace() & tc:GetOriginalRace()==0 and c:GetOriginalLevel() < tc:GetOriginalLevel() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.desfilter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,tc):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then --Its effects are negated local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e2,true) end Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Drytron" monster in your GY; add it to your hand. During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY, then target 1 "Drytron" monster you control; it gains 2000 ATK until the end of your opponent's turn. You can only use each effect of "Drytron Eclipse" once per turn.
--喰光の竜輝巧 --Drytron Eclipse --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Add to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Gain ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_DRYTRON} function s.thfilter(c) return c:IsMonster() and c:IsSetCard(SET_DRYTRON) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) end 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,LOCATION_GRAVE) 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 s.atkfilter=aux.FaceupFilter(Card.IsSetCard,SET_DRYTRON) function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsSetCard(SET_DRYTRON) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END,2) e1:SetValue(2000) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Fish monster you control; destroy that Fish monster, and if you do, add 1 monster with the same name it had on the field from your Deck to your hand, or, if you controlled a Fish Synchro Monster when you activated this card, you can Special Summon it instead. You can banish this card from your GY, then target 2 Fish monsters with the same name in your GY; place 1 of the 2 on the bottom of your Deck, and if you do, Special Summon the other. You can only use each effect of "White Circle Reef" once per turn.
--白の循環礁 --White Circle Reef --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Destroy 1 Fish monster and search 1 monster with the same name or Special Summon it if you controlled a Synchro monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH+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.activate) c:RegisterEffect(e1) --Target 2 Fish monsters in the GY with the same name to return to the deck and Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end function s.fishsyncfilter(c) return c:IsRace(RACE_FISH) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() end function s.desfilter(c,e,tp,fishsync) return c:IsRace(RACE_FISH) and c:IsFaceup() and Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetCode(),fishsync and Duel.GetMZoneCount(tp,c)>0) end function s.thspfilter(c,e,tp,code,fishsync_mzone) return c:IsCode(code) and c:IsMonster() and (c:IsAbleToHand() or (fishsync_mzone and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local fishsync=e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingMatchingCard(s.fishsyncfilter,tp,LOCATION_MZONE,0,1,nil) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.desfilter(c,e,tp,fishsync) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,fishsync) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp,fishsync) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) if fishsync then Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) else Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end e:SetLabel(fishsync and 1 or 0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local code=tc:GetCode() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRace(RACE_FISH) and Duel.Destroy(tc,REASON_EFFECT)>0 then local fishsync_mzone=e:GetLabel()==1 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 local hint_msg=fishsync_mzone and aux.Stringid(id,2) or HINTMSG_ATOHAND Duel.Hint(HINT_SELECTMSG,tp,hint_msg) local sc=Duel.SelectMatchingCard(tp,s.thspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,code,fishsync_mzone):GetFirst() if not sc then return end if fishsync_mzone and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) then aux.ToHandOrElse(sc,tp, function(sc) return fishsync_mzone and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, function(sc) return Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, aux.Stringid(id,3) ) else Duel.SendtoHand(sc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sc) end end end function s.fishfilter(c,e,tp) return c:IsRace(RACE_FISH) and c:IsCanBeEffectTarget(e) and (c:IsAbleToDeck() or c:IsCanBeSpecialSummoned(e,0,tp,false,false)) end function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetCode)==1 and #sg==2 and sg:IsExists(s.spcheck,1,nil,sg,e,tp) end function s.spcheck(c,sg,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (sg-c):GetFirst():IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.fishfilter,tp,LOCATION_GRAVE,0,nil,e,tp) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TARGET) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_TODECK,tg,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g~=2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local td=g:FilterSelect(tp,Card.IsAbleToDeck,1,1,nil) if #td==0 then return end Duel.HintSelection(td,true) g:RemoveCard(td) if Duel.SendtoDeck(td,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>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 this card is sent from the Monster Zone to the GY: You can activate this effect; you can activate 1 Trap Card from your hand this turn. You can only use this effect of "Makyura the Destructor" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--処刑人-マキュラ --Makyura the Destructor local s,id=GetID() function s.initial_effect(c) --activate trap in hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_TRAP_ACT_IN_HAND) e1:SetTargetRange(LOCATION_HAND,0) e1:SetCountLimit(1) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetDescription(aux.Stringid(id,0)) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: Your opponent chooses 1 random card from your hand, then if it is a monster that can be Special Summoned, Special Summon it. Otherwise, send it to the GY.
--ヒーロー見参 --A Hero Emerges 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_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.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) 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 end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummon(tp) then return end local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0) local sg=g:RandomSelect(1-tp,1) local tc=sg:GetFirst() if tc then Duel.ConfirmCards(1-tp,tc) if tc:IsCanBeSpecialSummoned(e,0,tp,false,false) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) else Duel.SendtoGrave(tc,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent's monster declares an attack: Toss a coin and call it. If you call it right, the attacking monster's ATK becomes 0 until the end of the Battle Phase. During each of your Standby Phases, pay 500 Life Points or destroy this card.
--モンスターBOX --Fairy Box local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END) c:RegisterEffect(e1) --Change the ATK of a monster to 0 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_COIN) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.atkcon) e2:SetTarget(s.atktg2) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --Maintenance cost local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(function(_,tp) return Duel.IsTurnPlayer(tp) end) e3:SetOperation(s.mtop) c:RegisterEffect(e3) end s.toss_coin=true function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return at and at:IsControler(1-tp) end function s.atktg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(Duel.GetAttacker()) Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if not a:IsRelateToEffect(e) then return end if Duel.CallCoin(tp,1) 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|RESET_PHASE|PHASE_BATTLE) a:RegisterEffect(e1) end end function s.mtop(e,tp,eg,ep,ev,re,r,rp) if Duel.CheckLPCost(tp,500) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.PayLPCost(tp,500) else Duel.Destroy(e:GetHandler(),REASON_COST) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can target 1 Set monster your opponent controls; take control of it until your next End Phase. You can only use this effect of "Subterror Behemoth Voltelluric" once per turn. When a face-up monster you control is flipped face-down, if you control no face-up monsters: You can Special Summon this card from your hand in Defense Position. Once per turn: You can change this card to face-down Defense Position.
--サブテラーマリス・ボルティニア --Subterror Behemoth Voltelluric local s,id=GetID() function s.initial_effect(c) --Take control of 1 Set monster your opponent controls until your next End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special Summon this card from your hand in Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetRange(LOCATION_HAND) e2:SetCode(EVENT_CHANGE_POS) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Change this card to face-down Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetTarget(s.postg) e3:SetOperation(s.posop) c:RegisterEffect(e3) end function s.filter(c) return c:IsFacedown() and c:IsControlerCanBeChanged() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local turn_count=1 if Duel.IsTurnPlayer(1-tp) then turn_count=2 elseif Duel.IsPhase(PHASE_END) then turn_count=3 end if tc:IsFacedown() and tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp,PHASE_END,turn_count) end end function s.cfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsFacedown() and c:IsControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.posop(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 "Plaguespreader Zombie" while on the field. Once per turn: You can target up to 2 Zombie monsters you control, except this card; they become Level 2 (until the end of this turn), and if they do, they cannot be used as Synchro Material, except for the Synchro Summon of a Zombie monster.
--ペインペインター --Pain Painter local s,id=GetID() function s.initial_effect(c) --alias local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(33420078) c:RegisterEffect(e1) --lvchange local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end function s.lvfilter(c) local lv=c:GetLevel() return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and lv>0 and lv~=2 end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.lvfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,0,1,2,e:GetHandler()) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetTargetCards(e) local tc=g:GetFirst() for tc in aux.Next(g) do if tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(2) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e2:SetValue(s.synlimit) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end end function s.synlimit(e,c) if not c then return false end return not c:IsRace(RACE_ZOMBIE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters in your Main Monster Zone: Each player sends the top 2 cards of their Deck to the GY (or as many as possible, if less than 2), then, if you sent at least 1 card to the GY, and have 3 or more Spells in your GY, you can shuffle all your opponent's monsters from the Extra Monster Zones into the Deck.
--閃刀術式-ベクタードブラスト --Sky Striker Maneuver - Vector Blast --scripted by andré local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c) return c:GetSequence()<5 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,2) and Duel.IsPlayerCanDiscardDeck(1-tp,2) end end function s.filter(c) return c:GetSequence()>=5 end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,2,REASON_EFFECT) Duel.DiscardDeck(1-tp,2,REASON_EFFECT) if Duel.IsExistingMatchingCard(Card.IsSpell,tp,LOCATION_GRAVE,0,3,nil) and Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 monster that was destroyed by battle and sent to your GY this turn; Special Summon it.
--奇跡の残照 --Miracle's Wake local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.filter(c,e,tp,tid) return c:GetTurnID()==tid and (c:GetReason()&REASON_BATTLE)~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tid=Duel.GetTurnCount() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp,tid) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,tid) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,tid) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3+ Effect Monsters (Quick Effect): You can target cards your opponent controls or in their GY up to the number of different card types (Ritual, Fusion, Synchro, Xyz) you control and in your GY; return them to the hand, also this card gains 500 ATK for each returned card. If a monster this card points to is destroyed by battle, or sent to the GY: You can target 1 Cyberse monster in your GY; Special Summon it. You can only use each effect of "Firewall Dragon Singularity" once per turn.
--ファイアウォール・ドラゴン・シンギュラリティ --Firewall Dragon Singularity --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),3) --Return cards from field/GY to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special Summon 1 Cyberse monster from your GY local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCondition(s.regcon) e2:SetOperation(s.regop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.regcon2) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_DELAY) e4:SetCode(EVENT_CUSTOM+id) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,{id,1}) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end local TYPES=TYPE_RITUAL|TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ local function getcount(tp) return Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsMonster),tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil):GetBinClassCount(function(c) return c:GetType()&TYPES end) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local ct=getcount(tp) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_ONFIELD|LOCATION_GRAVE) and chkc:IsAbleToHand() end if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g==0 or Duel.SendtoHand(g,nil,REASON_EFFECT)==0 then return end local ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_HAND) if ct>0 then local c=e:GetHandler() --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*500) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.cfilter(c,tp,zone) local seq=c:GetPreviousSequence() if not c:IsPreviousControler(tp) then seq=seq+16 end return c:IsPreviousLocation(LOCATION_MZONE) and bit.extract(zone,seq)~=0 end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp,e:GetHandler():GetLinkedZone()) end function s.cfilter2(c,tp,zone) return not c:IsReason(REASON_BATTLE) and s.cfilter(c,tp,zone) end function s.regcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter2,1,nil,tp,e:GetHandler():GetLinkedZone()) end function s.regop(e,tp,eg,ep,ev,re,r,rp) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,0,0) end function s.spfilter(c,e,tp) return c:IsRace(RACE_CYBERSE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn: You can Special Summon 1 of your "Kashtira" monsters that is banished or in your hand. If your opponent activates a Trap Card or effect, you control a "Kashtira" monster, and this card is already face-up in your Spell & Trap Zone: You can look at your opponent's hand, and if you do, banish 1 card from it face-down. You can only use each effect of "Kashtira Preparations" once per turn.
--クシャトリラ・プリペア --Kashtira Preparations --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Special Summon 1 "Kshatri-La" monster from hand or that is banished local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Look at the opponent's hand and banish 1 card face-down local e3a=Effect.CreateEffect(c) e3a:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3a:SetCode(EVENT_CHAINING) e3a:SetRange(LOCATION_SZONE) e3a:SetOperation(s.chainreg) c:RegisterEffect(e3a) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_REMOVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.rmvcond) e3:SetTarget(s.rmvtg) e3:SetOperation(s.rmvop) c:RegisterEffect(e3) end s.listed_series={SET_KASHTIRA} function s.spfilter(c,e,tp) return c:IsSetCard(SET_KASHTIRA) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) 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_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_REMOVED,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.chainreg(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetFlagEffect(id)==0 then c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_CHAIN,0,1) end end function s.rmvcond(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and re:IsTrapEffect() and c:IsStatus(STATUS_EFFECT_ENABLED) and c:HasFlagEffect(id) end function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_KASHTIRA),tp,LOCATION_MZONE,0,1,nil) and Duel.GetMatchingGroupCount(Card.IsAbleToRemove,tp,0,LOCATION_HAND,nil,tp,POS_FACEDOWN)>0 end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND) end function s.rmvop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g==0 then return end Duel.ConfirmCards(tp,g) if g:IsExists(Card.IsAbleToRemove,1,nil,tp,POS_FACEDOWN) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local tc=g:FilterSelect(tp,Card.IsAbleToRemove,1,1,nil,tp,POS_FACEDOWN) if #tc>0 then Duel.Remove(tc,POS_FACEDOWN,REASON_EFFECT) Duel.ShuffleHand(1-tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This turn, "Raidraptor" monsters you control cannot be destroyed by battle. If you have a "Raidraptor" monster in your Graveyard: You can banish this card from your Graveyard; you take no damage this turn.
--RR-レディネス --Raidraptor - Readiness local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetOperation(s.activate) c:RegisterEffect(e1) --No damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_GRAVE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(s.damcon) e2:SetCost(Cost.SelfBanish) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_series={SET_RAIDRAPTOR} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id)==0 end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) --Cannot be destroyed by battle local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.indtg) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetValue(1) Duel.RegisterEffect(e1,tp) end function s.indtg(e,c) return c:IsSetCard(SET_RAIDRAPTOR) end function s.cfilter(c) return c:IsSetCard(SET_RAIDRAPTOR) and c:IsMonster() end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id+1)==0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) --No damage local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_NO_EFFECT_DAMAGE) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Summoned: You can target 1 Level 4 "Gravekeeper's" monster in your GY; Special Summon it in Attack Position or face-down Defense Position. You can only use this effect of "Gravekeeper's Headman" once per turn. This effect is unaffected by "Necrovalley".
--墓守の神職 --Gravekeeper's Headman local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --immune to necro valley local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_NECRO_VALLEY_IM) c:RegisterEffect(e4) end s.listed_series={SET_GRAVEKEEPERS} function s.filter(c,e,tp) return c:IsSetCard(SET_GRAVEKEEPERS) and c:IsLevel(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK|POS_FACEDOWN_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 Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.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_ATTACK|POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time you Tribute Summon a monster, each player can select 1 card from their Graveyard and return it to the top of their Deck.
--エンペラー・ストゥム --Emperor Sem local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.tdcon1) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_MSET) e2:SetCondition(s.tdcon2) c:RegisterEffect(e2) end function s.tdcon1(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst()~=e:GetHandler() and ep==tp and eg:GetFirst():IsTributeSummoned() end function s.tdcon2(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst():GetMaterialCount()~=0 and ep==tp end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_GRAVE,0,1,1,nil) if Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,1,nil) and Duel.SelectYesNo(1-tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK) local g2=Duel.SelectTarget(1-tp,Card.IsAbleToDeck,1-tp,LOCATION_GRAVE,0,1,1,nil) g1:Merge(g2) end Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,#g1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then return end local g=Duel.GetTargetCards(e) Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent Normal or Special Summons a monster(s): Target 1 of those monsters; reveal 3 "Gold Pride" monsters from your Deck, your opponent randomly picks 1 for you to Special Summon, shuffle the rest into your Deck, then destroy the targeted monster.
--GP-スタート・エンジン --Gold Pride - Start Your Engines! --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Reveal 3 "Gold Pride" monsters, summon 1 and destroy a target local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_series={SET_GOLD_PRIDE} function s.desfilter(c,tp,g) return c:IsSummonPlayer(1-tp) and g:IsContains(c) end function s.spfilter(c,e,tp) return c:IsMonster() and c:IsSetCard(SET_GOLD_PRIDE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsPublic() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.desfilter(chkc,tp,eg) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,eg) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,3,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp,eg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,3,3,nil,e,tp) if #g~=3 then return end Duel.ConfirmCards(1-tp,g) local sc=g:RandomSelect(1-tp,1):GetFirst() if sc and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)>0 then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.BreakEffect() Duel.Destroy(tc,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] During your Main Phase: You can add 1 face-up "D/D/D" Pendulum Monster from your Extra Deck to your hand, except "D/D/D Destiny King Zero Laplace". You can only use this effect of "D/D/D Destiny King Zero Laplace" once per turn. ---------------------------------------- [ Monster Effect ] You can Special Summon this card (from your hand) by Tributing 1 "D/D/D" monster. Before damage calculation, if this card battles an opponent's monster: You can activate this effect; this card's ATK becomes double that opponent's monster's original ATK until the end of the Damage Step. If this card attacks a Defense Position monster, inflict piercing battle damage. The first time this card would be destroyed by battle each turn, it is not destroyed, and you take no battle damage from that battle.
--DDD運命王ゼロ・ラプラス --D/D/D Destiny King Zero Laplace local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --special summon from hand local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.hspcon) e2:SetTarget(s.hsptg) e2:SetOperation(s.hspop) c:RegisterEffect(e2) --atk local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_CONFIRM) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) --pierce local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_PIERCE) c:RegisterEffect(e4) --battle indes local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e5:SetCountLimit(1) e5:SetRange(LOCATION_MZONE) e5:SetValue(s.valcon) c:RegisterEffect(e5) --no damage local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e6:SetValue(s.damlimit) c:RegisterEffect(e6) end s.listed_series={SET_DDD} s.listed_names={} function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_DDD) and c:IsType(TYPE_PENDULUM) and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.hspcon(e,c) if c==nil then return true end return Duel.CheckReleaseGroup(c:GetControler(),Card.IsSetCard,1,false,1,true,c,c:GetControler(),nil,false,nil,SET_DDD) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,c) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.SelectReleaseGroup(tp,Card.IsSetCard,1,1,false,true,true,c,nil,nil,false,nil,SET_DDD) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false 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) g:DeleteGroup() end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return c:IsRelateToBattle() and bc and bc:IsFaceup() and bc:IsRelateToBattle() and bc:GetBaseAttack()*2~=c:GetAttack() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if c:IsFaceup() and c:IsRelateToBattle() and bc:IsFaceup() and bc:IsRelateToBattle() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(bc:GetBaseAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) c:RegisterEffect(e1) end end function s.valcon(e,re,r,rp) if (r&REASON_BATTLE)~=0 then e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) return true else return false end end function s.damlimit(e,c) if e:GetHandler():GetFlagEffect(id)==0 then return 1 else return 0 end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 "Crystal Beast" card you control; place that target on top of the Deck. If this face-up card is destroyed in a Monster Zone, you can place it face-up in your Spell & Trap Zone as a Continuous Spell, instead of sending it to the GY.
--宝玉獣 コバルト・イーグル --Crystal Beast Cobalt Eagle local s,id=GetID() function s.initial_effect(c) --send replace local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TO_GRAVE_REDIRECT_CB) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCondition(s.repcon) e1:SetOperation(s.repop) c:RegisterEffect(e1) --return deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_CRYSTAL_BEAST} function s.repcon(e) local c=e:GetHandler() return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY) end function s.repop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) c:RegisterEffect(e1) Duel.RaiseEvent(c,EVENT_CUSTOM+CARD_CRYSTAL_TREE,e,0,tp,0,0) end function s.filter(c) return c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsAbleToDeck() and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() 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:
When control of the equipped monster changes, inflict damage equal to its original ATK to its new controller.
--反目の従者 --Vengeful Servant local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_CONTROL_CHANGED) e3:SetCondition(s.damcon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local tg=e:GetHandler():GetEquipTarget() return tg and eg:IsContains(tg) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and not e:GetHandler():IsStatus(STATUS_CHAINING) end local ec=e:GetHandler():GetEquipTarget() if not ec then return false end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,ec:GetControler(),ec:GetBaseAttack()) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local ec=c:GetEquipTarget() Duel.Damage(ec:GetControler(),ec:GetBaseAttack(),REASON_EFFECT) 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: Special Summon 1 "Gagaga" monster from your Deck. You cannot Special Summon any other monsters, except by Xyz Summon, during the turn you activate this card. You can only activate 1 "Gagaga Academy Emergency Network" per turn.
--ガガガ学園の緊急連絡網 --Gagaga Academy Emergency Network 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) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_GAGAGA} function s.counterfilter(c) return c:IsXyzSummoned() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 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 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetLabelObject(e) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return sumtype~=SUMMON_TYPE_XYZ and e:GetLabelObject()~=se end function s.filter(c,e,tp) return c:IsSetCard(SET_GAGAGA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_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:
You must control "XYZ-Dragon Cannon", or a Fusion Monster that lists "XYZ-Dragon Cannon" as material, to activate this card's effect. This card's effect depends on whose turn it is. ● Your turn: You can target 1 of your banished Union monsters; place it on the bottom of your Deck, and if you do, draw 1 card. ● Your opponent's turn: You can discard any number of cards, then target the same number of cards your opponent controls; destroy those cards. You can only use this effect of "XYZ Hyper Cannon" once per turn.
--X・Y・Zハイパーキャノン --XYZ Hyper Cannon --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) --Activate the appropriate effect based on whose turn it is local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.effcon) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) end s.listed_card={91998119} --"XYZ-Dragon Cannon" s.listed_card_types={TYPE_UNION} function s.effconfilter(c) return (c:IsCode(91998119) or (c:IsType(TYPE_FUSION) and c:IsMonster() and c:ListsCodeAsMaterial(91998119))) and c:IsFaceup() end function s.effcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.effconfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.tdfilter(c) return c:IsType(TYPE_UNION) and c:IsFaceup() and c:IsAbleToDeck() end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local op=e:GetLabel() if op==1 then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.tdfilter(chkc) elseif op==2 then return chkc:IsOnField() and chkc:IsControler(1-tp) end end local b1=Duel.IsTurnPlayer(tp) and Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) local b2=Duel.IsTurnPlayer(1-tp) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) and Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) if chk==0 then return b1 or b2 end local op=b1 and 1 or 2 e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) elseif op==2 then e:SetCategory(CATEGORY_DESTROY) local target_ct=Duel.GetTargetCount(nil,tp,0,LOCATION_ONFIELD,nil) local discard_ct=Duel.DiscardHand(tp,Card.IsDiscardable,1,target_ct,REASON_COST|REASON_DISCARD) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,discard_ct,discard_ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,discard_ct,tp,0) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Place 1 of your banished Union monsters on the bottom of your Deck, and if you do, draw 1 card local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end elseif op==2 then --Destroy cards your opponent controls equal to the number of cards you discarded local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only use each of the following effects of "Therion "Reaper" Fum" once per turn. ● You can target 1 "Therion" monster or 1 Aqua monster in your GY; Special Summon this card from your hand, and if you do, equip that monster to this card. ● During your opponent's turn (Quick Effect): You can target 1 "Therion" card in your Spell & Trap Zone and 1 card your opponent controls; return them to the hand. A "Therion" monster equipped with this card gains 700 ATK, also it can activate the 2nd effect listed above as if it were "Therion "Reaper" Fum".
--セリオンズ“リーパー”ファム --Therion "Reaper" Fum --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,Card.EquipByEffectAndLimitRegister,e1) --Send to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Equipped monster gains ATK local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsSetCard(SET_THERION) end) e3:SetValue(700) c:RegisterEffect(e3) --Equipped monster gains effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(function(e,c) return c==e:GetHandler():GetEquipTarget() and c:IsSetCard(SET_THERION) end) e4:SetLabelObject(e2) c:RegisterEffect(e4) end s.listed_series={SET_THERION} function s.eqfilter(c) return c:IsMonster() and (c:IsSetCard(SET_THERION) or c:IsRace(RACE_AQUA)) end function s.eqval(ec,c,tp) return ec:IsControler(tp) and s.eqfilter(ec) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc) and not chkc:IsForbidden() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsRelateToEffect(e) and tc:IsMonster() and not tc:IsForbidden() then c:EquipByEffectAndLimitRegister(e,tp,tc) end end function s.thfilter(c,e,tp) return c:IsCanBeEffectTarget(e) and c:IsAbleToHand() and (c:IsControler(1-tp) or (c:GetSequence()<5 and c:IsFaceup() and c:IsSetCard(SET_THERION))) end function s.threscon(sg,e,tp,mg) return sg:FilterCount(Card.IsControler,nil,tp)==1 end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local rg=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_SZONE,LOCATION_ONFIELD,nil,e,tp) if chk==0 then return aux.SelectUnselectGroup(rg,e,tp,2,2,s.threscon,0) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.threscon,1,tp,HINTMSG_RTOHAND) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,2,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase (Quick Effect): You can Tribute this card, then discard 1 Spell; Special Summon 1 "Witchcrafter" monster from your Deck, except "Witchcrafter Schmietta". You can banish this card from your GY; send 1 "Witchcrafter" card from your Deck to the GY, except "Witchcrafter Schmietta". You can only use each effect of "Witchcrafter Schmietta" once per turn.
--ウイッチクラフト・シュミッタ --Witchcrafter Schmietta --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Witchcrafter" from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetCost(aux.WitchcrafterDiscardAndReleaseCost) e1:SetTarget(s.sptarget) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Send 1 "Witchcrafter" from your Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_series={SET_WITCHCRAFTER} s.listed_names={id} function s.spfilter(c,e,tp) return c:IsSetCard(SET_WITCHCRAFTER) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptarget(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_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.tgfilter(c) return c:IsSetCard(SET_WITCHCRAFTER) and not c:IsCode(id) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish this card from your Graveyard to activate 1 of these effects; ● Increase the Levels of all "Mermail" monsters you currently control by 1. ● Increase the Levels of all "Mermail" monsters you currently control by 2.
--水精鱗-アビスマンダー --Mermail Abyssmander local s,id=GetID() function s.initial_effect(c) --lvup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) end s.listed_series={SET_MERMAIL} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_MERMAIL) and c:HasLevel() end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end local opt=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2)) e:SetLabel(opt) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local opt=e:GetLabel() local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) 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_UPDATE_LEVEL) e1:SetValue(opt+1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only while you control an "Alien" monster. Select and take control of up to 3 of your opponent's monsters that each have an A-Counter(s) on them. This card is destroyed during the End Phase of the turn it is activated.
--集団催眠 --Mass Hypnosis local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_ALIEN} s.counter_list={COUNTER_A} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_ALIEN),tp,LOCATION_MZONE,0,1,nil) end function s.filter(c) return c:GetCounter(COUNTER_A)>0 and c:IsControlerCanBeChanged() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE,1-tp,LOCATION_REASON_CONTROL) if ft>3 then ft=3 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,ft,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if #g>Duel.GetLocationCount(tp,LOCATION_MZONE) then return end local tc=g:GetFirst() for tc in aux.Next(g) do if tc:IsFaceup() and tc:GetCounter(COUNTER_A)>0 and tc:IsRelateToEffect(e) then c:SetCardTarget(tc) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_CONTROL) e1:SetValue(tp) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) e1:SetCondition(s.con) tc:RegisterEffect(e1) end end c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.con(e) local c=e:GetOwner() local h=e:GetHandler() return c:IsHasCardTarget(h) and not c:IsDisabled() and h:GetCounter(COUNTER_A)>0 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Standby Phase: Special Summon 1 "Slime Token" (Aqua/WATER/Level 1/ATK 500/DEF 500) in Attack Position. You cannot Summon any monsters, except "Slime Tokens" (but you can Set).
--スライム増殖炉 --Jam Breeding Machine local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --special summon token local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --summon limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetTargetRange(1,0) e3:SetTarget(s.sumlimit) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_SZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EFFECT_CANNOT_SUMMON) e4:SetTargetRange(1,0) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_CANNOT_FLIP_SUMMON) c:RegisterEffect(e5) end s.listed_names={TOKEN_SLIME} function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsCode(TOKEN_SLIME) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_SLIME,0x54b,TYPES_TOKEN,500,500,1,RACE_AQUA,ATTRIBUTE_WATER) then local token=Duel.CreateToken(tp,TOKEN_SLIME) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] You can discard 1 card; add 1 face-up Dragon Pendulum Monster from your Extra Deck to your hand. You can only use this effect of "Odd-Eyes Phantasma Dragon" once per turn. ---------------------------------------- [ Monster Effect ] If you have 2 cards in your Pendulum Zones and a face-up "Odd-Eyes" Pendulum Monster in your Extra Deck: You can Special Summon this card from your hand. You cannot Pendulum Summon the turn you activate this effect. During damage calculation, if this card attacks an opponent's monster: You can make that opponent's monster lose 1000 ATK for each face-up Pendulum Monster in your Extra Deck, during damage calculation only. You can only use each effect of "Odd-Eyes Phantasma Dragon" once per turn.
--オッドアイズ・ファンタズマ・ドラゴン --Odd-Eyes Phantasma Dragon --scripted by Naim local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --special summon from 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,1}) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --atk up local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_ODD_EYES} function s.counterfilter(c) return not c:IsPendulumSummoned() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.thfilter(c) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.exfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ODD_EYES) and c:IsType(TYPE_PENDULUM) 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_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,3)) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTarget(s.splimit) e1:SetTargetRange(1,0) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return sumtype & SUMMON_TYPE_PENDULUM==SUMMON_TYPE_PENDULUM 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) and Duel.IsExistingMatchingCard(s.exfilter,tp,LOCATION_EXTRA,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local d=c:GetBattleTarget() local gc=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_EXTRA,0,nil) return c==Duel.GetAttacker() and d and d:IsFaceup() and not d:IsControler(tp) and gc>0 end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttacker():GetBattleTarget() local gc=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_EXTRA,0,nil) if d:IsRelateToBattle() and d:IsFaceup() then 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(-gc*1000) d:RegisterEffect(e1) 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 Tributing 1 "Flower Cardian" monster, except "Flower Cardian Maple with Deer". If this card is Special Summoned: Draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, you can destroy 1 Spell/Trap Card your opponent controls. Otherwise, send it to the Graveyard.
--花札衛-紅葉に鹿- --Flower Cardian Maple with Deer local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Must first be Special Summoned (from your hand) by Tributing 1 "Flower Cardian" monster, except "Flower Cardian Maple with Deer" local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_HAND) e0:SetCondition(s.selfspcon) e0:SetTarget(s.selfsptg) e0:SetOperation(s.selfspop) c:RegisterEffect(e0) --Draw 1 card, and if you do, show it, then, if it is a "Flower Cardian" monster, you can destroy 1 Spell/Trap Card your opponent controls local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_DESTROY+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) end s.listed_series={SET_FLOWER_CARDIAN} s.listed_names={id} function s.selfspfilter(c) return c:IsSetCard(SET_FLOWER_CARDIAN) and not c:IsCode(id) end function s.selfspcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.CheckReleaseGroup(tp,s.selfspfilter,1,false,1,true,c,tp,nil,false,nil) end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local g=Duel.SelectReleaseGroup(tp,s.selfspfilter,1,1,false,true,true,c,nil,nil,false,nil) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.selfspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST) g:DeleteGroup() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,1-tp,LOCATION_ONFIELD) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)>0 then local dc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,dc) if dc:IsSetCard(SET_FLOWER_CARDIAN) and dc:IsMonster() then if Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end end else Duel.BreakEffect() Duel.SendtoGrave(dc,REASON_EFFECT) end Duel.ShuffleHand(tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains 300 ATK and DEF for each "Lightsworn" monster with a different name in your Graveyard. If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent. During each of your End Phases: Send the top 3 cards of your Deck to the Graveyard.
--ライトロード・ドラゴン グラゴニス --Gragonith, Lightsworn Dragon local s,id=GetID() function s.initial_effect(c) --atk def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.value) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetValue(s.value) c:RegisterEffect(e2) --pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) --discard deck local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DECKDES) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.discon) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end s.listed_series={SET_LIGHTSWORN} function s.filter(c) return c:IsSetCard(SET_LIGHTSWORN) and c:IsMonster() end function s.value(e,c) local g=Duel.GetMatchingGroup(s.filter,c:GetControler(),LOCATION_GRAVE,0,nil) local ct=g:GetClassCount(Card.GetCode) return ct*300 end function s.discon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,3) end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,3,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can equip 1 "Inzektor" monster from your hand or GY to this card. If an Equip Card(s) is sent to your GY while equipped to this card (except during the Damage Step): You can add 1 "Inzektor" card from your Deck to your hand. While this card is equipped to a monster, that monster's Level is increased by 3.
--甲虫装機 センチピード --Inzektor Centipede 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:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e1) --equip effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_LEVEL) e2:SetValue(3) c:RegisterEffect(e2) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.shcon) e3:SetTarget(s.shtg) e3:SetOperation(s.shop) c:RegisterEffect(e3) end s.listed_series={SET_INZEKTOR} function s.eqval(ec,c,tp) return ec:IsControler(tp) and ec:IsSetCard(SET_INZEKTOR) end function s.filter(c) return c:IsSetCard(SET_INZEKTOR) and c:IsMonster() and not c:IsForbidden() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_GRAVE|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 then return end if c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then s.equipop(c,e,tp,tc) end end function s.cfilter(c,ec,tp) return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) and c:GetEquipTarget()==ec end function s.shcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,e:GetHandler(),tp) end function s.tgfilter(c) return c:IsSetCard(SET_INZEKTOR) and c:IsAbleToHand() end function s.shtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.shop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.tgfilter,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 Normal or Special Summoned: You can halve this card's ATK, and if you do, Special Summon 1 "Clock Token" (Cyberse/WIND/Level 1/ATK 0/DEF 0). You can only use this effect of "Clock Wyvern" once per turn.
--クロック・ワイバーン --Clock Wyvern --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --token local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.tktg) e1:SetOperation(s.tkop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_names={21830680} function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_WIND) end local c=e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,tp,c:GetAttack()/2) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(c:GetAttack()/2) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) if not c:IsImmuneToEffect(e1) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_WIND) then local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish 3 "Gagaga" monsters from your Graveyard; draw 2 cards.
--ガガガドロー --Gagagadraw local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GAGAGA} function s.filter(c) return c:IsSetCard(SET_GAGAGA) and c:IsMonster() and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,3,3,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect, is activated while you control a face-up non-Effect Monster: Negate the activation. If this Set card you control is destroyed by your opponent's card effect: You can Special Summon 1 non-Effect Monster from your Extra Deck.
--天威無双の拳 --Fists of the Unrivaled Tenyi --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.negcon) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Special summon 1 non-Effect 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:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsNonEffectMonster),tp,LOCATION_MZONE,0,1,nil) then return false end return Duel.IsChainNegatable(ev) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsType(TYPE_EFFECT) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Turn: Target 2 Spell Cards in your Graveyard; shuffle those targets into the Deck.
--隠された魔導書 --Hidden Spellbook local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.filter(c) return c:IsSpell() and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Level 4 or lower Warrior monster is Normal Summoned to your field: Special Summon this card as a Normal Monster with the same name and Level as the Normal Summoned monster (Warrior/LIGHT/ATK 0/DEF 0). (This card is also still a Trap.)
--コピー・ナイト --Copy Knight 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_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() return ep==tp and ec:IsLevelBelow(4) and ec:IsRace(RACE_WARRIOR) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local ec=eg:GetFirst() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,ec:GetCode(),0,TYPE_MONSTER|TYPE_NORMAL,0,0,ec:GetLevel(),RACE_WARRIOR,ATTRIBUTE_LIGHT) end ec:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() if not ec:IsRelateToEffect(e) then return end local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,ec:GetCode(),0,TYPE_MONSTER|TYPE_NORMAL,0,0,ec:GetLevel(),RACE_WARRIOR,ATTRIBUTE_LIGHT) then return end c:AddMonsterAttribute(TYPE_NORMAL|TYPE_TRAP,0,0,ec:GetLevel(),0,0) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() --change code local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(ec:GetCode()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster your opponent controls; banish 1 monster from your Deck or Extra Deck with the same original Type, Attribute, and Level/Rank/Link Rating, and if you do, take control of that targeted monster, and if you banished a monster with the same original name, that monster's effects are negated. You can only activate 1 "Abduction" per turn.
--アブダクション --Abduction --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Banish 1 monster from your Deck or Extra Deck and take control of opponent's monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) end function s.ctfilter(c,tp) if not (c:IsFaceup() and c:IsAbleToChangeControler()) then return false end local original_lvrklnk=(c:HasLevel() and c:GetOriginalLevel()) or (c:HasRank() and c:GetOriginalRank()) or (c:IsLinkMonster() and c:GetLink()) return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil,c:GetOriginalRace(),c:GetOriginalAttribute(),c,original_lvrklnk) end function s.rmfilter(c,race,attr,tc,lvrklnk) return c:IsAbleToRemove() and c:IsOriginalRace(race) and c:IsOriginalAttribute(attr) and ((tc:HasLevel() and c:IsOriginalLevel(lvrklnk)) or (tc:HasRank() and c:IsOriginalRank(lvrklnk)) or (tc:IsLinkMonster() and c:IsLink(lvrklnk))) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_CONTROL)>0 and Duel.IsExistingTarget(s.ctfilter,tp,0,LOCATION_MZONE,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.ctfilter,tp,0,LOCATION_MZONE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end local original_lvrklnk=(tc:HasLevel() and tc:GetOriginalLevel()) or (tc:HasRank() and tc:GetOriginalRank()) or (tc:IsLinkMonster() and tc:GetLink()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil,tc:GetOriginalRace(),tc:GetOriginalAttribute(),tc,original_lvrklnk):GetFirst() if rc and Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)>0 and rc:IsLocation(LOCATION_REMOVED) and Duel.GetControl(tc,tp) and rc:IsOriginalCodeRule(tc:GetOriginalCodeRule()) then tc:NegateEffects(e:GetHandler(),RESET_CONTROL) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 monsters, including a "Maliss" monster (Quick Effect): You can target 1 of your banished "Maliss" cards; shuffle it into the Deck, and if you do, banish 1 card on the field (while this card points to a monster, this effect and its activation cannot be negated). If this card is banished: You can pay 900 LP; Special Summon it and double its ATK. You can only use each effect of "Maliss <Q> Hearts Crypter" once per turn.
--M∀LICE<Q>HEARTS OF CRYPTER --Maliss <Q> Hearts Crypter --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 3 monsters, including a "Maliss" monster Link.AddProcedure(c,nil,3,3,s.lcheck) --Shuffle 1 of your banished "Maliss" monsters into the Deck, and if you do, banish 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetLabel(id) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --The activation and effect of e1 cannot be negated if the handler points to a monster aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD) ge1:SetCode(EFFECT_CANNOT_INACTIVATE) ge1:SetValue(s.inactfilter) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EFFECT_CANNOT_DISEFFECT) Duel.RegisterEffect(ge2,0) end) --Special Summon this card and double its ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_REMOVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.PayLP(900)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_MALISS} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsSetCard,1,nil,SET_MALISS,lc,sumtype,tp) end function s.tdfilter(c) return c:IsSetCard(SET_MALISS) and c:IsFaceup() and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) and Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,PLAYER_EITHER,LOCATION_ONFIELD) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end end function s.inactfilter(e,ct) local te=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT) return te:GetLabel()==id and te:GetHandler():GetLinkedGroupCount()>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then --Its ATK becomes doubled local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(c:GetAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1,true) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Level 10 monsters When a monster is destroyed by battle and sent to the GY: You can detach 1 material from this card, then target that monster; Special Summon it to your field in Defense Position. You can target 1 other face-up Special Summoned monster you control; gain LP equal to its original ATK. You can only use each effect of "Number XX: Utopic Dark Infinity" once per turn.
--No.XX インフィニティ・ダークホープ --Number XX: Utopic Dark Infinity --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,nil,10,2,nil,nil,Xyz.InfiniteMats) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --recover local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_RECOVER) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.rectg) e2:SetOperation(s.recop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) and c:IsCanBeEffectTarget(e) 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 eg:IsContains(chkc) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and eg:IsExists(s.spfilter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=eg:FilterSelect(tp,s.spfilter,1,1,nil,e,tp) Duel.SetTargetCard(g) 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_DEFENSE) end end function s.filter(c) return c:IsFaceup() and c:IsSpecialSummoned() and c:GetBaseAttack()>0 end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,g:GetFirst():GetBaseAttack()) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:GetAttack()>0 then Duel.Recover(tp,tc:GetBaseAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you Normal or Special Summon a non-Token Normal Monster(s) (except during the Damage Step): You can draw 1 card. When an attack is declared involving an opponent's monster and a monster you control that is a Level 5 or higher Normal Monster, or was Ritual Summoned using a Normal Monster, or was Fusion, Synchro, or Xyz Summoned using a Normal Monster as material: You can make that monster you control gain ATK equal to that opponent's monster's ATK, until the end of this turn. You can only use each effect of "Piercing the Darkness" once per turn.
--切り裂かれし闇 --Piercing the Darkness --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Increase ATK local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_ATKCHANGE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_ATTACK_ANNOUNCE) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.atkcon) e4:SetOperation(s.atkop) c:RegisterEffect(e4) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD) ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE) ge1:SetCode(EFFECT_MATERIAL_CHECK) ge1:SetValue(s.valcheck) Duel.RegisterEffect(ge1,0) end) end function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsType,1,nil,TYPE_NORMAL) then c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD),0,1) end end function s.drcfilter(c,tp) return c:IsType(TYPE_NORMAL) and not c:IsType(TYPE_TOKEN) and c:IsSummonPlayer(tp) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.drcfilter,1,nil,tp) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.atkfilter(c) if c:IsType(TYPE_NORMAL) then return c:IsLevelAbove(5) else local summon_types={SUMMON_TYPE_RITUAL,SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ} return c:GetFlagEffect(id)>0 and c:IsSummonType(table.unpack(summon_types)) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=a:GetBattleTarget() if a:IsControler(1-tp) then a,d=d,a end return a and a:IsFaceup() and a:IsRelateToBattle() and s.atkfilter(a) and d and d:IsFaceup() and d:IsRelateToBattle() and d:IsAttackAbove(0) and a:GetControler()~=d:GetControler() end function s.atkop(e,tp,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local a=Duel.GetAttacker() local d=a:GetBattleTarget() if a:IsControler(1-tp) then a,d=d,a end if a and a:IsFaceup() and a:IsRelateToBattle() and d and d:IsFaceup() and d:IsRelateToBattle() then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(d:GetAttack()) e1:SetReset(RESETS_STANDARD_PHASE_END) a:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 Synchro Monster you control. You do not take any damage until the End Phase of the next turn.
--シンクロ・バリアー --Synchro Barrier local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsType,1,false,nil,nil,TYPE_SYNCHRO) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsType,1,1,false,nil,nil,TYPE_SYNCHRO) Duel.Release(g,REASON_COST) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(0) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_NO_EFFECT_DAMAGE) e2:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e3:SetDescription(aux.Stringid(id,1)) e3:SetReset(RESET_PHASE|PHASE_END,2) e3:SetTargetRange(1,0) Duel.RegisterEffect(e3,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 "Therion" card from your Deck to the GY. If this card is in your GY: You can target 1 "Therion" card in your GY; if both are still in your GY, add either that card or this card to your hand, and if you do, place the other on the bottom of your Deck. You can only use 1 "Endless Engine Argyro System" effect per turn, and only once that turn.
--無尽機関アルギロ・システム --Endless Engine Argyro System --Scripted by Eerie Code 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:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand/deck local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_THERION} function s.tgfilter(c) return c:IsSetCard(SET_THERION) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local 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.thfilter(c,hc) if not c:IsSetCard(SET_THERION) then return false end return (c:IsAbleToHand() and hc:IsAbleToDeck()) or (c:IsAbleToDeck() and hc:IsAbleToHand()) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc,c) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,c) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not (c:IsRelateToEffect(e) and tc:IsRelateToEffect(e)) then return end local g=Group.FromCards(c,tc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local hg=g:FilterSelect(tp,Card.IsAbleToHand,1,1,nil) if #hg>0 and Duel.SendtoHand(hg,nil,REASON_EFFECT)>0 and hg:GetFirst():IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,hg) Duel.SendtoDeck(g-hg,nil,LOCATION_DECKBOT,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters Special Summoned from the Extra Deck While this Link Summoned card is on the field, your opponent cannot target this card with card effects, also their monsters cannot target monsters for attacks, except this one. Once per battle, during damage calculation, if this card battles a Special Summoned monster (Quick Effect): You can make this card gain ATK equal to that opponent's monster's ATK during that damage calculation only. If this Link Summoned card you control is sent to your GY by your opponent: You can shuffle 1 card on the field into the Deck. * The above text is unofficial and describes the card's functionality in the OCG.
--双穹の騎士アストラム --Mekk-Knight Crusadia Avramax --scripted by andré local s,id=GetID() function s.initial_effect(c) --revive limit c:EnableReviveLimit() --link summon Link.AddProcedure(c,s.mfilter,2) --cannot be effect 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_EFFECT_TARGET) e1:SetCondition(s.condition) e1:SetValue(aux.tgoval) c:RegisterEffect(e1) --cannot target monster for attack except this one local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.condition) e2:SetValue(s.csbtv) c:RegisterEffect(e2) --gain attack from special summoned card local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.atkcon) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) --shuffle 1 card on field to deck local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_TODECK) e4:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_TO_GRAVE) e4:SetCondition(s.tdcondition) e4:SetTarget(s.tdtarget) e4:SetOperation(s.tdoperation) c:RegisterEffect(e4) end function s.condition(e) return e:GetHandler():IsLinkSummoned() end function s.mfilter(c) return c:IsSpecialSummoned() and c:IsSummonLocation(LOCATION_EXTRA) end function s.csbtv(e,c) return e:GetHandler()~=c end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsSpecialSummoned() and bc:IsControler(1-tp) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL,0,1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if c:IsRelateToBattle() and c:IsFaceup() and bc:IsRelateToBattle() and bc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(bc:GetAttack()) c:RegisterEffect(e1) end end function s.tdcondition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:IsLinkSummoned() and rp==1-tp end function s.tdtarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,0,0) end function s.tdoperation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card battles a Fiend or Zombie-Type monster, destroy that monster at the end of the Damage Step.
--月風魔 --Getsu Fuhma local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local t=e:GetHandler():GetBattleTarget() e:SetLabelObject(t) return t and t:IsRace(RACE_FIEND|RACE_ZOMBIE) and t:IsRelateToBattle() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetLabelObject(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsRelateToBattle() then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 Monster Card and 2 non-Monster Cards from your hand. Your opponent randomly selects 1 card among them. If it is a Monster Card, it is Special Summoned and send the remaining 2 cards to the Graveyard. If not, send all the cards to the Graveyard.
--選ばれし者 --Chosen One local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end 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) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_HAND,0,2,e:GetHandler()) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g1=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) local g2=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,LOCATION_HAND,0,nil) if #g1==0 or #g2<2 then return end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local sg1=g1:Select(tp,1,1,nil) local sc=sg1:GetFirst() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local sg2=g2:Select(tp,2,2,nil) sg1:Merge(sg2) Duel.ConfirmCards(1-tp,sg1) Duel.ShuffleHand(tp) local rg=sg1:Select(1-tp,1,1,nil) local tc=rg:GetFirst() if tc:IsCanBeSpecialSummoned(e,0,tp,false,false) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) Duel.SendtoGrave(sg2,REASON_EFFECT) else Duel.SendtoGrave(sg1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can add 1 "World Chalice" monster from your Deck to your hand. If this card is in your GY: You can send 1 monster from your hand or field to the GY; add this card to your hand. You can only use each effect of "Lee the World Chalice Fairy" once per turn.
--星杯の妖精リース --Lee the World Chalice Fairy 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_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg1) e1:SetOperation(s.thop1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCost(s.thcost2) e3:SetTarget(s.thtg2) e3:SetOperation(s.thop2) c:RegisterEffect(e3) end s.listed_series={SET_WORLD_CHALICE} function s.thfilter(c) return c:IsSetCard(SET_WORLD_CHALICE) and c:IsMonster() and c:IsAbleToHand() end function s.thtg1(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.thop1(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.thcfilter(c) return c:IsMonster() and c:IsAbleToGraveAsCost() end function s.thcost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thcfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.thcfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.thtg2(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) end function s.thop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 card from your hand to the Graveyard; equip this card to a monster. It loses 500 ATK, but it can make a second attack during each Battle Phase.
--閃光の双剣-トライス --Twin Swords of Flashing Light - Tryce local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,nil,nil,s.cost) --Atk down local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(-500) c:RegisterEffect(e2) --Double Attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_EXTRA_ATTACK) e3:SetValue(1) c:RegisterEffect(e3) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,1,1,REASON_COST) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Plant monsters If this card is Link Summoned: You can choose a number from 1 to 3 and excavate that many cards from the top of your Deck, and if you do, you can Special Summon up to 2 excavated Plant monsters, but they cannot be used as Link Material, also send the remaining cards to the GY. You can target 1 Plant monster in your GY that has a Level; the Levels of monsters this card points to become that monster's Level, until the end of this turn. You can only use each effect of "Sylvan Dancepione" once per turn.
--森羅の舞踏娘-ピオネ --Sylvan Dancepione --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Link Summon procedure c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_PLANT),2,2) --Excavate and Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Change Level local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLinkSummoned() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_DECKDES,nil,2,tp,3) end function s.spfilter(c,e,tp) return c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end local ct=math.min(3,Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)) if ct==0 then return end local t={} for i=1,ct do t[i]=i end Duel.Hint(HINTMSG_NUMBER,tp,HINT_NUMBER) local ac=Duel.AnnounceNumber(tp,table.unpack(t)) Duel.ConfirmDecktop(tp,ac) local g=Duel.GetDecktopGroup(tp,ac) local pg=g:Filter(s.spfilter,nil,e,tp) local ft=math.min(Duel.GetLocationCount(tp,LOCATION_MZONE),2) Duel.DisableShuffleCheck() if ft>0 and #pg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=pg:Select(tp,1,ft,nil) if #sg==0 then return end local c=e:GetHandler() for sc in sg:Iter() do if Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then --Cannot be used as Link Material local e1=Effect.CreateEffect(c) e1:SetDescription(3312) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1,true) g:RemoveCard(sc) end end Duel.SpecialSummonComplete() end Duel.SendtoGrave(g,REASON_EFFECT|REASON_EXCAVATE) end function s.lvfilter(c,lg) return c:IsRace(RACE_PLANT) and c:HasLevel() and lg:IsExists(aux.NOT(Card.IsLevel),1,nil,c:GetLevel()) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local lg=e:GetHandler():GetLinkedGroup():Match(aux.AND(Card.IsFaceup,Card.HasLevel),nil) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.lvfilter(chkc,lg) end if chk==0 then return #lg>0 and Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_GRAVE,0,1,nil,lg) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_GRAVE,0,1,1,nil,lg) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local lg=c:GetLinkedGroup():Match(aux.AND(Card.IsFaceup,Card.HasLevel),nil) if #lg==0 then return end local lv=tc:GetLevel() for lc in lg:Iter() do --Change Level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESETS_STANDARD_PHASE_END) lc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Inflict 1000 damage to the player who destroyed this Set card.
--コザッキーの自爆装置 --Kozaky's Self-Destruct Button 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_DESTROYED) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_SZONE) and e:GetHandler():IsPreviousPosition(POS_FACEDOWN) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(rp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,rp,1000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters If this card is Synchro Summoned: Increase or decrease this card's Level by the Level the Tuner used as material had on the field. This card gains ATK equal to its Level x 400. If this Synchro Summoned card is sent to the GY as Synchro Material: Inflict damage to your opponent equal to the new Synchro Summoned monster's Level x 100, and if you do, you can add 1 Level 8 or lower monster with 600 DEF from your Deck to your hand. You can only use this effect of "Cupid Pitch" once per turn.
--ルイ・キューピット --Cupid Pitch --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.NonTuner(nil),1,99) --Check the Tuner material's Level local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_MATERIAL_CHECK) e0:SetLabel(0) e0:SetValue(s.valcheck) e0:SetOperation(s.matop) c:RegisterEffect(e0) --Increase or decrease this card's Level local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetLabelObject(e0) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetOperation(s.lvop) c:RegisterEffect(e1) --Gains ATK equal to its Level x 400 local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetValue(function(_,c) return c:GetLevel()*400 end) c:RegisterEffect(e2) --Inflict damage and search 1 Level 8 or lower monster with 600 DEF local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DAMAGE+CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BE_MATERIAL) e3:SetCountLimit(1,id) e3:SetCondition(s.damcon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.puretuner(c,sc,tp) return not c:IsHasEffect(EFFECT_NONTUNER) and c:IsType(TYPE_TUNER,sc,SUMMON_TYPE_SYNCHRO|MATERIAL_SYNCHRO,tp) end function s.othertuner(c,sc,tp) return (c:IsHasEffect(EFFECT_NONTUNER) and c:IsType(TYPE_TUNER,sc,SUMMON_TYPE_SYNCHRO|MATERIAL_SYNCHRO,tp)) or c:IsHasEffect(EFFECT_CAN_BE_TUNER) end function s.valcheck(e,c) local mg=c:GetMaterial() if #mg==0 then return e:SetLabel(0) end local tp=e:GetHandlerPlayer() local pure_tuner_g=mg:Filter(s.puretuner,nil,c,tp) if #pure_tuner_g>0 then e:SetLabelObject(nil) e:SetLabel(pure_tuner_g:GetFirst():GetSynchroLevel(c)) return end local other_tuner_g=mg:Filter(s.othertuner,nil,c,tp) if #other_tuner_g>1 then e:SetLabelObject(other_tuner_g) else e:SetLabelObject(nil) e:SetLabel(other_tuner_g:GetFirst():GetSynchroLevel(c)) end end function s.matop(e,c) local g=e:GetLabelObject() if not g then return end local tp=e:GetHandlerPlayer() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,5)) local tuner=g:Select(tp,1,1,nil):GetFirst() Duel.HintSelection(tuner,true) e:SetLabel(tuner:GetSynchroLevel(c)) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local lv=e:GetLabelObject():GetLabel() if lv==0 then return end local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local opt=Duel.SelectOption(tp,aux.Stringid(id,2),aux.Stringid(id,3)) --Increase or decrease this card's Level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) if opt==0 then e1:SetValue(lv) else e1:SetValue(-lv) end e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSynchroSummoned() and c:IsLocation(LOCATION_GRAVE) and r&REASON_SYNCHRO>0 end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local sc=e:GetHandler():GetReasonCard() Duel.SetTargetCard(sc) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,sc:GetLevel()*100) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c) return c:IsLevelBelow(8) and c:IsDefense(600) and c:IsAbleToHand() end function s.damop(e,tp,eg,ep,ev,re,r,rp) local sc=Duel.GetFirstTarget() if not (sc:IsRelateToEffect(e) and sc:IsFaceup()) then return end if Duel.Damage(1-tp,sc:GetLevel()*100,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,4)) then 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 return end 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 "Heroic" monster you control is targeted for an attack: Target another Level 4 or lower "Heroic" monster you control; double its ATK during this Battle Phase, then change the attack target to it and proceed to damage calculation, but monsters cannot be destroyed by this battle.
--ヒロイック・アドバンス --Heroic Advance local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_HEROIC} function s.condition(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return d:IsFaceup() and d:IsControler(tp) and d:IsSetCard(SET_HEROIC) end function s.filter(c) return c:IsFaceup() and c:IsLevelBelow(4) and c:IsSetCard(SET_HEROIC) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,Duel.GetAttackTarget()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,Duel.GetAttackTarget()) Duel.GetAttacker():CreateEffectRelation(e) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and a:CanAttack() and a:IsRelateToEffect(e) and not a:IsImmuneToEffect(e)then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) tc:RegisterEffect(e2) local e3=e2:Clone() a:RegisterEffect(e3) Duel.CalculateDamage(a,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Sparkman" + "Elemental HERO Clayman" Must be Special Summoned with "Dark Fusion". Once per turn: You can target 1 monster on the field; destroy that target.
--E-HERO ライトニング・ゴーレム --Evil HERO Lightning Golem local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion material Fusion.AddProcMix(c,true,true,20721928,84327329) --lizard check local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(CARD_CLOCK_LIZARD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCondition(s.lizcon) e0:SetValue(1) c:RegisterEffect(e0) --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.EvilHeroLimit) c:RegisterEffect(e1) --Destroy 1 monster on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} s.dark_calling=true s.listed_names={CARD_DARK_FUSION,20721928,84327329} function s.lizcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),EFFECT_SUPREME_CASTLE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If "Performapal Ladyange" is in your other Pendulum Zone and you control no monsters, or only Pendulum Monsters: You can add 1 "Odd-Eyes" card from your Deck to your hand. You can only use this effect of "Performapal Gentrude" once per turn. ---------------------------------------- [ Monster Effect ] If this card is destroyed: You can place 1 "Performapal" Pendulum Monster from your Deck in your Pendulum Zone, except "Performapal Gentrude". If this card is face-up in your Extra Deck: You can discard 1 Pendulum Monster; add this card to your hand, then you can return 1 "Performapal" or "Odd-Eyes" card from your Pendulum Zone to the hand. You can only use 1 "Performapal Gentrude" effect per turn, and only once that turn.
--EMジェントルード --Performapal Gentrude --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCost(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Place in Pendulum Zone local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.pentg) e2:SetOperation(s.penop) c:RegisterEffect(e2) --Add to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_EXTRA) e3:SetCountLimit(1,{id,1}) e3:SetCost(s.rthcost) e3:SetTarget(s.rthtg) e3:SetOperation(s.rthop) c:RegisterEffect(e3) end s.listed_names={id,58938528} s.listed_series={SET_PERFORMAPAL,SET_ODD_EYES} function s.thconfilter(c) return c:IsFacedown() or not c:IsType(TYPE_PENDULUM) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_PZONE,0,1,e:GetHandler(),58938528) and not Duel.IsExistingMatchingCard(s.thconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.thfilter(c) return c:IsSetCard(SET_ODD_EYES) 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) if not e:GetHandler():IsRelateToEffect(e) then return end 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.penfilter(c) return c:IsSetCard(SET_PERFORMAPAL) and c:IsType(TYPE_PENDULUM) and not c:IsCode(id) and not c:IsForbidden() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) and Duel.IsExistingMatchingCard(s.penfilter,tp,LOCATION_DECK,0,1,nil) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local pg=Duel.SelectMatchingCard(tp,s.penfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if pg then Duel.MoveToField(pg,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end function s.rthcostfilter(c) return c:IsDiscardable() and c:IsType(TYPE_PENDULUM) end function s.rthcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rthcostfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.rthcostfilter,1,1,REASON_COST|REASON_DISCARD) end function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) end function s.rthfilter(c) return (c:IsSetCard(SET_PERFORMAPAL) or c:IsSetCard(SET_ODD_EYES)) and c:IsAbleToHand() end function s.rthop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)>0 and c:IsLocation(LOCATION_HAND) and Duel.IsExistingMatchingCard(s.rthfilter,tp,LOCATION_PZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local rg=Duel.SelectMatchingCard(tp,s.rthfilter,tp,LOCATION_PZONE,0,1,1,nil) if #rg>0 then Duel.BreakEffect() Duel.HintSelection(rg,true) Duel.SendtoHand(rg,nil,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 2 other WATER monsters to the GY; Special Summon this card from your hand. When Summoned this way: You can add 1 "Abyss-" Spell/Trap from your Deck to your hand. You can Tribute 1 other Attack Position WATER monster; this card can make a second attack during each Battle Phase this turn.
--水精鱗-メガロアビス --Mermail Abyssmegalo local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --If summoned this way, add 1 "Abyss-" spell/trap from deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Make it be able to make a second attack local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.atkcon) e3:SetCost(s.atkcost) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_ABYSS} function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsDiscardable() and c:IsAbleToGraveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.DiscardHand(tp,s.cfilter,2,2,REASON_COST|REASON_DISCARD,e:GetHandler()) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.thfilter(c) return c:IsSetCard(SET_ABYSS) and c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.rfilter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAttribute(ATTRIBUTE_WATER) end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.rfilter,1,false,nil,e:GetHandler()) end local g=Duel.SelectReleaseGroupCost(tp,s.rfilter,1,1,false,nil,e:GetHandler()) Duel.Release(g,REASON_COST) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetEffectCount(EFFECT_EXTRA_ATTACK)==0 end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then --Can make a second attack local e1=Effect.CreateEffect(c) e1:SetDescription(3201) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can send 1 Fiend or Zombie Ritual Monster from your hand or Deck to the GY, then you can add 1 Ritual Spell from your Deck to your hand. If this card is banished: You can target 1 of your banished Level 4 or lower Fiend or Zombie monsters; Special Summon it. You can only use each effect of "Dark Necromancer" once per turn.
--大屍教 --Dark Necromancer --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Send 1 Fiend or Zombie Ritual Monster from your hand or Deck to the GY, then you can add 1 Ritual Spell from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon 1 of your banished Level 4 or lower Fiend or Zombie monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.tgfilter(c) return c:IsRace(RACE_FIEND|RACE_ZOMBIE) and c:IsRitualMonster() and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c) return c:IsRitualSpell() and c:IsAbleToHand() end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tg=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil) if #tg>0 and Duel.SendtoGrave(tg,REASON_EFFECT)>0 and tg:GetFirst():IsLocation(LOCATION_GRAVE) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then 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 return end Duel.BreakEffect() Duel.SendtoHand(g,tp,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spfilter(c,e,tp) return c:IsRace(RACE_FIEND|RACE_ZOMBIE) and c:IsLevelBelow(4) and c:IsFaceup() 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_REMOVED) 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_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] All Normal Monsters gain 200 ATK. You take no battle damage from battles involving Normal Monsters you control. ---------------------------------------- [ Flavor Text ] The horns were needed to prepare a medicine for her village, suffering from a plague. Unknown to her, the dragons burned and trampled her village, once displaced from their den.
--竜角の狩猟者 --Dragon Horn Hunter local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_PZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.efilter) e2:SetValue(200) c:RegisterEffect(e2) --avoid battle damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetRange(LOCATION_PZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(s.efilter) e3:SetValue(1) c:RegisterEffect(e3) end function s.efilter(e,c) return c:IsType(TYPE_NORMAL) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 face-up "Inzektor" monster you control; equip this card from your hand to that target. While this card is equipped to a monster, that monster's original DEF becomes 2600. If this card is sent to the Graveyard while equipped to a monster: You can target 1 "Inzektor" monster in your Graveyard; Special Summon that target. This effect of "Inzektor Giga-Weevil" can only be used once per turn.
--甲虫装機 ギガウィービル --Inzektor Giga-Weevil 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) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) --equip effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(2600) 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_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,id) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_INZEKTOR} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_INZEKTOR) 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 local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:IsFacedown() or not tc:IsRelateToEffect(e) or not tc:IsControler(tp) then Duel.SendtoGrave(c,REASON_EFFECT) return end Duel.Equip(tp,c,tc,true) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) end function s.eqlimit(e,c) return c==e:GetLabelObject() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetPreviousLocation()==LOCATION_SZONE and not c:IsReason(REASON_LOST_TARGET) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_INZEKTOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Remove Spell Counters from your field to activate 1 of these effects. ● 2: Return 1 "Mythical Beast" Pendulum Monster you control to the hand. ● 4: Special Summon 1 face-up "Mythical Beast" Pendulum Monster from your Extra Deck, then you can place 2 Spell Counters on it. ● 6: Special Summon 1 face-up Pendulum Monster from your Extra Deck. You can only activate 1 "Beast Magic Attack" per turn.
--獣・魔・導 --Beast Magic Attack --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetLabel(2) e1:SetCost(s.cost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --spsummon (mythical) local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetLabel(4) e2:SetTarget(s.sptg1) e2:SetOperation(s.spop1) c:RegisterEffect(e2) --spsummon (generic) local e3=e2:Clone() e3:SetDescription(aux.Stringid(id,2)) e3:SetLabel(6) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end s.counter_place_list={COUNTER_SPELL} s.listed_series={SET_MYTHICAL_BEAST} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetLabel() if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,COUNTER_SPELL,ct,REASON_COST) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.RemoveCounter(tp,1,0,COUNTER_SPELL,ct,REASON_COST) end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MYTHICAL_BEAST) and c:IsType(TYPE_PENDULUM) 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_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,0,tp,LOCATION_MZONE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_MZONE,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end function s.spfilter1(c,e,tp,rp) return c:IsFaceup() and c:IsSetCard(SET_MYTHICAL_BEAST) and c:IsType(TYPE_PENDULUM) and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,rp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rp):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then if tc:IsCanAddCounter(COUNTER_SPELL,2) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then tc:AddCounter(COUNTER_SPELL,2) end end end function s.spfilter2(c,e,tp,rp) return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,rp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rp):GetFirst() if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase: You can activate 1 of these effects; ● Target 1 Level 7 LIGHT Dragon monster you control; return it to the hand. ● Special Summon 1 Level 7 LIGHT Dragon monster from your hand. You can only use this effect of "Starry Knight Arrival" once per turn.
--聖夜の降臨 --Starry Knight Arrival --Scripted by DyXel local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_MAIN_END) c:RegisterEffect(e1) --Return to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetHintTiming(TIMING_MAIN_END) e2:SetCondition(function()return Duel.IsMainPhase()end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Special Summon from hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id) e3:SetHintTiming(TIMING_MAIN_END) e3:SetCondition(function()return Duel.IsMainPhase()end) e3:SetTarget(s.sstg) e3:SetOperation(s.ssop) c:RegisterEffect(e3) end function s.ldlv7filter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsLevel(7) end function s.thfilter(c) return s.ldlv7filter(c) and c:IsFaceup() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local tg=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,tg,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) Duel.ConfirmCards(1-tp,tc) end end function s.ssfilter(c,e,tp) return s.ldlv7filter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.ssfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.ssop(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.ssfilter,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:
If your opponent controls a monster that was Special Summoned from the Extra Deck and you control no monsters, you can Special Summon this card (from your hand). You can discard 1 card; Special Summon 1 "Cipher" monster from your hand or Deck, also you cannot Special Summon monsters for the rest of this turn, except "Cipher" monsters. You can only use this effect of "Cipher Twin Raptor" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--光波双顎機 --Cipher Twin Raptor local s,id=GetID() function s.initial_effect(c) --special summon rule local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.sprcon) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_CIPHER} function s.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.IsExistingMatchingCard(aux.FilterEqualFunction(Card.GetSummonLocation,LOCATION_EXTRA),tp,0,LOCATION_MZONE,1,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end function s.costfilter(c,e,tp) return c:IsDiscardable() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,c,e,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_CIPHER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end if e:GetLabel()~=0 then e:SetLabel(0) return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil,e,tp) else return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end end if e:GetLabel()~=0 then e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.SendtoGrave(g,REASON_COST|REASON_DISCARD) 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 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 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetCode(EFFECT_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) return not c:IsSetCard(SET_CIPHER) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Starry Knight" monster, or 1 Level 7 LIGHT Dragon monster, from your Deck to your hand, then, if you control no monsters and your opponent controls a DARK monster, you can Special Summon 1 Level 7 LIGHT Dragon monster from your hand. You can only activate 1 "Starry Knight Balefire" per turn.
--聖なる篝火 --Starry Knight Balefire --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --dd 1 "Starry Knight" monster, or 1 Level 7 LIGHT Dragon monster, from your Deck to your hand, then, if you control no monsters and your opponent controls a DARK monster, you can Special Summon 1 Level 7 LIGHT Dragon monster from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_STARRY_KNIGHT} function s.lv7lightdragonfilter(c) return c:IsLevel(7) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) end function s.thfilter(c) return (c:IsSetCard(SET_STARRY_KNIGHT) or s.lv7lightdragonfilter(c)) 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_HAND) end function s.spfilter(c,e,tp) return s.lv7lightdragonfilter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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 or Duel.SendtoHand(g,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_DARK),tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Tribute Summoned by Tributing a "Steelswarm" monster: You can pay 1000 Life Points to target up to 2 cards your opponent controls; return those targets to the hand.
--インヴェルズ・モース --Steelswarm Moth 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_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --tribute check local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_MATERIAL_CHECK) e2:SetValue(s.valcheck) e2:SetLabelObject(e1) c:RegisterEffect(e2) end s.listed_series={SET_STEELSWARM} function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsSetCard,1,nil,SET_STEELSWARM) then e:GetLabelObject():SetLabel(1) else e:GetLabelObject():SetLabel(0) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsTributeSummoned() and e:GetLabel()==1 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) Duel.SendtoHand(tg,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains 200 ATK for each Predator Counter on the field. When this card destroys an opponent's monster by battle: You can equip that monster to this card. Once per turn: You can target 1 Monster Card equipped to this card by this card's effect; destroy it, and if you do, gain LP equal to its original ATK.
--捕食植物モーレイ・ネペンテス --Predaplant Moray Nepenthes local s,id=GetID() function s.initial_effect(c) --Gains 200 ATK for each Predator Counter on the field local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(function(e,c) return Duel.GetCounter(0,1,1,COUNTER_PREDATOR)*200 end) c:RegisterEffect(e1) --Equip an opponent's monster that was destroyed by battle with this card to this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(aux.bdocon) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) aux.AddEREquipLimit(c,nil,aux.FilterBoolFunction(Card.IsMonster),function(c,e,tp,bc) c:EquipByEffectAndLimitRegister(e,tp,bc,id) end,e2) --Destroy 1 Monster Card equipped to this card by this card's effect and gain LP equal to its ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_RECOVER) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.counter_list={COUNTER_PREDATOR} function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and bc:IsMonster() and bc:IsFaceup() end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_EQUIP,bc,1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetFirstTarget() if bc:IsRelateToEffect(e) and bc:IsMonster() and bc:IsFaceup() then e:GetHandler():EquipByEffectAndLimitRegister(e,tp,bc,id) end end function s.desfilter(c,ec) return c:HasFlagEffect(id) and c:GetEquipTarget()==ec and c:IsMonsterCard() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsControler(tp) and s.desfilter(chkc,c) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_SZONE,0,1,nil,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_SZONE,0,1,1,nil,c) local atk=g:GetFirst():GetTextAttack() Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) if atk>0 then Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,atk) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.Recover(tp,tc:GetTextAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster you control is destroyed by battle and sent to the GY: Special Summon 1 Level 4 or lower "Elemental HERO" monster from your hand or Deck.
--ヒーロー・シグナル --Hero Signal 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_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_ELEMENTAL_HERO} function s.cfilter(c,tp) return c:IsReason(REASON_BATTLE) and c:IsLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg and eg:IsExists(s.cfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsSetCard(SET_ELEMENTAL_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Altergeist" Link Monster in your GY; Special Summon it. You can banish this card from your GY; immediately after this effect resolves, Normal Summon 1 "Altergeist" monster. You can only use 1 "Altergeist Revitalization" effect per turn, and only once that turn.
--オルターガイスト・リバイタリゼーション --Altergeist Revitalization --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Altergeist" Link monster from the GY 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) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Normal Summon 1 "Altergeist" monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.nstg) e2:SetOperation(s.nsop) c:RegisterEffect(e2) end s.listed_series={SET_ALTERGEIST} function s.spfilter(c,e,tp) return c:IsSetCard(SET_ALTERGEIST) and c:IsLinkMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.nsfilter(c) return c:IsSetCard(SET_ALTERGEIST) and c:IsSummonable(true,nil) end function s.nstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_MZONE) end function s.nsop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) if #g>0 then Duel.Summon(tp,g:GetFirst(),true,nil) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While your LP is lower than your opponent's, the equipped monster's ATK becomes double its original ATK. While your LP is higher, the equipped monster's ATK becomes half its original ATK.
--巨大化 --Megamorph local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Atk Change local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_SET_ATTACK) e2:SetCondition(s.condition) e2:SetValue(s.value) c:RegisterEffect(e2) end function s.condition(e) return Duel.GetLP(0)~=Duel.GetLP(1) end function s.value(e,c) local p=e:GetHandler():GetControler() if Duel.GetLP(p)<Duel.GetLP(1-p) then return c:GetBaseAttack()*2 elseif Duel.GetLP(p)>Duel.GetLP(1-p) then return c:GetBaseAttack()/2 end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: Your opponent can reveal 1 monster in their hand to negate this card's effect, otherwise destroy the attacking monster, then end the Battle Phase.
--バトル・ブレイク --Battle Break local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local tg=Duel.GetAttacker() if chk==0 then return tg:IsOnField() end Duel.SetTargetCard(tg) if Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)==0 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,0,0) end end function s.cfilter(c) return not c:IsPublic() and c:IsMonster() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsChainDisablable(0) then local sel=1 local g=Duel.GetMatchingGroup(s.cfilter,1-tp,LOCATION_HAND,0,nil) Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(id,0)) if #g>0 then sel=Duel.SelectOption(1-tp,1213,1214) else sel=Duel.SelectOption(1-tp,1214)+1 end if sel==0 then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONFIRM) local cg=g:Select(1-tp,1,1,nil) Duel.ConfirmCards(tp,cg) Duel.ShuffleHand(1-tp) Duel.NegateEffect(0) return end end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:CanAttack() and not tc:IsStatus(STATUS_ATTACK_CANCELED) and Duel.Destroy(tc,REASON_EFFECT)>0 then Duel.SkipPhase(1-tp,PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 "Vampire Lord" from your Monster Zone. Once per turn: You can discard 1 Zombie monster to the GY, then target 1 Zombie monster in your GY with a Level less than the discarded Zombie monster's; Special Summon that target. * The above text is unofficial and describes the card's functionality in the OCG.
--ヴァンパイアジェネシス --Vampire Genesis local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:AddMustBeSpecialSummoned() --Must be Special Summoned (from your hand) by banishing 1 "Vampire Lord" from your Monster Zone local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.selfspcon) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Special Summon 1 Zombie monster from your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.gysptg) e2:SetOperation(s.gyspop) c:RegisterEffect(e2) end s.listed_names={53839837} --"Vampire Lord" function s.selfspconfilter(c) return c:IsCode(53839837) and c:IsFaceup() and c:IsAbleToRemoveAsCost() end function s.selfspcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(s.selfspconfilter,tp,LOCATION_MZONE,0,nil) return #g>0 and Duel.GetMZoneCount(tp,g)>0 end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.selfspconfilter,tp,LOCATION_MZONE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.selfspop(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.gyspcostfilter(c,e,tp) return c:IsRace(RACE_ZOMBIE) and c:IsDiscardable() and Duel.IsExistingTarget(s.gyspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetLevel()-1) end function s.gyspfilter(c,e,tp,lv) return c:IsRace(RACE_ZOMBIE) and c:IsLevelBetween(1,lv) 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,e:GetLabel()) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.gyspcostfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local dc=Duel.SelectMatchingCard(tp,s.gyspcostfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp):GetFirst() Duel.SendtoGrave(dc,REASON_COST|REASON_DISCARD) local lv=dc:GetLevel()-1 e:SetLabel(lv) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectTarget(tp,s.gyspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,lv) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Elemental HERO" monster + 1 LIGHT monster Must be Fusion Summoned and cannot be Special Summoned by other ways. This card gains 300 ATK for each of your banished "Elemental HERO" monsters. When this card is sent from the field to the Graveyard: You can target up to 2 of your banished "Elemental HERO" monsters; add those targets to your hand.
--E・HERO The シャイニング --Elemental HERO The Shining local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_ELEMENTAL_HERO),aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT)) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --atkup local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(s.atkup) c:RegisterEffect(e3) --spsummon condition local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetCode(EFFECT_SPSUMMON_CONDITION) e4:SetValue(aux.fuslimit) c:RegisterEffect(e4) end s.listed_series={SET_ELEMENTAL_HERO} s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} function s.atkup(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_ELEMENTAL_HERO),c:GetControler(),LOCATION_REMOVED,0,nil)*300 end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return (e:GetHandler():GetPreviousLocation()&LOCATION_ONFIELD)>0 end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_ELEMENTAL_HERO) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoHand(sg,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn, during your Main Phase: You can place 1 Venemy Counter on each face-up monster your opponent controls. All monsters on the field, except DARK Dragon monsters, lose 200 ATK for each Venemy Counter on the field. ---------------------------------------- [ Monster Effect ] 3 DARK Pendulum Monsters Each time a card(s) is sent from the field to the GY, place 1 Venemy Counter on this card for each sent card. All monsters on the field, except DARK Dragon monsters, lose 200 ATK for each Venemy Counter on the field. Once per turn, during your Main Phase: You can negate the effects of all face-up monsters your opponent currently controls, until the end of this turn. If this card in the Monster Zone is destroyed by battle or card effect: You can place this card in your Pendulum Zone.
--スターヴ・ヴェネミー・リーサルドーズ・ドラゴン --Starving Venemy Lethal Dose Dragon --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Pendulum.AddProcedure(c,false) Fusion.AddProcMixN(c,true,true,s.ffilter,3) --place counter (pendulum) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetTarget(s.ctg) e1:SetOperation(s.cop) c:RegisterEffect(e1) --place counter (monster) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.acop) c:RegisterEffect(e2) --atkdown local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_PZONE|LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(s.atktg) e3:SetValue(s.atkval) c:RegisterEffect(e3) --negate local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DISABLE) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) --place in pendulum zone local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_DESTROYED) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetCondition(s.pencon) e5:SetTarget(s.pentg) e5:SetOperation(s.penop) c:RegisterEffect(e5) end s.counter_list={0x1149} function s.ffilter(c,fc,sumtype,tp) return c:IsAttribute(ATTRIBUTE_DARK,fc,sumtype,tp) and c:IsType(TYPE_PENDULUM,fc,sumtype,tp) end function s.ctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function s.cop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) for tc in aux.Next(g) do tc:AddCounter(0x1149,1) end end function s.acop(e,tp,eg,ep,ev,re,r,rp) local ct=eg:FilterCount(Card.IsPreviousLocation,nil,LOCATION_ONFIELD) if ct>0 then e:GetHandler():AddCounter(0x1149,ct) end end function s.atktg(e,c) return not (c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON)) end function s.atkval(e,c) return Duel.GetCounter(0,1,1,0x1149)*-200 end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() local c=e:GetHandler() for tc in aux.Next(g) do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return 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:
Cannot be Normal Summoned/Set. Must be Special Summoned by its own effect. You can target 4 Fusion, Synchro, Xyz, and/or Link Monsters in the GYs; Special Summon this card from your hand, and if you do, banish them. At the start of the Damage Step, if this card battles a Special Summoned monster: Destroy all your opponent's Attack Position monsters, then inflict 800 damage to your opponent for each Fusion, Synchro, Xyz, and Link Monster destroyed by this effect.
--教導枢機テトラドラグマ --Dogmatika Nexus --Scripted by Eerie Code local s,id=GetID() local TYPE_FULL=TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ+TYPE_LINK local TYPE_ARRAY={TYPE_FUSION,TYPE_SYNCHRO,TYPE_XYZ,TYPE_LINK } function s.initial_effect(c) c:EnableReviveLimit() --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(0) c:RegisterEffect(e1) --Special summon itsef from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_HAND) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Destroy monsters and inflict damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_START) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.rmfilter(c,e) return c:IsMonster() and c:IsType(TYPE_FULL) and c:IsAbleToRemove() and c:IsCanBeEffectTarget(e) end function s.spcheck(sg,e,tp,mg) if #sg<4 then return false end for _,ty in ipairs(TYPE_ARRAY) do if not sg:IsExists(Card.IsType,1,nil,ty) then return false end end return true end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local c=e:GetHandler() local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and #g>=4 end --aux.SelectUnselectGroup(g,e,tp,4,4,s.spcheck,0) end local tg=g:Select(tp,4,4,nil) --aux.SelectUnselectGroup(g,e,tp,4,4,s.spcheck,1,tp,HINTMSG_REMOVE) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,tg,4,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tg=Duel.GetTargetCards(e) if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 and #tg>0 then c:CompleteProcedure() Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsSpecialSummoned() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) if #g>0 and Duel.Destroy(g,REASON_EFFECT)~=0 then local ct=Duel.GetOperatedGroup():FilterCount(Card.IsType,nil,TYPE_FULL) if ct>0 then Duel.BreakEffect() Duel.Damage(1-tp,ct*800,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: You can discard 1 WATER monster to the Graveyard, then target 1 Level 3 or lower WATER monster in your Graveyard; add that target to your hand. You can only use the effect of "Mermail Abyssturge" once per turn.
--水精鱗-アビスタージ --Mermail Abyssturge local s,id=GetID() function s.initial_effect(c) --salvage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsDiscardable() and c:IsAbleToGraveAsCost() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 "Amazoness" monster in your GY; Special Summon it in Attack Position, but it cannot change its battle position and must attack, if able. When this card leaves the field, destroy that monster. When that monster is destroyed, destroy this card.
--アマゾネスの意地 --Amazoness Willpower local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Destroy2 local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCondition(s.descon2) e3:SetOperation(s.desop2) c:RegisterEffect(e3) end s.listed_series={SET_AMAZONESS} function s.filter(c,e,tp) return c:IsSetCard(SET_AMAZONESS) 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.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) then c:SetCardTarget(tc) Duel.SpecialSummonComplete() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetCondition(s.cpcon) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_MUST_ATTACK) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetCondition(s.cpcon) tc:RegisterEffect(e2) end end function s.cpcon(e) return e:GetOwner():IsHasCardTarget(e:GetHandler()) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function s.descon2(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY) end function s.desop2(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay half your LP, then Tribute 1 monster; Special Summon 1 "The Winged Dragon of Ra" from your hand or banishment, ignoring its Summoning conditions, and make its ATK/DEF 4000, but it cannot attack, also during the End Phase of the next turn, return it to the hand. If this card is sent from the field to the GY: Choose 1 "The Winged Dragon of Ra" in your Monster Zone and send all other monsters on the field to the GY. You can only use each effect of "Dangers of the Divine" once per turn.
--神の怒り --Dangers of the Divine --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "The Winged Dragon of Ra" from your hand or banishment, ignoring its Summoning conditions local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCost(Cost.AND(Cost.PayLP(1/2),s.cost)) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Choose 1 "The Winged Dragon of Ra" in your Monster Zone and send all other monsters on the field to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_names={CARD_RA} function s.spcostfilter(c,tp) return Duel.GetMZoneCount(tp,c)>0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.spcostfilter,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.spcostfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCode(CARD_RA) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_REMOVED) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_MZONE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_REMOVED,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,true,false,POS_FACEUP) then local turn_count=Duel.GetTurnCount() --Make its ATK/DEF 4000 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(4000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE) sc:RegisterEffect(e2) --It cannot attack local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_ATTACK) sc:RegisterEffect(e3) --Return it to the hand during the End Phase of the next turn aux.DelayedOperation(sc,PHASE_END,id,e,tp, function(ag) Duel.SendtoHand(ag,nil,REASON_EFFECT) end, function() return Duel.GetTurnCount()==turn_count+1 end, nil,2,aux.Stringid(id,2) ) end Duel.SpecialSummonComplete() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,PLAYER_ALL,LOCATION_MZONE) end function s.selfilter(c) return c:IsCode(CARD_RA) and c:IsFaceup() and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,0,LOCATION_MZONE,LOCATION_MZONE,1,c) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) local g=Duel.SelectMatchingCard(tp,s.selfilter,tp,LOCATION_MZONE,0,1,1,nil) if #g>0 then Duel.HintSelection(g) local og=Duel.GetMatchingGroup(Card.IsAbleToGrave,tp,LOCATION_MZONE,LOCATION_MZONE,g) if #og>0 then Duel.SendtoGrave(og,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 face-up monster you control; if it attacks a Defense Position monster this turn, inflict piercing battle damage to your opponent.
--EMスパイク・イーグル --Performapal Spikeagle local s,id=GetID() function s.initial_effect(c) --Targeted monster inflicts piercing damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.filter(c) return c:IsFaceup() and not c:IsHasEffect(EFFECT_PIERCE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() 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.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Inflict piercing damage local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3208) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PIERCE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish 1 Equip Spell from your field or GY; Special Summon this card from your hand. At the start of the Damage Step, if this card attacks: You can equip 1 face-up monster on the field to this card (max. 1) as an Equip Spell that gives this card 500 ATK. When a monster effect is activated (Quick Effect): You can send 1 face-up Equip Card you control to the GY; negate the activation, and if you do, destroy it. You can only use each effect of "Immortal Phoenix Gearfried" once per turn.
--ゴッドフェニックス・ギア・フリード --Immortal Phoenix Gearfried --Scripted by Logical Nonsense and AlphaKretin --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon from hand by banishing 1 equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Equip 1 face-up monster on field to this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_START) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.eqcon) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) aux.AddEREquipLimit(c,s.eqcon,function(ec,_,tp) return ec:IsControler(1-tp) end,s.equipop,e2) --Send equip to negate monster effect local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetCondition(s.ngcon) e3:SetCost(s.ngcost) e3:SetTarget(s.ngtg) e3:SetOperation(s.ngop) c:RegisterEffect(e3) end --Check for equip spell to banish function s.spfilter(c,tp) return c:IsAbleToRemoveAsCost() and c:IsEquipSpell() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) end --Cost of banishing from field/GY function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_SZONE|LOCATION_GRAVE,0,1,nil,tp) end e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_SZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end --Special summon from hand function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetHandler():GetEquipGroup():Filter(Card.HasFlagEffect,nil,id) return Duel.GetAttacker()==e:GetHandler() and #g==0 end function s.eqfilter(c,tp) return c:IsFaceup() and (c:IsControler(tp) or c:IsAbleToChangeControler()) and c:CheckUniqueOnField(tp) and not c:IsForbidden() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler(),tp) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,0,0) end function s.equipop(c,e,tp,tc) if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(500) tc:RegisterEffect(e1) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_SZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local tc=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c,tp):GetFirst() if tc then s.equipop(c,e,tp,tc) end end --Monster effect is activated, and this card isn't about to die function s.ngcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsMonsterEffect() and Duel.IsChainNegatable(ev) end --Check for equip spell function s.ngfilter(c) return c:IsFaceup() and c:IsType(TYPE_EQUIP) and c:IsAbleToGraveAsCost() end --Cost of sending equip to GY function s.ngcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.ngfilter,tp,LOCATION_SZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.ngfilter,tp,LOCATION_SZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.ngtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end --Negate the activation of monster effect and destroy it function s.ngop(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:
Must be Special Summoned with "Mask Change" and cannot be Special Summoned by other ways. Cannot be destroyed by battle. Your opponent can attack with only 1 monster during each Battle Phase. When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can draw 1 card.
--M・HERO カミカゼ --Masked HERO Divine Wind local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --battle indestructable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) c:RegisterEffect(e2) --cannot attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCondition(s.atkcon) e3:SetTarget(s.atktg) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_ATTACK_ANNOUNCE) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetOperation(s.checkop) e4:SetLabelObject(e3) c:RegisterEffect(e4) --draw local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetCategory(CATEGORY_DRAW) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e5:SetCode(EVENT_BATTLE_DESTROYING) e5:SetCondition(aux.bdogcon) e5:SetTarget(s.drtg) e5:SetOperation(s.drop) c:RegisterEffect(e5) end function s.atkcon(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.atktg(e,c) return c:GetFieldID()~=e:GetLabel() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():GetFlagEffect(id)~=0 then return end local fid=eg:GetFirst():GetFieldID() e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) e:GetLabelObject():SetLabel(fid) 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:
2 Level 7 monsters Once per turn: You can detach 1 material from this card; Special Summon 2 "Mecha Phantom Beast Tokens" (Machine/WIND/Level 3/ATK 0/DEF 0). While you control a Token, this card cannot be destroyed by battle or card effects. Once per turn: You can Tribute 1 "Mecha Phantom Beast" monster, then target 1 card on the field; destroy that target. This card cannot attack during the turn you activate this effect.
--幻獣機ドラゴサック --Mecha Phantom Beast Dracossack local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz Summon Procedure Xyz.AddProcedure(c,nil,7,2) --Cannot be destroyed by battle or card effect while you control a Token local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetCondition(s.indcon) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2) --Special Summon 2 "Mecha Phantom Beast" Tokens local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCost(Cost.DetachFromSelf(1,1,nil)) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --Destroy 1 card on the field local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCountLimit(1) e4:SetCost(s.descost) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_names={TOKEN_MECHA_PHANTOM_BEAST} s.listed_series={SET_MECHA_PHANTOM_BEAST} function s.tknfilter(c) return c:IsType(TYPE_TOKEN) or c:IsOriginalType(TYPE_TOKEN) end function s.indcon(e) return Duel.IsExistingMatchingCard(s.tknfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) 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.IsPlayerCanSpecialSummonMonster(tp,TOKEN_MECHA_PHANTOM_BEAST,SET_MECHA_PHANTOM_BEAST,TYPES_TOKEN,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_MECHA_PHANTOM_BEAST,SET_MECHA_PHANTOM_BEAST,TYPES_TOKEN,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) then local token1=Duel.CreateToken(tp,TOKEN_MECHA_PHANTOM_BEAST_DRACOSSACK) Duel.SpecialSummonStep(token1,0,tp,tp,false,false,POS_FACEUP) local token2=Duel.CreateToken(tp,TOKEN_MECHA_PHANTOM_BEAST_DRACOSSACK) Duel.SpecialSummonStep(token2,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonComplete() end end function s.descfilter(c) return c:IsSetCard(SET_MECHA_PHANTOM_BEAST) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e) if chk==0 then return c:GetAttackAnnouncedCount()==0 and Duel.CheckReleaseGroupCost(tp,s.descfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.descfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) --Cannot attack this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)>1 and Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Shuffle 2 WATER monsters from your hand into the Deck, then draw 3 cards.
--強欲なウツボ --Moray of Greed local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,3) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local g=Duel.GetMatchingGroup(s.filter,p,LOCATION_HAND,0,nil) if #g>=2 then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK) local sg=g:Select(p,2,2,nil) Duel.ConfirmCards(1-p,sg) Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) Duel.ShuffleDeck(p) Duel.BreakEffect() Duel.Draw(p,3,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Effect Monsters, including a Pendulum Monster If this card is Link Summoned in the Extra Monster Zone: You can pay 1200 LP; add 1 Pendulum Monster from your Deck to your hand, but for the rest of this turn, unless you Pendulum Summon after this effect resolves, you cannot activate monster effects, and the effects of any cards in your Pendulum Zones are negated. If 2 monsters with different original Levels are Pendulum Summoned at the same time to the zones this card points to: You can target 2 cards on the field; destroy them. You can only use this effect of "Beyond the Pendulum" once per turn.
--軌跡の魔術師 --Beyond the Pendulum --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --2 Effect Monsters, including a Pendulum Monster Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,2,s.lcheck) --Search 1 Pendulum Monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.thcon) e1:SetCost(Cost.PayLP(1200)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Destroy 2 cards local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_PENDULUM,lc,sumtype,tp) end function s.thcon(e) local c=e:GetHandler() return c:IsLinkSummoned() and c:IsInExtraMZone() end function s.thfilter(c) return c:IsType(TYPE_PENDULUM) 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 local c=e:GetHandler() --Cannot activate monster effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(function(_,re) return re:IsMonsterEffect() end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Pendulum effects are negated local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetTargetRange(LOCATION_PZONE,0) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) --Remove restrictions on Pendulum Summon local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e0:SetCode(EVENT_SPSUMMON_SUCCESS) e0:SetLabelObject({e1,e2}) e0:SetOperation(s.checkop) e0:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e0,tp) end function s.psfilter(c,tp) return c:IsSummonPlayer(tp) and c:IsPendulumSummoned() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local ef=e:GetLabelObject() if ef and eg and eg:IsExists(s.psfilter,1,nil,tp) then ef[1]:Reset() ef[2]:Reset() e:Reset() end end function s.pendfilter(c,tp) return c:IsSummonPlayer(tp) and c:IsPendulumSummoned() and c:HasLevel() end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if eg:IsContains(c) then return false end local lg=aux.zptgroup(eg,nil,c):Match(s.pendfilter,nil,tp) return lg:GetClassCount(Card.GetOriginalLevel)>1 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is flipped face-up: You can target 1 card in your opponent's GY; place that target on the bottom of their Deck. If this card is sent from the field to the GY after being flipped face-up: You can target 1 "Necrovalley" card in your GY; add that target to your hand. These effects are unaffected by "Necrovalley".
--墓守の伏兵 --Gravekeeper's Ambusher local s,id=GetID() function s.initial_effect(c) --return to deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FLIP) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_FLIP) e2:SetOperation(s.flipop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --immune to necro valley local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_NECRO_VALLEY_IM) c:RegisterEffect(e4) end s.listed_series={SET_NECROVALLEY} function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end function s.flipop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD|RESET_OVERLAY)&~(RESET_LEAVE|RESET_TOGRAVE),0,0) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.filter(c) return c:IsSetCard(SET_NECROVALLEY) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) 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 Tributing 1 opponent's monster with a Predator Counter. If this card is sent from the field to the GY: Place 1 Predator Counter on each face-up monster your opponent controls, and if you do, any of those monsters that are Level 2 or higher become Level 1 as long as they have a Predator Counter.
--捕食植物バンクシアオーガ --Predaplant Banksiogre local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --counter local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_COUNTER) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.ccon) e2:SetOperation(s.cop) c:RegisterEffect(e2) end s.counter_place_list={COUNTER_PREDATOR} function s.rfilter(c,tp) return c:GetCounter(COUNTER_PREDATOR)>0 and c:IsControler(1-tp) end function s.hspcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.CheckReleaseGroup(tp,s.rfilter,1,false,1,true,c,tp,nil,true,nil,tp) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,s.rfilter,1,1,false,true,true,c,nil,nil,true,nil,tp) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false 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) g:DeleteGroup() end function s.ccon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.cop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) for tc in aux.Next(g) do tc:AddCounter(COUNTER_PREDATOR,1) if tc:GetLevel()>1 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetCondition(s.lvcon) e1:SetValue(1) tc:RegisterEffect(e1) end end end function s.lvcon(e) return e:GetHandler():GetCounter(COUNTER_PREDATOR)>0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a "Destiny HERO" monster. At the end of the Damage Step, if the equipped monster attacked: Target 1 Spell/Trap Card on the field; destroy that target.
--旋風剣 --Cyclone Blade local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,s.filter) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCategory(CATEGORY_DESTROY) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_series={SET_DESTINY_HERO} function s.filter(c) return c:IsSetCard(SET_DESTINY_HERO) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker()==e:GetHandler():GetEquipTarget() end function s.desfilter(c) return c:IsSpellTrap() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.desfilter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 "Trickstar" monster in your GY; Special Summon it and equip it with this card. When this card leaves the field, destroy that monster. Once per turn, if the equipped monster inflicts battle or effect damage to your opponent: You can Special Summon 1 "Trickstar" monster from your hand. You can only activate 1 "Trickstar Magical Laurel" per turn.
--トリックスター・マジカローラ --Trickstar Magical Laurel 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.operation) c:RegisterEffect(e1) --Register before leaving the field 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) --Destroy 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) --Special summon from hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_DAMAGE) e4:SetRange(LOCATION_SZONE) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCountLimit(1) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_TRICKSTAR} function s.spfilter(c,e,tp) return c:IsSetCard(SET_TRICKSTAR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then Duel.Equip(tp,c,tc) --Add Equip limit local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) c:RegisterEffect(e1) end Duel.SpecialSummonComplete() end function s.eqlimit(e,c) return e:GetOwner()==c end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local cet=e:GetHandler():GetEquipTarget() return ep~=tp and ((eg and eg:GetFirst()==cet) or (re and re:GetHandler()==cet)) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Avian" + "Elemental HERO Burstinatrix" Must be Special Summoned with "Dark Fusion". If this card attacks a Defense Position monster, inflict piercing battle damage. If this card destroys a monster by battle and sends it to the GY: Inflict damage to your opponent equal to the original ATK or DEF (whichever is higher) of that monster in the GY.
--E-HERO インフェルノ・ウィング --Evil HERO Inferno Wing local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion materials Fusion.AddProcMix(c,true,true,58932615,21844576) --lizard check local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(CARD_CLOCK_LIZARD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCondition(s.lizcon) e0:SetValue(1) c:RegisterEffect(e0) --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.EvilHeroLimit) c:RegisterEffect(e1) --Inflict damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(aux.bdgcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --Piercing damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} s.dark_calling=true s.listed_names={CARD_DARK_FUSION,58932615,21844576} function s.lizcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),EFFECT_SUPREME_CASTLE) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() local bc=c:GetBattleTarget() local dam=bc:GetAttack() if bc:GetAttack() < bc:GetDefense() then dam=bc:GetDefense() end if dam<0 then dam=0 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the Graveyard, you can pay 800 Life Points to add 1 Psychic-Type monster from your Deck to your hand.
--カバリスト --Doctor Cranium local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetCost(Cost.PayLP(800)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return c:IsRace(RACE_PSYCHIC) 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:
While your LP is higher than your opponent's, face-up monsters your opponent controls lose 500 ATK and DEF. Once per turn, if you gain LP: Target 1 Spell/Trap Card your opponent controls; return it to the hand.
--アロマージ-カナンガ --Aromage Cananga local s,id=GetID() function s.initial_effect(c) --atk & def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetCondition(s.adcon) e1:SetValue(-500) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_RECOVER) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end function s.adcon(e) local tp=e:GetHandlerPlayer() return Duel.GetLP(tp)>Duel.GetLP(1-tp) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return ep==tp end function s.thfilter(c) return c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and s.thfilter(chkc) end if chk==0 then return ep==tp and e:GetHandler():IsRelateToEffect(e) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each of your opponent's monsters in the same column as one of your "S-Force" monsters can only target monsters in that column for attacks. (Quick Effect): You can banish 1 "S-Force" card from your hand; return this card to the hand, and if you do, Special Summon 1 "S-Force" monster from your Deck in Defense Position, except "S-Force Rappa Chiyomaru". You can only use this effect of "S-Force Rappa Chiyomaru" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--S-Force 乱破小夜丸 --S-Force Rappa Chiyomaru --Scripted by edo9300 local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "S-Force" monster from deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_SUMMON|TIMING_SPSUMMON) e1:SetCountLimit(1,id) e1:SetCost(aux.SForceCost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Limit the attacks of monsters in the same column as your "S-Force" monsters local e2a=Effect.CreateEffect(c) e2a:SetType(EFFECT_TYPE_SINGLE) e2a:SetRange(LOCATION_MZONE) e2a:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE) e2a:SetValue(s.atlimit) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e2:SetRange(LOCATION_MZONE) e2:SetLabelObject(e2a) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetTarget(aux.SForceTarget) c:RegisterEffect(e2) end s.listed_series={SET_S_FORCE} s.listed_names={id} function s.atlimit(e,c) return not e:GetHandler():GetColumnGroup():IsContains(c) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_S_FORCE) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)>0 and c:IsLocation(LOCATION_HAND) 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_DEFENSE) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 Link Monster on the field; move it to a Main Monster Zone it points to on its controller's field. Once per turn: You can switch the locations of 2 Link Monsters in your Main Monster Zones or 2 Link Monsters in your opponent's Main Monster Zones.
--キャッスル・リンク --Castle Link 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) --move local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetTarget(s.seqtg) e2:SetOperation(s.seqop) c:RegisterEffect(e2) --change local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetTarget(s.chtg) e3:SetOperation(s.chop) c:RegisterEffect(e3) end function s.filter(c) if not c:IsLinkMonster() then return false end local p=c:GetControler() local zone=c:GetLinkedZone()&ZONES_MMZ return Duel.GetLocationCount(p,LOCATION_MZONE,p,LOCATION_REASON_CONTROL,zone)>0 end function s.seqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.seqop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if not tc or not tc:IsRelateToEffect(e) then return end local p=tc:GetControler() local zone=tc:GetLinkedZone()&ZONES_MMZ if Duel.GetLocationCount(p,LOCATION_MZONE,p,LOCATION_REASON_CONTROL,zone)>0 then local i=0 if not tc:IsControler(tp) then i=16 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) local nseq=math.log(Duel.SelectDisableField(tp,1,LOCATION_MZONE,LOCATION_MZONE,~(zone<<i)),2) - i Duel.MoveSequence(tc,nseq) end end function s.chfilter1(c) return c:IsLinkMonster() and c:GetSequence()<5 and Duel.IsExistingMatchingCard(s.chfilter2,c:GetControler(),LOCATION_MZONE,0,1,c) end function s.chfilter2(c) return c:IsLinkMonster() and c:GetSequence()<5 end function s.chtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.chfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function s.chop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g1=Duel.SelectMatchingCard(tp,s.chfilter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) local tc1=g1:GetFirst() if not tc1 then return end Duel.HintSelection(g1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g2=Duel.SelectMatchingCard(tp,s.chfilter2,tc1:GetControler(),LOCATION_MZONE,0,1,1,tc1) Duel.HintSelection(g2) local tc2=g2:GetFirst() Duel.SwapSequence(tc1,tc2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains effects based on the total number of cards in both players' Pendulum Zones. ● 1 or more: This card gains 800 ATK and DEF. ● 2 or more: At the start of the Damage Step, if this card battles a Pendulum Summoned monster: Destroy that monster. ● 3 or more: Monsters your opponent controls must attack this card, if able. ● 4: If this card destroys a monster by battle or by its own effect: Draw 1 card.
--ヒュプノシスター --Hypnosister local s,id=GetID() function s.initial_effect(c) --atk/def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(800) e1:SetCondition(s.effcon) e1:SetLabel(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_START) e3:SetCondition(s.effcon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) e3:SetLabel(2) c:RegisterEffect(e3) --must attack local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_MUST_ATTACK) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(0,LOCATION_MZONE) e4:SetCondition(s.effcon) e4:SetLabel(3) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_MUST_ATTACK_MONSTER) e5:SetValue(s.atklimit) c:RegisterEffect(e5) --draw local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,1)) e6:SetCategory(CATEGORY_DRAW) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e6:SetCode(EVENT_BATTLE_DESTROYING) e6:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e6:SetCondition(s.drcon1) e6:SetTarget(s.drtg) e6:SetOperation(s.drop) e6:SetLabel(4) c:RegisterEffect(e6) local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(id,1)) e7:SetCategory(CATEGORY_DRAW) e7:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e7:SetCode(EVENT_DESTROYED) e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e7:SetRange(LOCATION_MZONE) e7:SetCondition(s.drcon2) e7:SetTarget(s.drtg) e7:SetOperation(s.drop) e7:SetLabel(4) c:RegisterEffect(e7) end function s.effcon(e) return Duel.GetFieldGroupCount(0,LOCATION_PZONE,LOCATION_PZONE)>=e:GetLabel() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local tc=e:GetHandler():GetBattleTarget() if chk==0 then return tc and tc:IsFaceup() and tc:IsPendulumSummoned() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetBattleTarget() if tc:IsRelateToBattle() then Duel.Destroy(tc,REASON_EFFECT) end end function s.atklimit(e,c) return c==e:GetHandler() end function s.drcon1(e,tp,eg,ep,ev,re,r,rp) return s.effcon(e) and e:GetHandler():IsRelateToBattle() 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 function s.drcon2(e,tp,eg,ep,ev,re,r,rp) return s.effcon(e) and (r&REASON_EFFECT)~=0 and re:GetHandler()==e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a "Lightsworn" monster you control is targeted for an attack: You can send the top 2 cards of your Deck to the Graveyard, then target the attacking monster; negate the attack.
--ライトロード・バリア --Lightsworn Barrier 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) --quick local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetCondition(s.qcon) e2:SetCost(s.qcost) e2:SetTarget(s.qtg) e2:SetOperation(s.qop) c:RegisterEffect(e2) end s.listed_series={SET_LIGHTSWORN} function s.qcon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return d:IsFaceup() and d:IsSetCard(SET_LIGHTSWORN) and d:IsControler(tp) end function s.qcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeckAsCost(tp,2) and e:GetHandler():GetFlagEffect(id)==0 end e:GetHandler():RegisterFlagEffect(id,RESET_CHAIN,0,1) Duel.DiscardDeck(tp,2,REASON_COST) end function s.qtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=Duel.GetAttacker() if chkc then return chkc==tg end if chk==0 then return tg:IsOnField() and tg:IsCanBeEffectTarget(e) end Duel.SetTargetCard(tg) end function s.qop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.NegateAttack() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when a card on the field is destroyed by a card effect. Select 2 Spell/Trap Cards on the field and destroy them.
--連鎖旋風 --Chain Whirlwind local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_LEAVE_FIELD) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil) end function s.filter(c) return c:IsSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) Duel.Destroy(g,REASON_EFFECT) end