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:
Tribute 1 Reptile monster; for every 2 Levels that Tributed monster had on the field, Special Summon up to 1 "Ogdoadic Token" (Reptile/DARK/Level 2/ATK 0/DEF 0). During your Main Phase: You can banish this card from your GY, then target 1 of your banished Reptile monsters; shuffle it into the Deck, then you can send 1 Reptile monster from your Deck to the GY. You can only use each effect of "Ogdoadic Daybreak" once per turn.
--黎溟界闢 --Ogdoadic Daybreak --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon up to 1 "Ogdoadic Token" for every 2 Levels of the Tributed monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetCost(s.tkncost) e1:SetTarget(s.tnktg) e1:SetOperation(s.tnkop) c:RegisterEffect(e1) --Shuffle 1 banished Reptile monster into the Deck and send 1 Reptile monster from the Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOGRAVE) 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 s.listed_names={23837055} --Ogdoadic Token function s.cfilter(c,tp) return c:IsRace(RACE_REPTILE) and c:HasLevel() and c:IsLevelAbove(2) and Duel.GetMZoneCount(tp,c)>0 end function s.tkncost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(-100) if chk==0 then return true end end function s.tnktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=-100 then return false end e:SetLabel(0) return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,tp) and Duel.IsPlayerCanSpecialSummonMonster(tp,23837055,SET_OGDOADIC,TYPES_TOKEN,0,0,2,RACE_REPTILE,ATTRIBUTE_DARK) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,tp) e:SetLabel(g:GetFirst():GetLevel()//2) Duel.Release(g,REASON_COST) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) end function s.tnkop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanSpecialSummonMonster(tp,23837055,SET_OGDOADIC,TYPES_TOKEN,0,0,2,RACE_REPTILE,ATTRIBUTE_DARK) then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end ft=math.min(e:GetLabel(),ft) local ct=Duel.AnnounceNumberRange(tp,1,ft) for i=1,ct do local token=Duel.CreateToken(tp,23837055) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end function s.tdfilter(c) return c:IsFaceup() and c:IsRace(RACE_REPTILE) and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,0,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.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgfilter(c) return c:IsRace(RACE_REPTILE) and c:IsAbleToGrave() end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA)) then return end Duel.ShuffleDeck(tp) if Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then 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.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control another "Six Samurai" monster: You can Tribute 1 "Six Samurai" monster, then target 1 monster on the field; destroy that target.
--六武衆の露払い --Hand of the Six Samurai local s,id=GetID() function s.initial_effect(c) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.con) e2:SetCost(s.cost) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_SIX_SAMURAI} function s.confilter(c) return c:IsFaceup() and c:IsSetCard(SET_SIX_SAMURAI) end function s.con(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.confilter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end function s.cfilter(c) return c:IsSetCard(SET_SIX_SAMURAI) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local sg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(sg,REASON_COST) 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,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) 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:
Send 1 Normal Monster you control to the Graveyard, then target 1 monster in either player's Graveyard; Special Summon it, and if you do, equip this card to it. When this card leaves the field, destroy the equipped monster.
--戦線復活の代償 --Symbols of Duty 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCost(s.cost) 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) end function s.costfilter(c,ft,tp) return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:IsAbleToGraveAsCost() and (ft>0 or c:GetSequence()<5) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE,0,1,nil,ft,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE,0,1,1,nil,ft,tp) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsCanBeSpecialSummoned(e,0,tp,false,false) end if chk==0 then return Duel.IsExistingTarget(Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,0,tp,false,false) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.eqlimit(e,c) return e:GetOwner()==c 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) then if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end 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 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish 2 DARK monsters from your GY; add 1 Level 4 DARK monster from your Deck to your hand.
--忍び寄る闇 --Creeping Darkness local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) 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.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,2,2,nil) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.filter(c) return c:GetLevel()==4 and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] All LIGHT monsters you control gain 300 ATK. ---------------------------------------- [ Monster Effect ] Once per turn: You can target 1 face-up monster you control; this turn, it can attack all Special Summoned monsters your opponent controls, once each.
--EMカレイドスコーピオン --Performapal Kaleidoscorp 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,0) e2:SetTarget(s.atktg) e2:SetValue(300) c:RegisterEffect(e2) --attack all local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.atktg(e,c) return c:IsAttribute(ATTRIBUTE_LIGHT) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() 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(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ATTACK_ALL) e1:SetValue(s.atkfilter) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.atkfilter(e,c) return c:IsSpecialSummoned() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster you control; banish up to 5 "Swordsoul" cards and/or Wyrm monsters from your GY, and if you do, that monster gains 300 ATK for each card banished this way. If this card is banished: You can Special Summon 1 "Swordsoul Token" (Wyrm/Tuner/WATER/Level 4/ATK 0/DEF 0). While that Token is in the Monster Zone, the player who Summoned it cannot Special Summon monsters from the Extra Deck, except Synchro Monsters. You can only use each effect of "Swordsoul Assessment" once per turn.
--瑞相剣究 --Swordsoul Assessment --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Banish up to 5 cards and increase the ATK of a monster you control local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) --Special Summon 1 "Swordsoul Token" local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_REMOVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.tktg) e2:SetOperation(s.tkop) c:RegisterEffect(e2) end s.listed_names={TOKEN_SWORDSOUL} s.listed_series={SET_SWORDSOUL} function s.rmfilter(c) return (c:IsSetCard(SET_SWORDSOUL) or (c:IsMonster() and c:IsRace(RACE_WYRM))) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) end function s.atkfilter(c,g) return c:IsFaceup() and (not g:IsContains(c) or #g>1) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.atkfilter(chkc,g) end if chk==0 then return #g>0 and Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil,g) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil,g) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,tc) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local sg=g:Select(tp,1,5,tc) local rc=Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) if rc>0 and tc:IsRelateToEffect(e) and tc:IsFaceup() then --Increase ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(300*rc) tc:RegisterEffect(e1) end end end 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,TOKEN_SWORDSOUL,SET_SWORDSOUL,TYPES_TOKEN|TYPE_TUNER,0,0,4,RACE_WYRM,ATTRIBUTE_WATER) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) if s.tktg(e,tp,eg,ep,ev,re,r,rp,0) then local c=e:GetHandler() local token=Duel.CreateToken(tp,TOKEN_SWORDSOUL) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) --Cannot Special Summon non-Synchro monsters from Extra Deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetAbsoluteRange(tp,1,0) e1:SetTarget(function(_,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_SYNCHRO) end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e1,true) --Clock Lizard check local e2=aux.createContinuousLizardCheck(c,LOCATION_MZONE,function(_,c) return not c:IsOriginalType(TYPE_SYNCHRO) end) e2:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e2,true) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 Level 4 LIGHT monster you control. It is treated as a Tuner monster while it is face-up on the field.
--ライトニング・チューン --Lightwave Tuning local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:GetLevel()==4 and c:IsAttribute(ATTRIBUTE_LIGHT) and not c:IsType(TYPE_TUNER) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(TYPE_TUNER) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During Main Phase 2: Special Summon any number of Level 2 or lower monsters with different names from your hand, Deck, and/or GY to your zone(s) a Link Monster(s) points to. You can only activate 1 "Packet Link" per turn.
--パケットリンク --Packet Link local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(function() return Duel.IsPhase(PHASE_MAIN2) end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsLevelBelow(2) 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 local zone=aux.GetMMZonesPointedTo(tp) local ct=Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone) return ct>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local zone=aux.GetMMZonesPointedTo(tp) local ct=Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone) if ct<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ct=1 end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp) if #g>0 then local sg=aux.SelectUnselectGroup(g,e,tp,1,ct,dncheck,1,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP,zone) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Return 1 Flip Effect Monster from your Graveyard to the top of your Deck.
--リバースソウル --Soul Reversal local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsType(TYPE_FLIP) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 Level 3 or lower Sea Serpent monster from your Deck.
--深海のディーヴァ --Deep Sea Diva local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Level 3 or lower Sea Serpent monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spfilter(c,e,tp) return c:IsLevelBelow(3) and c:IsRace(RACE_SEASERPENT) 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.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card was Special Summoned by the effect of a "Gladiator Beast" monster, its original ATK becomes 2100. At the end of the Battle Phase, if this card attacked or was attacked: You can shuffle it into the Deck; Special Summon 1 "Gladiator Beast" monster from your Deck, except "Gladiator Beast Laquari".
--剣闘獣ラクエル --Gladiator Beast Laquari local s,id=GetID() function s.initial_effect(c) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetCondition(s.atkcon) e1:SetValue(2100) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfToDeck) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_GLADIATOR} s.listed_names={id} function s.atkcon(e) return e:GetHandler():GetFlagEffect(id)>0 end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function s.filter(c,e,tp) return not c:IsCode(id) and c:IsSetCard(SET_GLADIATOR) and c:IsCanBeSpecialSummoned(e,100,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc then Duel.SpecialSummon(tc,100,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT|RESETS_STANDARD_DISABLE,0,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: You can send 1 "Zoodiac" card from your Deck to the Graveyard. An Xyz Monster whose original Type is Beast-Warrior and has this card as Xyz Material gains this effect. ● Once per turn: You can detach 1 Xyz Material from this card; Special Summon 1 "Zoodiac Ratpier" from your hand or Deck.
--十二獣モルモラット --Zoodiac Ratpier local s,id=GetID() function s.initial_effect(c) --send to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --provide an effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_XMATERIAL+EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetCondition(s.spcon) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ZOODIAC} s.listed_names={id} function s.tgfilter(c) return c:IsSetCard(SET_ZOODIAC) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOriginalRace()==RACE_BEASTWARRIOR end function s.spfilter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|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_DECK|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:
2+ Level 4 "Noble Knight" monsters You can detach any number of materials from this card, then target that many cards your opponent controls; return them to the hand. If this card is destroyed by battle or card effect and sent to the GY: You can Special Summon 1 "Noble Knight" Xyz Monster from your Extra Deck, except "Sacred Noble Knight of King Custennin", and if you do, attach this card from the GY to that monster as material. (This is treated as an Xyz Summon.) You can only use each effect of "Sacred Noble Knight of King Custennin" once per turn.
--神聖騎士王コルネウス --Sacred Noble Knight of King Custennin --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 4 "Noble Knight" monsters Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_NOBLE_KNIGHT),4,2,nil,nil,Xyz.InfiniteMats) --Return cards your opponent controls to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(1,s.thcostmax,function(e,og) e:SetLabel(#og) end)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special Summon 1 "Noble Knight" Xyz Monster from your Extra Deck, except "Sacred Noble Knight of King Custennin" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) 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_NOBLE_KNIGHT} s.listed_names={id} function s.thfilter(c,e) return c:IsAbleToHand() and c:IsCanBeEffectTarget(e) end function s.thcostmax(e,tp) return Duel.GetMatchingGroupCount(s.thfilter,tp,0,LOCATION_ONFIELD,nil,e) 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 chkc:IsAbleToHand() end if chk==0 then return true end local ct=e:GetLabel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_NOBLE_KNIGHT) and c:IsType(TYPE_XYZ) and not c:IsCode(id) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) 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) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then sc:CompleteProcedure() if c:IsRelateToEffect(e) then Duel.Overlay(sc,c) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your opponent's turn, if this card is in your hand or GY (Quick Effect): You can target 1 "Centur-Ion" monster you control, except "Centur-Ion Emeth VI"; place it in your Spell & Trap Zone as a face-up Continuous Trap, and if you do, Special Summon this card, also you cannot Special Summon "Centur-Ion Emeth VI" for the rest of this turn. During the Main Phase, if this card is a Continuous Trap: You can Special Summon this card. You can only use each effect of "Centur-Ion Emeth VI" once per turn.
--重騎兵エメトⅥ --Centur-Ion Emeth VI --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Place 1 "Centur-Ion" monster in the Spell/Trap Zone as Continuous Trap local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) e1:SetTarget(s.pltg) e1:SetOperation(s.plop) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetCondition(function(e) return Duel.IsMainPhase() and e:GetHandler():IsContinuousTrap() end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_CENTURION} function s.plfilter(c,tp) return c:IsSetCard(SET_CENTURION) and c:IsFaceup() and not c:IsForbidden() and not c:IsCode(id) and Duel.GetMZoneCount(tp,c)>0 end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.plfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.plfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectTarget(tp,s.plfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.plop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Place the target in your S/T Zone local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 then Duel.SendtoGrave(tc,REASON_RULE,nil,PLAYER_NONE) elseif Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,tc:IsMonsterCard()) then --Treat as Continuous Trap local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_TRAP|TYPE_CONTINUOUS) e1:SetReset((RESET_EVENT|RESETS_STANDARD)&~RESET_TURN_SET) tc:RegisterEffect(e1) if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end end --Cannot Special Summon "Centur-Ion Emeth VI" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetTargetRange(1,0) e2:SetTarget(function(_,c) return c:IsCode(id) end) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) in your possession is destroyed by battle or card effect: You can Special Summon this card from your hand. If this card is sent from the field to the GY: You can target 1 monster in your GY with both the same Type and Attribute as a monster you control; add that monster to your hand. You can only use each effect of "Tricorn the Cacophonous Concert" once per turn.
--響魔従トライコーン --Tricorn the Cacophonous Concert --scripted by Naim 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_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcond) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 monster from the GY to hand with the same type and Attribute as a monster on your field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.spconfilter(c,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousControler(tp) and (c:IsPreviousLocation(LOCATION_MZONE) or (not c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsMonster())) end function s.spcond(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c,tp) return c:IsMonster() and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,c:GetRace(),c:GetAttribute()) end function s.cfilter(c,rac,att) return c:IsFaceup() and c:IsRace(rac) and c:IsAttribute(att) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 WATER monster you control and 2 WATER monsters in your Graveyard; shuffle the first target into the Deck, and if you do, add the second targets to your hand.
--儀水鏡の反魂術 --Aquamirror Cycle 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter1(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToDeck() end function s.filter2(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(s.filter2,tp,LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g1=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,s.filter2,tp,LOCATION_GRAVE,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_TODECK) local ex,g2=Duel.GetOperationInfo(0,CATEGORY_TOHAND) local tc1=g1:GetFirst() if tc1:IsRelateToEffect(e) and Duel.SendtoDeck(tc1,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 then local hg=g2:Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoHand(hg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,hg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Wyrm monsters You can discard 1 card, then target 1 Wyrm monster in your GY; Special Summon it, also, for the rest of this turn, you cannot activate the effects of monsters Special Summoned from the Extra Deck, except "Tenyi" monsters. When an attack is declared involving your face-up non-Effect Monster: You can target 1 card your opponent controls; destroy it. You can only use each effect of "Shaman of the Tenyi" once per turn.
--天威の龍仙女 --Shaman of the Tenyi local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WYRM),2,2) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy 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) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_TENYI} function s.spcost(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,e,tp) return c:IsRace(RACE_WYRM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.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,chk) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.aclimit(e,re,tp) local rc=re:GetHandler() return re:IsMonsterEffect() and rc:IsOnField() and rc:IsSummonLocation(LOCATION_EXTRA) and not rc:IsSetCard(SET_TENYI) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end return tc and tc:IsFaceup() and tc:IsControler(tp) and not tc:IsType(TYPE_EFFECT) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Junk" monster, you can Special Summon this card (from your hand).
--ジャンク・サーバント --Junk Servant local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) end s.listed_series={SET_JUNK} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_JUNK) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,c:GetControler(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase: You can shuffle up to 2 "Evolsaur" monsters from your hand into the Deck, then draw the same number of cards. You can only control 1 face-up "Primordial Soup".
--原初のスープ --Primordial Soup local s,id=GetID() function s.initial_effect(c) --You can only control 1 "Primordial Soup" c:SetUniqueOnField(1,0,id) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Shuffle up to 2 "Evolsaur" monsters from your hand into the Deck, then draw the same number of cards local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) end s.listed_names={id} s.listed_series={SET_EVOLSAUR} function s.tdfilter(c) return c:IsSetCard(SET_EVOLSAUR) and c:IsMonster() and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp) and Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_HAND,0,1,2,nil) if #g>0 then Duel.ConfirmCards(1-tp,g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) local ct=#Duel.GetOperatedGroup() if ct>0 then Duel.ShuffleDeck(tp) end if ct==#g and Duel.IsPlayerCanDraw(tp) then Duel.BreakEffect() Duel.Draw(tp,ct,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can target 1 "Mayakashi" monster in your GY, except "Shafu, the Wheeled Mayakashi"; Special Summon it in Defense Position, but negate its effects. You can only use this effect of "Shafu, the Wheeled Mayakashi" once per turn. You cannot Special Summon monsters from the Extra Deck, except "Mayakashi" monsters.
--轍の魔妖-俥夫  --Shafu, the Wheeled Mayakashi local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --spsummon limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetTarget(s.sumlimit) c:RegisterEffect(e3) --Lizard check aux.addContinuousLizardCheck(c,LOCATION_MZONE,s.lizfilter) end s.listed_names={id} s.listed_series={SET_MAYAKASHI} function s.spfilter(c,e,tp) return c:IsSetCard(SET_MAYAKASHI) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not c:IsCode(id) 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 c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end Duel.SpecialSummonComplete() end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLocation(LOCATION_EXTRA) and not c:IsSetCard(SET_MAYAKASHI) end function s.lizfilter(e,c) return not c:IsOriginalSetCard(SET_MAYAKASHI) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Shaddoll" monster you control; send 1 "Shaddoll" card from your hand to the GY, and if you do, the targeted monster gains 1000 ATK/DEF, but is changed to face-down Defense Position during the End Phase.
--魂源への影劫回帰 --Purushaddoll Aeon local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SHADDOLL} function s.filter(c) return c:IsSetCard(SET_SHADDOLL) and c:IsFaceup() end function s.tgfilter(c) return c:IsSetCard(SET_SHADDOLL) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND,0,1,1,nil) if #g>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 and g:IsExists(Card.IsLocation,1,nil,LOCATION_GRAVE) then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1000) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) local fid=c:GetFieldID() tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1) e3:SetLabel(fid) e3:SetLabelObject(tc) e3:SetCondition(s.flipcon) e3:SetOperation(s.flipop) Duel.RegisterEffect(e3,tp) end end end function s.flipcon(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetFlagEffectLabel(id)~=e:GetLabel() then e:Reset() return false else return true end end function s.flipop(e,tp,eg,ep,ev,re,r,rp) Duel.ChangePosition(e:GetLabelObject(),POS_FACEDOWN_DEFENSE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you have a "Majespecter" card in your Pendulum Zone, the activation and effects of other "Majespecter" cards activated on your side of the field cannot be negated. Once per turn: You can target 5 "Majespecter" cards in your Graveyard; shuffle all 5 into the Deck, then draw 1 card.
--マジェスペクター・スーパーセル --Majespecter Supercell local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) c:RegisterEffect(e1) --Draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) --inactivatable local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_INACTIVATE) e4:SetRange(LOCATION_SZONE) e4:SetCondition(s.tgcon) e4:SetValue(s.effectfilter) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_CANNOT_DISEFFECT) e5:SetRange(LOCATION_SZONE) e5:SetCondition(s.tgcon) e5:SetValue(s.effectfilter) c:RegisterEffect(e5) end s.listed_series={SET_MAJESPECTER} function s.filter(c) return c:IsSetCard(SET_MAJESPECTER) and c:IsAbleToDeck() end function s.drtg(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.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,5,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,5,0,0) 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 tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=5 then return end Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA) if ct==5 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function s.tgcon(e) return Duel.IsExistingMatchingCard(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_PZONE,0,1,nil,SET_MAJESPECTER) end function s.effectfilter(e,ct) local p=e:GetHandlerPlayer() local te,tp,loc=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_LOCATION) local tc=te:GetHandler() return p==tp and (loc&LOCATION_ONFIELD)~=0 and tc:IsSetCard(SET_MAJESPECTER) and tc~=e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 non-Token Normal Monster you control; Tribute that Normal Monster, and if you do, destroy 1 monster your opponent controls.
--突撃指令 --Order to Charge 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.rfilter(c,e) local tpe=c:GetType() return (tpe&TYPE_NORMAL)~=0 and (tpe&TYPE_TOKEN)==0 and c:IsFaceup() and c:IsReleasable() and c:IsReleasableByEffect() 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.rfilter(chkc,e) end if chk==0 then return Duel.IsExistingTarget(s.rfilter,tp,LOCATION_MZONE,0,1,nil,e) and Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=Duel.SelectTarget(tp,s.rfilter,tp,LOCATION_MZONE,0,1,1,nil,e) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) if #dg>0 then Duel.Destroy(dg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with a "Megalith" card. If this card is Ritual Summoned: You can target 1 Ritual Monster in your GY; this card's Level becomes the Level of that target, then add that target to your hand. During the Main Phase (Quick Effect): You can activate this effect; Ritual Summon 1 "Megalith" Ritual Monster from your hand or Deck by Tributing monsters from your hand or field whose total Levels equal or exceed the Level of the Ritual Monster. You can only use each effect of "Megalith Phul" once per turn.
--メガリス・フール --Megalith Phul --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Change level and add target to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Ritual Summon local e2=Ritual.CreateProc(c,RITPROC_GREATER,aux.FilterBoolFunction(Card.IsSetCard,SET_MEGALITH),nil,aux.Stringid(id,1),nil,nil,nil,nil,LOCATION_HAND|LOCATION_DECK) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_MAIN_END) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.ritcon) c:RegisterEffect(e2) end s.listed_series={SET_MEGALITH} function s.ritcon() return Duel.IsMainPhase() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsRitualSummoned() end function s.tgfilter(c,lv) return c:IsRitualMonster() and c:IsAbleToHand() and c:GetLevel()~=lv end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local lv=e:GetHandler():GetLevel() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tgfilter(chkc,lv) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_GRAVE,0,1,nil,lv) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_GRAVE,0,1,1,nil,lv) 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() local c=e:GetHandler() if tc and tc:IsRelateToEffect(e) and c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(tc:GetLevel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) Duel.BreakEffect() 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:
Reveal 1 Cyberse monster in your hand; apply this effect based on its Attribute, also you cannot Special Summon for the rest of this turn after this card resolves, except Cyberse monsters. ● DARK: Special Summon the revealed monster, and if you do, add 1 Level 4 or lower non-DARK Cyberse monster from your Deck to your hand. ● Other: Shuffle the revealed monster into the Deck, and if you do, add 1 "@Ignister" monster with a different Attribute from your Deck to your hand. You can only activate 1 "A.I. Connect" per turn.
--繋がり-Ai- --A.I. Connect --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_IGNISTER} function s.revfilter(c,e,tp,mmz_chk) if not c:IsRace(RACE_CYBERSE) or c:IsPublic() then return false end if c:IsAttribute(ATTRIBUTE_DARK) then return mmz_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.thfilter1,tp,LOCATION_DECK,0,1,nil) else return c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_DECK,0,1,nil,c:GetAttribute()) end end function s.thfilter1(c) return c:IsAttributeExcept(ATTRIBUTE_DARK) and c:IsLevelBelow(4) and c:IsRace(RACE_CYBERSE) and c:IsAbleToHand() end function s.thfilter2(c,attr) return c:IsSetCard(SET_IGNISTER) and c:IsMonster() and c:IsAttributeExcept(attr) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local mmz_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingMatchingCard(s.revfilter,tp,LOCATION_HAND,0,1,nil,e,tp,mmz_chk) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.revfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,mmz_chk):GetFirst() Duel.ConfirmCards(1-tp,rc) Duel.ShuffleHand(tp) e:SetLabelObject(rc) Duel.SetTargetCard(rc) local category=rc:IsAttribute(ATTRIBUTE_DARK) and CATEGORY_SPECIAL_SUMMON or CATEGORY_TODECK Duel.SetOperationInfo(0,category,rc,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local rc=e:GetLabelObject() if rc:IsRelateToEffect(e) then local success=nil local thfilter=nil if rc:IsAttribute(ATTRIBUTE_DARK) then --Special Summon the revealed monster, and if you do, add 1 non-DARK Level 4 or lower Cyberse monster from your Deck to your hand success=Duel.SpecialSummon(rc,0,tp,tp,false,false,POS_FACEUP)>0 thfilter=s.thfilter1 else --Shuffle the revealed monster into the Deck, and if you do, add 1 "@Ignister" monster with a different Attribute from your Deck to your hand Duel.ConfirmCards(1-tp,rc) success=Duel.SendtoDeck(rc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 thfilter=s.thfilter2 end if success then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,thfilter,tp,LOCATION_DECK,0,1,1,nil,rc:GetAttribute()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end --You cannot Special Summon for the rest of this turn after this card resolves, except Cyberse monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return not c:IsRace(RACE_CYBERSE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters, except Tokens This card gains these effects based on the number of monsters co-linked to this card. ● 1+: When a monster co-linked to this card battles your opponent's monster and inflicts battle damage to them: You can gain that much LP. ● 2: Once per turn (Quick Effect): You can target 2 face-up monsters you control; until the end of this turn, halve the ATK of 1 monster, and if you do, add that lost ATK to the other monster.
--バイナル・ソーサレス --Binary Sorceress local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,s.matfilter,2,2) c:EnableReviveLimit() --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_RECOVER) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.reccon) e1:SetTarget(s.rectg) e1:SetOperation(s.recop) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.atkcon) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.matfilter(c,lc,sumtype,tp) return not c:IsType(TYPE_TOKEN,lc,sumtype,tp) end function s.reccon(e,tp,eg,ep,ev,re,r,rp) local lg=e:GetHandler():GetMutualLinkedGroup() local tc=eg:GetFirst() return ep~=tp and lg:IsContains(tc) and tc:GetBattleTarget()~=nil end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ev) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ev) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return aux.StatChangeDamageStepCondition() and e:GetHandler():GetMutualLinkedGroupCount()>=2 end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local g1=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabelObject(g1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,g1:GetFirst()) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local hc=e:GetLabelObject() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc=g:GetFirst() if tc==hc then tc=g:GetNext() end if hc:IsFaceup() and hc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then local atk=hc:GetAttack() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(atk/2) hc:RegisterEffect(e1) if not hc:IsImmuneToEffect(e1) then local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(atk/2) tc:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase: Fusion Summon 1 "Prank-Kids" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. For the rest of this turn after this card resolves, you cannot Normal or Special Summon monsters, except "Prank-Kids" monsters.
--プランキッズの大暴走 --Prank-Kids Pandemonium local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsSetCard,SET_PRANK_KIDS),nil,nil,nil,nil,s.stage2) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetCondition(s.condition) c:RegisterEffect(e1) end s.listed_series={SET_PRANK_KIDS} function s.stage2(e,tc,tp,sg,chk) if chk==2 then if e:IsHasType(EFFECT_TYPE_ACTIVATE) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SUMMON) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end end end function s.condition() return Duel.IsMainPhase() end function s.splimit(e,c) return not c:IsSetCard(SET_PRANK_KIDS) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When the equipped monster destroys a monster by battle and sends it to the Graveyard: Inflict damage to your opponent equal to half the destroyed monster's ATK in the Graveyard.
--ジャンク・アタック --Junk Barrage 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:SetCode(EVENT_BATTLE_DESTROYED) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetRange(LOCATION_SZONE) 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 eqc=e:GetHandler():GetEquipTarget() local des=eg:GetFirst() return des:IsLocation(LOCATION_GRAVE) and des:GetReasonCard()==eqc and des:IsMonster() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end eg:GetFirst():CreateEffectRelation(e) Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local des=eg:GetFirst() local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) if des:IsRelateToEffect(e) then local dam=des:GetAttack()/2 if dam<0 then dam=0 end Duel.Damage(p,dam,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a Level 8 or higher "Myutant" monster you control. At the start of the Damage Step, if the equipped monster attacks an opponent's Special Summoned monster: You can banish that opponent's monster. While this card is equipped to a monster: You can banish this card; send the monster this card was equipped to the GY, and if you do, Special Summon 1 Level 8 "Myutant" monster with a different original Attribute from your hand or Deck. You can only use this effect of "Myutant Blast" once per turn.
--ミュートリア反射作用 --Myutant Blast --Scripted by senpaizuri local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,0,s.filter) --Banish local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_START) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.bancon) e1:SetTarget(s.bantg) e1:SetOperation(s.banop) c:RegisterEffect(e1) --Special summon 1 level 8 "Myutant" monster from 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_SZONE) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) e2:SetCountLimit(1,id) c:RegisterEffect(e2) end s.listed_series={SET_MYUTANT} function s.filter(c) return c:IsSetCard(SET_MYUTANT) and c:IsLevelAbove(8) end function s.bancon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler():GetEquipTarget() local bc=c:GetBattleTarget() return Duel.GetAttacker()==c and bc and bc:IsControler(1-tp) and bc:IsSpecialSummoned() and bc:IsAbleToRemove() end function s.bantg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,e:GetHandler():GetEquipTarget():GetBattleTarget(),1,0,0) end function s.banop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetEquipTarget():GetBattleTarget() if bc:IsRelateToBattle() and bc:IsControler(1-tp) then Duel.Remove(bc,POS_FACEUP,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetEquipTarget() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabelObject(e:GetHandler():GetEquipTarget()) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function s.spfilter(c,e,tp,att) return c:IsSetCard(SET_MYUTANT) and c:IsLevel(8) and not c:IsOriginalAttribute(att) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetLabelObject() local att=c:GetOriginalAttribute() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp,att) end Duel.SetTargetCard(c) e:SetLabel(c:GetOriginalAttribute()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc or not tc:IsRelateToEffect(e) then return end if Duel.SendtoGrave(tc,REASON_EFFECT)~=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,e:GetLabel()) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be Normal Summoned or Set. This card can only be Special Summoned by removing from play 2 EARTH monsters from your Graveyard. When this face-up card you control is sent to the Graveyard by a card effect, destroy all Spell and Trap Cards your opponent controls.
--ギガストーン・オメガ --Gigastone Omega local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.spfilter(c,tp) return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or (c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5)) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return ft>-1 and #rg>0 and aux.SelectUnselectGroup(rg,e,tp,2,2,nil,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,nil,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) and (c:GetPreviousPosition()&POS_FACEUP)~=0 and (c:GetPreviousLocation()&LOCATION_ONFIELD)~=0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by discarding 1 "Gimmick Puppet" monster. You can banish this card from your GY; your opponent cannot target "Gimmick Puppet" monsters you control with card effects this turn.
--ギミック・パペット-ビスク・ドール --Gimmick Puppet Bisque Doll --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Special Summon this card (from your hand) by discarding 1 "Gimmick Puppet" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Apply a "Your opponent cannot target "Gimmick Puppet" monsters you control with cards effects this turn" effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(function(e,tp) return not Duel.HasFlagEffect(tp,id) end) e2:SetCost(Cost.SelfBanish) e2:SetOperation(s.effop) c:RegisterEffect(e2) end s.listed_series={SET_GIMMICK_PUPPET} function s.spcostfilter(c) return c:IsSetCard(SET_GIMMICK_PUPPET) and c:IsMonster() and c:IsDiscardable() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,c) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_HAND,0,c) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,nil,1,tp,HINTMSG_DISCARD,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_DISCARD|REASON_COST) g:DeleteGroup() end function s.effop(e,tp,eg,ep,ev,re,r,rp) if Duel.HasFlagEffect(tp,id) then return end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) local c=e:GetHandler() --Your opponent cannot target "Gimmick Puppet" monsters you control with cards effects this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_GIMMICK_PUPPET)) e1:SetValue(aux.tgoval) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,2)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand or Graveyard: You can target 1 "Cipher" Xyz Monster you control; attach this card to it as an Xyz Material. If this card is sent to the Graveyard: You can add 1 "Cipher" Spell/Trap Card from your Deck to your hand. You can only use 1 "Cipher Etranger" effect per turn, and only once that turn.
--光波異邦臣 --Cipher Etranger local s,id=GetID() function s.initial_effect(c) --material local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_GRAVE|LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.mattg) e1:SetOperation(s.matop) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_CIPHER} function s.matfilter(c) return c:IsFaceup() and c:IsSetCard(SET_CIPHER) and c:IsType(TYPE_XYZ) end function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.matfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.matfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.matfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.matop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.Overlay(tc,c) end end function s.thfilter(c) return c:IsSetCard(SET_CIPHER) 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Shuffle all monsters on the field into the Deck. Then, each player excavates cards from the top of their Deck, until they excavate the same number of monsters they shuffled into their Main Deck. Special Summon all excavated Level 4 or lower monsters in face-down Defense Position, also send the remaining cards to the Graveyard.
--カオスポッド --Morphing Jar #2 local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) 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_SPECIAL_SUMMON,nil,0,tp,LOCATION_DECK) end function s.filter(c) return not c:IsStatus(STATUS_BATTLE_DESTROYED) and c:IsAbleToDeck() end function s.filter2(c) return c:IsLocation(LOCATION_DECK) and c:IsMonster() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local rg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SendtoDeck(rg,nil,SEQ_DECKTOP,REASON_EFFECT) rg=Duel.GetOperatedGroup():Match(s.filter2,nil) local ct1=rg:FilterCount(Card.IsControler,nil,tp) local ct2=#rg-ct1 if ct1>0 then Duel.ShuffleDeck(tp) end if ct2>0 then Duel.ShuffleDeck(1-tp) end Duel.BreakEffect() local g1=nil local g2=nil if ct1>0 then g1=s.sp(e,tp,ct1) end if ct2>0 then g2=s.sp(e,1-tp,ct2) end Duel.SpecialSummonComplete() if g1 then Duel.ShuffleSetCard(g1) end if g2 then Duel.ShuffleSetCard(g2) end end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sp(e,tp,ct) local g=Duel.GetFieldGroup(tp,LOCATION_DECK,0) local dt=#g if dt==0 then return end local dlist={} for tc in g:Iter() do if tc:IsMonster() then dlist[tc:GetSequence()]=tc end end local i=dt-1 local a=0 local last=nil g=Group.CreateGroup() while a<ct and i>=0 do tc=dlist[i] if tc then g:AddCard(tc) last=tc a=a+1 end i=i-1 end local conf=dt-last:GetSequence() Duel.ConfirmDecktop(tp,conf) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) g:Match(s.spfilter,nil,e,tp) if #g>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) g=g:Select(tp,ft,ft,nil) end for tc in g:Iter() do Duel.DisableShuffleCheck() Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) end if conf-#g>0 then Duel.DiscardDeck(tp,conf-#g,REASON_EFFECT|REASON_EXCAVATE) end return g end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card in your hand, field, or GY can be used as a substitute for any 1 Fusion Material whose name is mentioned on the Fusion Monster Card, but the other materials must be correct. You can discard this card to the GY; add 1 "Polymerization" from your Deck to your hand.
--沼地の魔神王 --King of the Swamp local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(Cost.SelfDiscardToGrave) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --fusion substitute local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_FUSION_SUBSTITUTE) e2:SetCondition(s.subcon) c:RegisterEffect(e2) end s.listed_names={CARD_POLYMERIZATION} function s.subcon(e) return e:GetHandler():IsLocation(LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE) end function s.filter(c) return c:IsCode(CARD_POLYMERIZATION) 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,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is discarded to the GY by card effect: Draw 1 card, or, if it was discarded from your hand to your GY by an opponent's card effect, draw 2 cards instead.
--暗黒界の狩人 ブラウ --Broww, Huntsman of Dark World local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(e:GetHandler():GetPreviousControler()) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) and r&(REASON_DISCARD|REASON_EFFECT)==REASON_DISCARD|REASON_EFFECT end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) if tp==rp or tp~=e:GetLabel() then Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) else Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end 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 WATER monsters You can target 1 WATER monster with 1500 or less ATK in your GY; Special Summon it to your zone this card points to, also you cannot Special Summon monsters for the rest of this turn, except WATER monsters. If this card is sent from the field to the GY: You can target 1 "Marincess" card in your GY, except "Marincess Coral Anemone"; add it to your hand. You can only use each effect of "Marincess Coral Anemone" once per turn.
--海晶乙女 コーラルアネモネ --Marincess Coral Anemone --Anime version scripted by Larry126, updated by Eerie Code local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_WATER),2,2) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --add to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_MARINCESS} function s.spfilter(c,e,tp,zone) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAttackBelow(1500) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp)&ZONES_MMZ if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp,zone) end if chk==0 then return zone~=0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,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 tc:IsRelateToEffect(e) and c:GetLinkedZone(tp)&ZONES_MMZ~=0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,c:GetLinkedZone(tp)&ZONES_MMZ) 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,2)) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsAttribute(ATTRIBUTE_WATER) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.thfilter(c) return c:IsSetCard(SET_MARINCESS) and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up "Inzektor" card you control and 2 face-up cards your opponent controls; destroy them.
--アーマーブラスト --Armor Blast local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_INZEKTOR} function s.filter1(c) return c:IsFaceup() and c:IsSetCard(SET_INZEKTOR) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,2,2,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,#g1,0,0) end function s.tgfilter(c,e) return c:IsFaceup() and c:IsRelateToEffect(e) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tg=g:Filter(s.tgfilter,nil,e) if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Switch the ATK and DEF of all face-up Effect Monsters on the field.
--反転世界 --Inverse Universe local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsDefenseAbove(0) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local c=e:GetHandler() for tc in sg:Iter() do local atk=tc:GetAttack() local def=tc:GetDefense() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(def) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_DEFENSE_FINAL) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(atk) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can target 1 monster your opponent controls; return it to the hand. If this card on the field is destroyed by battle or card effect: You can target 1 card your opponent controls; return it to the hand. You can only use 1 "Glacial Beast Polar Penguin" effect per turn, and only once that turn.
--極氷獣ポーラ・ペンギン --Glacial Beast Polar Penguin --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --If special summoned, return 1 of opponent's monsters to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thmtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --If destroyed by battle or card effect while on field, return 1 of opponent's cards to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,id) e2:SetCondition(s.thccon) e2:SetTarget(s.thctg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end --Specifically lists itself s.listed_names={id} --If this card was destroyed by battle or card effect while on the field function s.thccon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT+REASON_BATTLE)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end --Activation legality function s.thmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end --Activation legality function s.thctg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end --Return 1 of opponent's monsters/cards to hand 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:
Monsters Tributed for the face-up Tribute Summon of this card are returned to the hand instead of going to the GY. Once per turn: You can discard 1 card; return all cards your opponent controls in this card's column to the hand.
--旋風機ストリボーグ --Fantastic Striborg local s,id=GetID() function s.initial_effect(c) --Monsters Tributed for the face-up Tribute Summon of this card are returned to the hand instead of going to the GY local e0a=Effect.CreateEffect(c) e0a:SetType(EFFECT_TYPE_SINGLE) e0a:SetCode(EFFECT_MATERIAL_CHECK) e0a:SetValue(s.valcheck) c:RegisterEffect(e0a) local e0b=Effect.CreateEffect(c) e0b:SetType(EFFECT_TYPE_SINGLE) e0b:SetCode(EFFECT_SUMMON_COST) e0b:SetOperation(function() e0a:SetLabel(1) end) c:RegisterEffect(e0b) --Return all cards your opponent controls in this card's column to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.Discard()) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.valcheck(e,c) if e:GetLabel()==0 then return end e:SetLabel(0) local mg=c:GetMaterial() for mc in mg:Iter() do --Monsters Tributed for the face-up Tribute Summon of this card are returned to the hand instead of going to the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_HAND) e1:SetReset(RESET_EVENT|RESETS_STANDARD) mc:RegisterEffect(e1) end end function s.thfilter(c,tp) return c:IsControler(1-tp) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetColumnGroup():IsExists(s.thfilter,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,1-tp,LOCATION_ONFIELD) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local colg=c:GetColumnGroup():Match(Card.IsControler,nil,1-tp) if c:IsControler(1-tp) then colg:AddCard(c) end if #colg>0 then Duel.SendtoHand(colg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when a face-up Defense Position "Karakuri" monster is selected as an attack target. Destroy all face-up monsters your opponent controls.
--時限カラクリ爆弾 --Karakuri Klock 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_BE_BATTLE_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_KARAKURI} function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return tc:IsFaceup() and tc:IsDefensePos() and tc:IsSetCard(SET_KARAKURI) end function s.filter(c) return c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "D.D. Esper Star Sparrow", "Beast-Warrior Puma" and "Phoenix Beast Gairuda", you can Special Summon this card (from your hand). While this card is face-up on the field, it cannot change its battle position. Once per turn: You can target 1 monster you control; it can attack your opponent directly this turn.
--鉄巨人アイアンハンマー --Ironhammer the Giant local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Cannot change its battle position local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION) c:RegisterEffect(e2) --Make targeted monster be able to attack directly local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.spfilter(c,code) return c:IsFaceup() and c:IsCode(code) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE,0)~=0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_ONFIELD,0,1,nil,80208158) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_ONFIELD,0,1,nil,16796157) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_ONFIELD,0,1,nil,43791861) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --Can attack directly local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3205) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Myutant" monsters with different Attributes If this card is Fusion Summoned: You can target 1 card on the field; destroy it. When your opponent activates a card or effect (Quick Effect): You can activate this effect; for the rest of this turn, this face-up card is unaffected by the effects of an opponent's cards of the same type (Monster, Spell, or Trap) as that card. If this Fusion Summoned card you control is destroyed by an opponent's card: You can add 1 of your banished "Myutant" cards to your hand. You can only use each effect of "Myutant Synthesis" once per turn.
--シンセシス・ミュートリアス --Myutant Synthesis --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Fusion summon procedure Fusion.AddProcMixN(c,true,true,s.ffilter,2) --If fusion summoned, destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Unaffected by opponent's specific card type local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetDescription(aux.Stringid(id,1)) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.immcon) --e2:SetTarget(s.immtg) e2:SetOperation(s.immop) c:RegisterEffect(e2) --Add 1 of your banished "Myutant" cards local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_DESTROYED) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_MYUTANT} --2 "Myutant" monsters with different attributes function s.ffilter(c,fc,sumtype,sp,sub,mg,sg) return c:IsSetCard(SET_MYUTANT,fc,sumtype,sp) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or not sg:IsExists(Card.IsAttribute,1,c,c:GetAttribute(),fc,sumtype,sp)) end --If fusion summoned function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsFusionSummoned() end --Activation legality function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) end if chk==0 then return 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,0,0) end --Destroy 1 card on the field 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 --Card/effect activated by opponent function s.immcon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsActiveType(TYPE_MONSTER|TYPE_SPELL|TYPE_TRAP) end --Unaffected by same card type as the activated card/effect function s.immop(e,tp,eg,ep,ev,re,r,rp) local rtype=re:GetActiveType() local c=e:GetHandler() if rtype&TYPE_MONSTER~=0 then --Unaffected by opponent's monster effects local e1=Effect.CreateEffect(c) e1:SetDescription(3111) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.imfilter1) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) elseif rtype&TYPE_SPELL~=0 then --Unaffected by opponent's spell effects local e1=Effect.CreateEffect(c) e1:SetDescription(3112) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.imfilter2) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) elseif rtype&TYPE_TRAP~=0 then --Unaffected by opponent's trap effects local e1=Effect.CreateEffect(c) e1:SetDescription(3113) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.imfilter3) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end --Unaffected by the respective card types function s.imfilter1(e,te) return te:IsMonsterEffect() and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function s.imfilter2(e,te) return te:IsSpellEffect() and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end function s.imfilter3(e,te) return te:IsTrapEffect() and te:GetOwnerPlayer()~=e:GetHandlerPlayer() end --If this fusion summoned card was destroyed by opponent's card function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsFusionSummoned() and (c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT)) and c:GetPreviousControler()==tp) end --Check for face-up banished "Myutant" card function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MYUTANT) and c:IsAbleToHand() end --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_REMOVED) end --Add 1 of your banished "Myutant" cards to hand 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_REMOVED,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:
During the Battle Phase, you can send 1 card you control to the Graveyard, except this card, to end the Battle Phase.
--強制終了 --Scrubbed Raid 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) --End the Battle Phase local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCondition(s.bpcon) e2:SetCost(s.bpcost) e2:SetOperation(s.bpop) c:RegisterEffect(e2) end function s.bpcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() and Duel.GetCurrentPhase()<PHASE_BATTLE end function s.bpcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) and e:GetHandler():GetFlagEffect(id)==0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler()) Duel.SendtoGrave(g,REASON_COST) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESET_CHAIN,0,1) end function s.bpop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Mermail" monster you control; it gains 1000 ATK until the End Phase. When this Set card is sent to the Graveyard: Target 1 monster your opponent controls; send that target to the Graveyard.
--アビスコーン --Abyss-scorn local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.tgcon) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_series={SET_MERMAIL} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_MERMAIL) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1000) tc:RegisterEffect(e1) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsPreviousPosition(POS_FACEDOWN) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoGrave(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Gravekeeper's" monsters Gains ATK/DEF equal to the combined original Levels of the materials used for its Fusion Summon x 100. While "Necrovalley" is on the field, this card, and any card in your Field Zone, cannot be destroyed by card effects. During your Main Phase: You can activate this effect; during the End Phase of this turn, add 1 "Gravekeeper's" monster or 1 "Necrovalley" card from your Deck to your hand. You can only use this effect of "Gravekeeper's Supernaturalist" once per turn.
--墓守の異能者 --Gravekeeper's Supernaturalist --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion procedure Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GRAVEKEEPERS),2) --Increase ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MATERIAL_CHECK) e1:SetValue(s.matcheck) c:RegisterEffect(e1) --Cannot be destroyed by card effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_ONFIELD,0) e2:SetCondition(s.indcon) e2:SetTarget(s.indtg) e2:SetValue(1) c:RegisterEffect(e2) --Search 1 "Gravekeeper's" monster or "Necrovalley" card during the End Phase local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetTarget(s.regtg) e3:SetOperation(s.regop) c:RegisterEffect(e3) end s.listed_series={SET_GRAVEKEEPERS,SET_NECROVALLEY} s.listed_names={CARD_NECROVALLEY} s.material_setcode=SET_GRAVEKEEPERS function s.matcheck(e,c) local lv=c:GetMaterial():GetSum(Card.GetOriginalLevel) if lv==0 then return end --Increase ATK/DEF 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(lv*100) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end function s.indcon(e) return Duel.IsEnvironment(CARD_NECROVALLEY) end function s.indtg(e,c) return c==e:GetHandler() or c:IsLocation(LOCATION_FZONE) end function s.regtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return ((c:IsSetCard(SET_GRAVEKEEPERS) and c:IsMonster()) or c:IsSetCard(SET_NECROVALLEY)) and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as a "Constellar" card.) If a "tellarknight" or "Constellar" monster is Normal Summoned to your field, except "Tellarknight Lyran" (except during the Damage Step): You can Special Summon this card from your hand. If this card is Summoned: You can add 1 "tellarknight" Spell from your Deck to your hand. You can only use each effect of "Tellarknight Lyran" once per turn.
--星騎士 リュラ --Tellarknight Lyran --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 "tellarknight" Spell from your Deck to your hand local e2a=Effect.CreateEffect(c) e2a:SetDescription(aux.Stringid(id,1)) e2a:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2a:SetProperty(EFFECT_FLAG_DELAY) e2a:SetCode(EVENT_SUMMON_SUCCESS) e2a:SetCountLimit(1,{id,1}) e2a:SetTarget(s.thtg) e2a:SetOperation(s.thop) c:RegisterEffect(e2a) local e2b=e2a:Clone() e2b:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2b) local e2c=e2a:Clone() e2c:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2c) end s.listed_series={SET_CONSTELLAR,SET_TELLARKNIGHT} s.listed_names={id} function s.spconfilter(c,tp) return c:IsSetCard({SET_TELLARKNIGHT,SET_CONSTELLAR}) and c:IsControler(tp) and c:IsFaceup() and not c:IsCode(id) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c) return c:IsSetCard(SET_TELLARKNIGHT) and c:IsSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Cyber Dragon" + 1+ Machine monsters Cannot be used as Fusion Material. Must first be Special Summoned (from your Extra Deck) by sending the above cards from either field to the GY. The original ATK of this card becomes 1000 x the number of materials used for its Special Summon.
--キメラテック・フォートレス・ドラゴン --Chimeratech Fortress Dragon local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixRep(c,true,true,s.fil,1,99,CARD_CYBER_DRAGON) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit) --cannot be fusion material local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e3:SetValue(1) c:RegisterEffect(e3) end s.material_setcode={SET_CYBER,SET_CYBER_DRAGON} function s.fil(c,fc,sumtype,tp,sub,mg,sg,contact) if contact then sumtype=0 end return c:IsRace(RACE_MACHINE,fc,sumtype,tp) and (not contact or c:IsType(TYPE_MONSTER,fc,sumtype,tp)) end function s.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function s.contactfil(tp) return Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,tp) end function s.cfilter(c,tp) return c:IsAbleToGraveAsCost() and (c:IsControler(tp) or c:IsFaceup()) end function s.contactop(g,tp,c) Duel.SendtoGrave(g,REASON_COST|REASON_MATERIAL) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) e1:SetValue(#g*1000) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can send 1 "Black Luster Soldier" monster from your hand to the Graveyard; until your opponent's next End Phase, this card's ATK becomes 3000, and this card's name becomes "Black Luster Soldier". You can banish this card from your Graveyard; add 1 "Beginning Knight" or "Evening Twilight Knight" from your Deck to your hand. You can only use each effect of "Super Soldier Soul" once per turn.
--超戦士の魂 --Super Soldier Soul local s,id=GetID() function s.initial_effect(c) --Make this card's ATK become 3000 and its name become "Black Luster Soldier" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.atkcost) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Add 1 "Beginning Knight" or "Evening Twilight Knight" from your Deck to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_BLACK_LUSTER_SOLDIER} s.listed_names={5405694,6628343,32013448} --"Black Luster Soldier", "Beginning Knight", "Evening Twilight Knight" function s.atkcostfilter(c) return c:IsSetCard(SET_BLACK_LUSTER_SOLDIER) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkcostfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.atkcostfilter,1,1,REASON_COST) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local ct=Duel.IsTurnPlayer(tp) and 2 or 1 --Until your opponent's next End Phase, this card's ATK becomes 3000, and this card's name becomes "Black Luster Soldier" local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(3000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END,ct) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_CHANGE_CODE) e2:SetValue(5405694) e2:SetReset(RESETS_STANDARD_PHASE_END,ct) c:RegisterEffect(e2) end end function s.thfilter(c) return c:IsCode(6628343,32013448) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Effect Monsters with the same Type and Attribute You can target 1 of your monsters that is banished or in your GY; Special Summon it to your zone this card points to, in Defense Position, but its effects are negated, also you cannot Special Summon Link Monsters for the rest of this turn, and the Summoned monster is placed on the bottom of the Deck when it leaves the field. You can only use this effect of "Darkness Metal, the Dragon of Dark Steel" once per turn.
--闇鋼龍ダークネスメタル --Darkness Metal, the Dragon of Dark Steel --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,nil,s.spcheck) --Special Summon 1 of your monsters that is banished or in GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcheck(g,lc,sumtype,tp) return g:CheckSameProperty(Card.GetRace,lc,sumtype,tp) and g:CheckSameProperty(Card.GetAttribute,lc,sumtype,tp) end function s.filter(c,e,tp,zone) return (c:IsFaceup() or not c:IsLocation(LOCATION_REMOVED)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,tp,zone) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp)&ZONES_MMZ if chkc then return chkc:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local zone=c:GetLinkedZone(tp)&ZONES_MMZ if tc and tc:IsRelateToEffect(e) and zone~=0 and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE,zone) then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) tc:RegisterEffect(e2) --Place on bottom of deck if it leaves the field local e3=Effect.CreateEffect(c) e3:SetDescription(3301) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e3:SetReset(RESET_EVENT|RESETS_REDIRECT) e3:SetValue(LOCATION_DECKBOT) tc:RegisterEffect(e3) --Cannot special summon link monsters for rest of turn local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_FIELD) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e4:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e4:SetTargetRange(1,0) e4:SetTarget(s.splimit) e4:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e4,tp) end Duel.SpecialSummonComplete() end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) if c:IsMonster() then return c:IsType(TYPE_LINK) else return c:IsOriginalType(TYPE_LINK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can Special Summon any number of "D-Boyz" from your Deck in Attack Position, then you take 1000 damage for each monster Special Summoned by this effect.
--Dボーイズ --D-Boyz 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_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetTarget(s.target) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={id} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft = 1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,ft,nil,e,tp) if #g>0 then local amount=Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) if amount>0 then Duel.BreakEffect() Duel.Damage(tp,1000*amount,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is used to Ritual Summon "Herald of Ultimateness". You must also Tribute monsters from your hand or field whose total Levels equal 12 or more. Your opponent cannot activate cards or effects in response to this card's activation.
--宣告者の神託 --Oracle of the Herald local s,id=GetID() function s.initial_effect(c) local e1=Ritual.AddProcGreaterCode(c,12,nil,48546368) e1:SetTarget(s.target(e1)) end function s.target(eff) local tg = eff:GetTarget() return function(e,...) local ret = tg(e,...) if ret then return ret end if e:IsHasType(EFFECT_TYPE_ACTIVATE) then Duel.SetChainLimit(s.chlimit) end end end function s.chlimit(e,ep,tp) return tp==ep end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each player must pay 500 Life Points per card to Normal Summon, Special Summon, Set or activate cards from his/her respective hand.
--魔力の枷 --Chain Energy local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --activate cost local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_ACTIVATE_COST) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetTarget(s.actarget) e2:SetCost(s.costchk) e2:SetOperation(s.costop) c:RegisterEffect(e2) --summon cost local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_SUMMON_COST) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_HAND,LOCATION_HAND) e3:SetCost(s.costchk) e3:SetOperation(s.costop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_SPSUMMON_COST) c:RegisterEffect(e4) --set cost local e5=e3:Clone() e5:SetCode(EFFECT_MSET_COST) c:RegisterEffect(e5) local e6=e3:Clone() e6:SetCode(EFFECT_SSET_COST) c:RegisterEffect(e6) --accumulate local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_FIELD) e7:SetCode(id) e7:SetRange(LOCATION_SZONE) e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e7:SetTargetRange(1,1) c:RegisterEffect(e7) end function s.actarget(e,te,tp) return te:GetHandler():IsLocation(LOCATION_HAND) end function s.costchk(e,te_or_c,tp) local ct=#{Duel.GetPlayerEffect(tp,id)} return Duel.CheckLPCost(tp,ct*500) end function s.costop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.PayLPCost(tp,500) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can send 1 "Ninja" monster from your hand to the GY; Set 1 "Ninjitsu Art" Spell/Trap directly from your Deck, except "Ninjitsu Art Notebook".
--隠密忍法帖 --Ninjitsu Art Notebook 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) --set local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCost(s.setcost) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_series={SET_NINJA,SET_NINJITSU_ART} s.listed_names={id} function s.costfilter(c) return c:IsSetCard(SET_NINJA) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.setfilter(c) return c:IsSetCard(SET_NINJITSU_ART) and c:IsSpellTrap() and not c:IsCode(id) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SSet(tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 WIND monster, then target 1 card your opponent controls; place that opponent's card on the bottom of the Deck.
--風霊術-「雅」 --Spiritual Wind Art - Miyabi 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_WIND) end function s.filter(c,e) return c:IsAbleToDeck() and c:IsCanBeEffectTarget(e) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn: You can Tribute this card; each Warrior-Type monster you currently control gains 500 ATK and DEF, until the end of the next Damage Step that monster attacks or is attacked.
--ガントレット・ウォリアー --Gauntlet Warrior local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_WARRIOR),tp,LOCATION_MZONE,0,1,e:GetHandler()) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_WARRIOR),tp,LOCATION_MZONE,0,e:GetHandler()) local c=e:GetHandler() for tc in g:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetLabelObject(e1) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetOperation(s.resetop) e3:SetReset(RESET_EVENT|RESETS_STANDARD) e3:SetLabelObject(e2) tc:RegisterEffect(e3) end end function s.resetop(e,tp,eg,ep,ev,re,r,rp) local e1=e:GetLabelObject() local e2=e1:GetLabelObject() e1:Reset() e2:Reset() e:Reset() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Obelisk the Tormentor" whose original Attribute is DIVINE in your Monster Zone: Tribute 2 other face-up monsters; destroy as many monsters your opponent controls as possible, and if you do, inflict 4000 damage to your opponent. During the Main or Battle Phase: You can banish this card from your GY; add 1 "Obelisk the Tormentor" from your Deck or GY to your hand, then immediately after this effect resolves, you can Normal Summon 1 "Obelisk the Tormentor". You can only use each effect of "Soul Energy MAX!!!" once per turn.
--ソウルエナジーMAX!! --Soul Energy MAX!!! --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,{id,0}) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Search 1 "Obelisk the Tormentor" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_END) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={CARD_OBELISK} function s.cfilter(c) return c:IsFaceup() and c:IsCode(CARD_OBELISK) and c:IsOriginalAttribute(ATTRIBUTE_DIVINE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.check(sg,tp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,sg) and Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_MZONE,1,sg) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsFaceup,2,false,s.check,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local g=Duel.SelectReleaseGroupCost(tp,Card.IsFaceup,2,2,false,s.check,nil) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,4000) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) if Duel.Destroy(g,REASON_EFFECT)>0 then Duel.Damage(1-tp,4000,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() or Duel.IsBattlePhase() end function s.thfilter(c) return c:IsCode(CARD_OBELISK) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.sumfilter(c) return c:IsCode(CARD_OBELISK) and c:IsSummonable(true,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil):GetFirst() if tc and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,tc) local g=Duel.GetMatchingGroup(s.sumfilter,tp,LOCATION_HAND,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local sg=g:Select(tp,1,1,nil):GetFirst() Duel.Summon(tp,sg,true,nil) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per Chain, if a monster(s) is Normal or Special Summoned to your field (except during the Damage Step): You can send the top card of your Deck to the GY. If this card is sent from your Deck to the GY by a card effect: You can target 1 card in your GY that was sent there this turn, except "Laundry Trap"; add it to your hand, but until the end of your next turn after this effect resolves, you cannot activate cards, or the effects of cards, with its name. You can only use this effect of "Laundry Trap" once per turn.
--ラドリートラップ --Laundry Trap --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) e1:SetHintTiming(0,TIMING_SUMMON|TIMING_SPSUMMON) c:RegisterEffect(e1) --Send the top card in the Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.gycon) e2:SetTarget(s.gytg) e2:SetOperation(s.gyop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Add 1 card from the GY to the hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_TO_GRAVE) e4:SetCountLimit(1,id) e4:SetCondition(s.thcon) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end function s.gycon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsControler,1,nil,tp) end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,0,tp,LOCATION_DECK) end function s.gyop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and e:GetHandler():IsRelateToEffect(e) then Duel.DiscardDeck(tp,1,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) and (r&REASON_EFFECT)~=0 end function s.thfilter(c,turn) return c:IsAbleToHand() and c:GetTurnID()==turn and not c:IsCode(id) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local turn=Duel.GetTurnCount() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc,turn) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,turn) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil,turn) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetLabelObject(tc) if Duel.IsTurnPlayer(tp) then e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,2) else e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN) end Duel.RegisterEffect(e1,tp) end end function s.aclimit(e,re,tp) local tc=e:GetLabelObject() return re:GetHandler():IsCode(tc:GetCode()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an attack is declared involving your Warrior monster: You can Special Summon 1 Level 4 or lower Warrior monster from your hand. You can only use this effect of "Reinforcement of the Army's Troops" once per turn.
--増援部隊 --Reinforcement of the Army's Troops 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 from the hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end return tc and tc:IsFaceup() and tc:IsControler(tp) and tc:IsRace(RACE_WARRIOR) end function s.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card is activated, while you control an "Evil Eye" monster: Negate the activation, and if you do, destroy it. If "Evil Eye of Selene" is in your Spell & Trap Zone, this card's activation and effect cannot be negated. You can only activate 1 "Evil Eye Retribution" per turn.
--断罪の呪眼 --Evil Eye Retribution --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --negate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_EVIL_EYE} s.listed_names={CARD_EVIL_EYE_SELENE} function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_EVIL_EYE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) and 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 true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_EVIL_EYE_SELENE),tp,LOCATION_SZONE,0,1,nil) then e:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_INACTIVATE) else e:SetProperty(0) end if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can activate this effect; Special Summon 2 "Slime Tokens" (Aqua/WATER/Level 1/ATK 500/DEF 500), also you cannot Normal or Special Summon monsters for the rest of this turn, except Divine-Beast monsters. During the Battle Phase (Quick Effect): You can Tribute this card; Set 1 "Metal Reflect Slime" from your hand, Deck, or GY. It can be activated this turn. You can only use each effect of "Reactor Slime" once per turn.
--リアクター・スライム --Reactor Slime --Scripted by Hel local s,id=GetID() function s.initial_effect(c) --Special Summon 2 "Slime Tokens" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Set "Metal Reflect Slime" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_BATTLE_END) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function() return Duel.IsBattlePhase() end) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_names={26905245,TOKEN_SLIME} local SET_SLIME=0x54b 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_SLIME,SET_SLIME,TYPES_TOKEN,500,500,1,RACE_AQUA,ATTRIBUTE_WATER) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) --Summon 2 Tokens if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or not Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_SLIME,SET_SLIME,TYPES_TOKEN,500,500,1,RACE_AQUA,ATTRIBUTE_WATER) then return end for i=1,2 do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() --Cannot Special Summon, except Divine-Beast monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) Duel.RegisterEffect(e2,tp) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsRace(RACE_DIVINE) end function s.setfilter(c) return c:IsCode(26905245) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) and s.setfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.setfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) local tc=g:GetFirst() if tc and tc:IsSSetable() then Duel.SSet(tp,tc) --Can be activated this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,3)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you activate this card: You can banish 1 "Evil Eye" card from your GY; draw 1 card. Once per turn, after damage calculation, if your "Evil Eye" monster equipped with "Evil Eye of Selene" attacked an opponent's monster: You can banish that opponent's monster. If this card in the Spell & Trap Zone is destroyed by card effect: You can target up to 3 of your banished "Evil Eye" cards; return them to the GY. You can only activate 1 "Evil Eye Repose" per turn.
--静冠の呪眼 --Evil Eye Repose 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Banish the opponent's monster that your "Evil Eye" monster equipped with "Evil Eye of Selene" attacked local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLED) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.rmcon) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --Return up to 3 of your banished "Evil Eye" cards to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.rtgcon) e3:SetTarget(s.rtgtg) e3:SetOperation(s.rtgop) c:RegisterEffect(e3) end s.listed_series={SET_EVIL_EYE} s.listed_names={CARD_EVIL_EYE_SELENE} function s.costfilter(c) return c:IsSetCard(SET_EVIL_EYE) and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local op=0 if Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then op=1 end e:SetLabel(op) if op==0 then e:SetCategory(0) elseif op==1 then e:SetCategory(CATEGORY_DRAW) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end if e:GetLabel()==1 then Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) local ac,bc=Duel.GetBattleMonster(tp) if ac and ac==Duel.GetAttacker() and bc and ac:IsSetCard(SET_EVIL_EYE) and ac:GetEquipGroup():IsExists(Card.IsCode,1,nil,CARD_EVIL_EYE_SELENE) then e:SetLabelObject(bc) return true end return false end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetLabelObject() if chk==0 then return bc:IsAbleToRemove() end Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetLabelObject() if bc:IsRelateToBattle() and bc:IsControler(1-tp) then Duel.Remove(bc,POS_FACEUP,REASON_EFFECT) end end function s.rtgcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_STZONE) end function s.rtgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and chkc:IsSetCard(SET_EVIL_EYE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_EVIL_EYE),tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOGRAVE) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_EVIL_EYE),tp,LOCATION_REMOVED,0,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,tp,0) end function s.rtgop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.SendtoGrave(tg,REASON_EFFECT|REASON_RETURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 2 "Duoterion" and 1 "Oxygeddon" in your hand and/or field; Special Summon 1 "Water Dragon" or "Water Dragon Cluster" from your hand, Deck, or GY. (This is treated as a Special Summon with the effect of "Bonding - H2O".) If "Water Dragon" or "Water Dragon Cluster" is sent from the field to your GY while this card is in your GY: Add this card to your hand. You can only use this effect of "Bonding - D2O" once per turn.
--ボンディング-D2O --Bonding - D2O 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={58071123,85066822,6022371,43017476} function s.spcheck(sg,tp) return aux.ReleaseCheckMMZ(sg,tp) and sg:IsExists(s.chk,1,nil,sg) end function s.chk(c,sg) return c:IsCode(58071123) and sg:IsExists(Card.IsCode,2,c,43017476) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsCode,3,true,s.spcheck,nil,43017476,58071123) end local sg=Duel.SelectReleaseGroupCost(tp,Card.IsCode,3,3,true,s.spcheck,nil,43017476,58071123) Duel.Release(sg,REASON_COST) end function s.filter(c,e,tp) return (c:IsCode(85066822) or c:IsCode(6022371)) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=-1 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.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,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP) g:GetFirst():CompleteProcedure() end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.thfilter,1,nil) end function s.thfilter(c) return (c:IsCode(85066822) or c:IsCode(6022371)) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as an "Ultimate Crystal" card.) Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 7 DARK monsters with different names from your GY. You can banish all other DARK monsters from your field and GY; this card gains 500 ATK for each card banished this way.
--究極宝玉神 レインボー・ダーク・ドラゴン --Rainbow Dark Dragon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon Limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --Special summon procedure local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Increase ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetRange(LOCATION_MZONE) e3:SetCost(s.atkcost) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end function s.rescon(sg,e,tp,mg) return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:GetClassCount(Card.GetCode)==#sg,sg:GetClassCount(Card.GetCode)~=#sg end function s.spfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) return aux.SelectUnselectGroup(rg,e,tp,7,7,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,7,7,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) and aux.SpElimFilter(c,true,true) end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,e:GetHandler()) if chk==0 then return #g>0 and g:FilterCount(Card.IsAbleToRemoveAsCost,nil)==#g end e:SetLabel(#g) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabel()*500) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this Attack Position card is targeted for an attack: Change this card to Defense Position.
--暗黒ステゴ --Black Stego local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BE_BATTLE_TARGET) 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 e:GetHandler():IsAttackPos() end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters During the Main Phase (Quick Effect): You can target 1 face-up monster on the field or in either GY; place it face-up in its owner's Spell & Trap Zone as a Continuous Spell, also this card cannot use this effect next turn. During the Battle Phase (Quick Effect): You can target 1 monster and 1 Continuous Spell on the field; destroy them. You can only use each effect of "Snake-Eyes Vengeance Dragon" once per turn.
--蛇眼の断罪龍 --Snake-Eyes Vengeance Dragon --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Place 1 face-up monster on the field or in either GY face-up in its owner's Spell & Trap Zone as a Continuous Spell 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_MZONE) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return Duel.IsMainPhase() and not e:GetHandler():HasFlagEffect(id) end) e1:SetTarget(s.pltg) e1:SetOperation(s.plop) c:RegisterEffect(e1) --Destroy 1 monster and 1 Continuous Spell on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_BATTLE_START|TIMING_BATTLE_END|TIMINGS_CHECK_MONSTER) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function() return Duel.IsBattlePhase() end) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.plfilter(c) local p=c:GetOwner() return c:IsFaceup() and c:IsMonster() and Duel.GetLocationCount(p,LOCATION_SZONE)>0 and c:CheckUniqueOnField(p,LOCATION_SZONE) and (c:IsLocation(LOCATION_MZONE) or not c:IsForbidden()) end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.plfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.plfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectTarget(tp,s.plfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil):GetFirst() if tc:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tc,1,tp,0) end end function s.plop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then --Register a flag to prevent this card from using it again during the next turn c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,2,0,aux.Stringid(id,2)) end local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or tc:IsImmuneToEffect(e) then return end if tc:IsLocation(LOCATION_MZONE) and Duel.GetLocationCount(tc:GetOwner(),LOCATION_SZONE)==0 then Duel.SendtoGrave(tc,REASON_RULE,nil,PLAYER_NONE) elseif Duel.MoveToField(tc,tp,tc:GetOwner(),LOCATION_SZONE,POS_FACEUP,tc:IsMonsterCard()) then --Treat it as a Continuous Spell local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_SPELL|TYPE_CONTINUOUS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)) tc:RegisterEffect(e1) end end function s.desfilter(c,e) return c:IsCanBeEffectTarget(e) and (c:IsMonster() or (c:IsContinuousSpell() and c:IsFaceup())) end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsMonster,1,nil) and sg:IsExists(Card.IsContinuousSpell,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e) if chk==0 then return 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_DESTROY) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,2,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.Destroy(tg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, when your monster declares an attack on your opponent's Defense Position monster: You can activate this effect; during that battle, if that monster attacks a Defense Position monster, inflict piercing battle damage to your opponent.
--ランサー・デーモン --Lancer Archfiend local s,id=GetID() function s.initial_effect(c) --Make a monster inflict piercing damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.piercecon) e1:SetTarget(s.piercetg) e1:SetOperation(s.pierceop) c:RegisterEffect(e1) end function s.piercecon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() return d and a:IsControler(tp) and d:IsDefensePos() end function s.piercetg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.GetAttacker():CreateEffectRelation(e) end function s.pierceop(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if a:IsRelateToEffect(e) and a:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PIERCE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) a: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 add 1 Level 4 or lower "Magnet Warrior" monster from your Deck to your hand, except "Beta The Electromagnet Warrior". You can only use this effect of "Beta The Electromagnet Warrior" once per turn. During your opponent's turn: You can Tribute this card; Special Summon 1 Level 4 "Magnet Warrior" monster from your Deck (this is a Quick Effect).
--電磁石の戦士β --Beta The Electromagnet Warrior 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+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetHintTiming(0,TIMING_END_PHASE) e3:SetCondition(s.spcon) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_MAGNET_WARRIOR} s.listed_names={id} function s.thfilter(c) return c:IsSetCard(SET_MAGNET_WARRIOR) and not c:IsCode(id) and c:IsLevelBelow(4) 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.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MAGNET_WARRIOR) and c:IsLevel(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.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 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no face-up monsters, or the only face-up monsters you control are "R.B." monsters, you can Special Summon this card (from your hand). You can only Special Summon "R.B. VALCan Rocket" once per turn this way. If this card is linked to an "R.B." Link Monster: You can pay 1000 LP, then target up to 2 cards your opponent controls; destroy them, also this card, and if you do, inflict 500 damage to your opponent for each card destroyed. You can only use this effect of "R.B. VALCan Rocket" once per turn.
-- --R.B. VALCan Rocket --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --If you control no face-up monsters, on the only face-up monsters you control are "R.B." monsters, you can Special Summon this card (from your hand) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Destroy up to 2 cards your opponent controls, also this card, and if you do, inflict 500 damage to your opponent for each card destroyed local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetCost(Cost.PayLP(1000)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_RB} function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and (#g==0 or g:FilterCount(Card.IsSetCard,nil,SET_RB)==#g) end function s.desconfilter(c,ec,lg) return c:IsSetCard(SET_RB) and c:IsLinkMonster() and c:IsFaceup() and (lg:IsContains(c) or c:GetLinkedGroup():IsContains(ec)) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Duel.IsExistingMatchingCard(s.desconfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,c,c:GetLinkedGroup()) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,2,nil,tp)+e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*500) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tg=Duel.GetTargetCards(e) if c:IsRelateToEffect(e) then tg:AddCard(c) end if #tg==0 then return end local dam=Duel.Destroy(tg,REASON_EFFECT)*500 if dam>0 then Duel.Damage(1-tp,dam,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If your "Ninja" monster attacks a Defense Position monster, inflict piercing battle damage to your opponent. ---------------------------------------- [ Monster Effect ] You can reveal 1 "Ninjitsu Art" card in your hand; Special Summon this card from your hand. If this card attacks a Defense Position monster, inflict piercing battle damage.
--黄昏の忍者-ジョウゲン --Twilight Ninja Jogen local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --pierce local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_PIERCE) e1:SetRange(LOCATION_PZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_NINJA)) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) end s.listed_series={SET_NINJITSU_ART,SET_NINJA} function s.costfilter(c) return c:IsSetCard(SET_NINJITSU_ART) and not c:IsPublic() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 face-up FIRE monster to inflict 100 damage to your opponent for each FIRE monsters in your Graveyard.
--炎の魔精イグニス --Flame Spirit Ignis 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:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.damcost) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_FIRE) end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil) Duel.Release(g,REASON_COST) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_FIRE) end local dam=Duel.GetMatchingGroupCount(Card.IsAttribute,tp,LOCATION_GRAVE,0,nil,ATTRIBUTE_FIRE)*100 Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local dam=Duel.GetMatchingGroupCount(Card.IsAttribute,tp,LOCATION_GRAVE,0,nil,ATTRIBUTE_FIRE)*100 local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Damage(p,dam,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Toon World": Target 1 face-up monster your opponent controls; Special Summon 1 Toon monster from your hand or Deck, whose Level is less than or equal to the Level/Rank of that monster, ignoring its Summoning conditions.
--トゥーン・マスク --Toon Mask 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={15259703} function s.cfilter(c) return c:IsFaceup() and c:IsCode(15259703) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c,e,tp) local lv=0 if c:IsType(TYPE_XYZ) then lv=c:GetRank() else lv=c:GetLevel() end return c:IsFaceup() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp,lv) end function s.spfilter(c,e,tp,lv) return c:IsLevelBelow(lv) and c:IsType(TYPE_TOON) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) 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,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or tc:IsFacedown() then return end local lv=0 if tc:IsType(TYPE_XYZ) then lv=tc:GetRank() else lv=tc:GetLevel() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp,lv) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn, when a Spell/Trap Card that targets this card is activated: Negate the activation, and if you do, destroy it. When another face-up monster you control is targeted for an attack: You can send 1 Spell/Trap Card you control to the Graveyard; change the attack target to this card.
--青氷の白夜龍 --White Night Dragon local s,id=GetID() function s.initial_effect(c) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_F) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.negcon) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --change battle target local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.cbcon) e2:SetCost(s.cbcost) e2:SetTarget(s.cbtg) e2:SetOperation(s.cbop) c:RegisterEffect(e2) aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or not g:IsContains(c) then return false end return 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) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end end function s.cbcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bt=eg:GetFirst() return r~=REASON_REPLACE and c~=bt and bt:IsFaceup() and bt:GetControler()==c:GetControler() end function s.cfilter(c) return c:IsSpellTrap() and c:IsAbleToGraveAsCost() end function s.cbcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.cbtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end end function s.cbop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then Duel.ChangeAttackTarget(c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 4 monsters Any Xyz Material detached from a monster is banished instead of being sent to the GY. Once per Chain, if a Monster Card(s) is sent to the GY: You can detach 1 material from this card. If the last material(s) is detached from this card: You can target up to 3 cards in the GY(s); attach them to this card as material.
--魂喰魔獣 バズー --Bazoo the Soul Eater Beast --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Duel.EnableGlobalFlag(GLOBALFLAG_DETACH_EVENT) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 4 monsters Xyz.AddProcedure(c,nil,4,3) --Any Xyz Material detached from a monster is banished instead of being sent to the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_TO_GRAVE_REDIRECT) e1:SetRange(LOCATION_MZONE) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_OVERLAY) and not c:IsReason(REASON_LOST_TARGET) end) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1) --Detach 1 material from this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN) e2:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsMonsterCard,1,nil) end) e2:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end end) e2:SetOperation(s.detachop) c:RegisterEffect(e2) --Attach up to 3 cards in the GY(s) to this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_LEAVE_GRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_DETACH_MATERIAL) e3:SetCondition(function(e) return e:GetHandler():GetOverlayCount()==0 end) e3:SetTarget(s.attachtg) e3:SetOperation(s.attachop) c:RegisterEffect(e3) end function s.detachop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) end end function s.attachtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsCanBeXyzMaterial(c,tp,REASON_EFFECT) end if chk==0 then return Duel.IsExistingTarget(Card.IsCanBeXyzMaterial,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,c,tp,REASON_EFFECT) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local g=Duel.SelectTarget(tp,Card.IsCanBeXyzMaterial,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,3,nil,c,tp,REASON_EFFECT) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,#g,tp,0) end function s.attachop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end local tg=Duel.GetTargetCards(e):Filter(Card.IsCanBeXyzMaterial,nil,c,tp,REASON_EFFECT):Remove(Card.IsImmuneToEffect,nil,e) if #tg>0 then Duel.Overlay(c,tg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be destroyed by battle. The ATK of any monster that battles this card becomes 0 at the end of that Battle Phase. During your End Phase, change this face-up Defense Position card on the field to face-up Attack Position.
--レプティレス・ナージャ --Reptilianne Naga local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --atk change local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --pos change local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.postg) e3:SetOperation(s.posop) c:RegisterEffect(e3) end function s.filter(c,bc) return c:IsFaceup() and c:GetBattledGroup():IsContains(bc) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil,e:GetHandler()) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil,e:GetHandler()) 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.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsTurnPlayer(tp) and e:GetHandler():IsDefensePos() end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsDefensePos() then Duel.ChangePosition(c,0,0,POS_FACEUP_ATTACK,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 of your banished LIGHT or DARK monsters. If a face-up Xyz Monster(s) you control is banished, while this card is in your GY (except during the Damage Step): You can banish this card, then target 1 of those monsters; Special Summon it. You can only use each effect of "Galaxy Journey" once per turn.
--銀河超航行 --Galaxy Journey --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Special Summon 1 of your banished LIGHT or DARK monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Special Summon 1 of your banished Xyz Monsters local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_CUSTOM+id) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.xyzsptg) e2:SetOperation(s.xyzspop) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --Mass removal register local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_REMOVE) e3:SetRange(LOCATION_GRAVE) e3:SetLabelObject(e2) e3:SetOperation(s.regop) c:RegisterEffect(e3) end function s.lightdarkspfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK) and c:IsFaceup() 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.lightdarkspfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) 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.lightdarkspfilter,tp,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.regfilter(c,e,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousTypeOnField(TYPE_XYZ) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsPreviousControler(tp) and c:IsCanBeEffectTarget(e) and c:IsLocation(LOCATION_REMOVED) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPhase(PHASE_DAMAGE) then return end local tg=eg:Filter(s.regfilter,nil,e,tp) if #tg>0 then for tc in tg:Iter() do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) if Duel.GetFlagEffect(tp,id)==0 then Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end end function s.xyzsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=e:GetLabelObject():Filter(s.regfilter,nil,e,tp) if chkc then return g:IsContains(chkc) and s.regfilter(chkc,e,tp) end if chk==0 then return #g>0 end Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=g:Select(tp,1,1,nil) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,1,tp,0) end function s.xyzspop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summoned "Melodious" monsters you control cannot be destroyed by card effects. If this card was Special Summoned, all Fairy-Type monsters you control gain 300 ATK.
--幻奏の音女エレジー --Elegy the Melodious Diva local s,id=GetID() function s.initial_effect(c) --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.indtg) e1:SetValue(1) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_FAIRY)) e2:SetValue(300) e2:SetCondition(s.tgcon) c:RegisterEffect(e2) end s.listed_series={SET_MELODIOUS} function s.indtg(e,c) return c:IsSetCard(SET_MELODIOUS) and c:IsSpecialSummoned() end function s.tgcon(e) return e:GetHandler():IsSpecialSummoned() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can pay 1000 LP, then target 1 "Vampire" monster in your GY, except "Vampire Scarlet Scourge"; Special Summon it, but it cannot attack this turn. You can only use this effect of "Vampire Scarlet Scourge" once per turn. At the end of the Battle Phase, if this card destroyed any monster(s) by battle: You can Special Summon them from the GYs to your field.
--ヴァンパイア・スカージレット --Vampire Scarlet Scourge local s,id=GetID() function s.initial_effect(c) --If normal or special summoned, special summon 1 "Vampire" monster from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.sptg1) e1:SetOperation(s.spop1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Register when destroying a monster local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetOperation(s.regop) c:RegisterEffect(e3) --Special summon the monsters this card destroyed by battle local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PHASE|PHASE_BATTLE) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end) e4:SetTarget(s.sptg2) e4:SetOperation(s.spop2) c:RegisterEffect(e4) end s.listed_names={id} s.listed_series={SET_VAMPIRE} function s.spfilter1(c,e,tp) return c:IsSetCard(SET_VAMPIRE) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter1(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter1,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE,0,1) end function s.spfilter2(c,e,tp,rc,tid) return c:IsReason(REASON_BATTLE) and c:GetReasonCard()==rc and c:GetTurnID()==tid and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) end local g=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,LOCATION_GRAVE) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=nil local tg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter2),tp,LOCATION_GRAVE,LOCATION_GRAVE,nil,e,tp,e:GetHandler(),Duel.GetTurnCount()) if #tg>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) g=tg:Select(tp,ft,ft,nil) else g=tg end if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can send 1 "Gem-Knight" or "Melodious" monster from your hand or Deck to the Graveyard, and if you do, this card's name becomes the sent monster's name, until the End Phase. If this card is in your Graveyard: You can banish 1 Fusion Monster from your Graveyard; Special Summon this card in Defense Position. You can only use this effect of "Crystal Rose" once per turn.
--クリスタル・ローズ --Crystal Rose local s,id=GetID() function s.initial_effect(c) --Send 1 "Gem-Knight" or "Melodious" monster from your hand or Deck to the Graveyard, and if you do, this card's name becomes the sent monster's name, until the End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Special Summon this card in Defense Position 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:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_GEM_KNIGHT,SET_MELODIOUS} function s.tgfilter(c) return c:IsSetCard({SET_GEM_KNIGHT,SET_MELODIOUS}) and c:IsMonster() 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) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil):GetFirst() if sc and Duel.SendtoGrave(sc,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) and c:IsFaceup() then --This card's name becomes the sent monster's name, until the End Phase local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(sc:GetCode()) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.spcostfilter(c,tp) return c:IsType(TYPE_FUSION) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,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:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can either: Target 1 monster you control; equip this card to that target, OR: Unequip this card and Special Summon it. A monster equipped with this card is treated as a Tuner, it gains 500 ATK/DEF, also if the equipped monster would be destroyed by battle or card effect, destroy this card instead.
--トルクチューン・ギア --Torque Tune Gear local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,nil) --add type local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_ADD_TYPE) e1:SetValue(TYPE_TUNER) c:RegisterEffect(e1) --atkup local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(500) c:RegisterEffect(e2) --defup local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) 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 Graveyard: Target that monster; Special Summon it in face-up Defense Position, but it is destroyed during your End Phase.
--リグレット・リボーン --Regretful Rebirth local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsLocation(LOCATION_GRAVE) and c:IsCanBeEffectTarget(e) and c:IsPreviousControler(tp) and c:IsReason(REASON_BATTLE) 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 eg:IsContains(chkc) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and eg:IsExists(s.filter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=eg:FilterSelect(tp,s.filter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESETS_STANDARD_PHASE_END,2) e1:SetCountLimit(1) tc:RegisterEffect(e1,true) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 "Scareclaw" monster or "Visas Starfrost" you control; it can attack while in face-up Defense Position this turn. If it does, apply its ATK or DEF (whichever is higher) for damage calculation. When your opponent activates a card or effect, while you control a "Scareclaw" monster in the Extra Monster Zone: You can send this face-up card to the GY; negate that effect. You can only use this effect of "Scareclaw Sclash" once per turn.
--肆世壊の牙掌突 --Scareclaw Sclash --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) --Target can attack while in Defense Position 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) e1:SetCondition(function(_,tp) return Duel.IsTurnPlayer(tp) and Duel.GetCurrentPhase()<PHASE_MAIN2 end) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Negate that effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.discon) e2:SetCost(s.discost) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) end s.listed_series={SET_SCARECLAW} s.listed_names={CARD_VISAS_STARFROST} function s.atkfilter(c) return c:IsFaceup() and (c:IsSetCard(SET_SCARECLAW) or c:IsCode(CARD_VISAS_STARFROST)) and not c:IsLinkMonster() and not c:IsHasEffect(EFFECT_CANNOT_ATTACK) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO) 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 not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end --Can attack while in Defense Position local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DEFENSE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetValue(function(_,c) return c:GetAttack()>c:GetDefense() and 0 or 1 end) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SCARECLAW) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and Duel.IsChainDisablable(ev) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_EMZONE,0,1,nil) end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED) end Duel.SendtoGrave(c,REASON_COST) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not re:GetHandler():IsDisabled() end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "Igknight" monsters on the field gain 300 ATK and DEF. Once per turn: You can target 1 "Igknight" card you control; destroy it, and if you do, add 1 "Igknight" card from your Deck to your hand.
--イグニッションP --Ignition Phoenix local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk & def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetValue(300) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_IGKNIGHT)) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_FZONE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCountLimit(1) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_series={SET_IGKNIGHT} function s.desfilter(c) return c:IsFaceup() and c:IsSetCard(SET_IGKNIGHT) end function s.thfilter(c) return c:IsSetCard(SET_IGKNIGHT) and c:IsAbleToHand() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.desfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) 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:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 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 Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 Fiend monsters When a Spell/Trap Card, or monster effect, is activated that includes an effect that Special Summons a monster (Quick Effect): You can detach 1 material from this card; negate the activation, and if you do, destroy that card, then you can make 1 other "D/D" monster you control and this card gain 1800 ATK until the end of this turn. If this card is sent from the field to the GY: You can add 1 "Dark Contract" card from your Deck to your hand.
--DDD怒涛大王エグゼクティブ・シーザー --D/D/D Wave High King Caesar local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_FIEND),6,2) --Negate the activation of an effect that includes Special Summoning local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.negcon) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Search 1 "Dark Contract" card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.listed_series={SET_DD,SET_DARK_CONTRACT} function s.negcon(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) or not Duel.IsChainNegatable(ev) then return false end if not re:IsMonsterEffect() and not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return false end return re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) 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) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_DD) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and c:IsFaceup() and Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,0,1,c) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,c):GetFirst() if not tc then return end Duel.HintSelection(tc,true) Duel.BreakEffect() --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(1800) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() tc:RegisterEffect(e2) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.thfilter(c) return c:IsSetCard(SET_DARK_CONTRACT) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Destroy this card during your 3rd Standby Phase after activation. Activate this card when a face-up Dinosaur-Type monster you control is destroyed and sent to the Graveyard (except during the Damage Step): Choose 3 of your opponent's unused Spell & Trap Zones. Those Zones cannot be used. If this card destroys itself: You can target 1 Dinosaur-Type monster in your Graveyard; add that target to your hand.
--大地震 --Seismic Shockwave local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CUSTOM+id) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp) and c:IsReason(REASON_DESTROY) and c:IsRace(RACE_DINOSAUR) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_SZONE,PLAYER_NONE,0)>2 end local c=e:GetHandler() c:SetTurnCounter(0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) local dis=Duel.SelectDisableField(tp,3,0,LOCATION_SZONE,0) Duel.Hint(HINT_ZONE,tp,dis) e:SetLabel(dis) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(1-tp,LOCATION_SZONE,PLAYER_NONE,0)<3 then return end --disable field local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_SZONE) e1:SetCode(EFFECT_DISABLE_FIELD) e1:SetOperation(s.disop) e1:SetLabel(e:GetLabel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e:GetHandler():RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() ct=ct+1 c:SetTurnCounter(ct) if ct==3 and Duel.Destroy(c,REASON_EFFECT)>0 then Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end function s.disop(e,tp) return e:GetLabel() end function s.thfilter(c) return c:IsRace(RACE_DINOSAUR) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Draw 3 cards, then discard 2 cards.
--天使の施し --Graceful Charity local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) 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.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,3) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(3) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3) Duel.SetOperationInfo(0,CATEGORY_HANDES,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) if Duel.Draw(p,d,REASON_EFFECT)==3 then Duel.ShuffleHand(p) Duel.BreakEffect() Duel.DiscardHand(p,nil,2,2,REASON_EFFECT|REASON_DISCARD) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks or is attacked, during damage calculation (in either player's turn): You can pay 2000 LP once per battle; this card gains 3000 ATK during that damage calculation only.
--お注射天使リリー --Injection Fairy Lily local s,id=GetID() function s.initial_effect(c) --attack up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCondition(s.con) e1:SetCost(s.cost) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.con(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetFlagEffect(id)==0 and (Duel.GetAttacker()==c or Duel.GetAttackTarget()==c) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,2000) end Duel.PayLPCost(tp,2000) e:GetHandler():RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE_CAL,0,1) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(3000) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned by a card effect, except the effect of "Gladiator Beast Hoplomus". If this card is Special Summoned: add 1 "Gladiator Beast" Equip Spell from your Deck to your hand. At the end of the Battle Phase, if this card battled: You can shuffle this card into the Deck; Special Summon 1 "Gladiator Beast" monster from your Deck, except "Gladiator Beast Spartacus". * The above text is unofficial and describes the card's functionality in the OCG.
--剣闘獣スパルティクス --Gladiator Beast Spartacus local s,id=GetID() function s.initial_effect(c) --search 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_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.stg) e1:SetOperation(s.sop) 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_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfToDeck) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --special summon limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetValue(s.splimit) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_BEASTS_BATTLE,SET_GLADIATOR} function s.splimit(e,se,sp,st) return st==(SUMMON_TYPE_SPECIAL+101) or st&SUMMON_TYPE_PENDULUM==SUMMON_TYPE_PENDULUM end function s.sfilter(c) return c:IsSetCard(SET_BEASTS_BATTLE) and c:IsType(TYPE_EQUIP) and c:IsAbleToHand() end function s.stg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,0) end function s.sop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.sfilter,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():GetBattledGroupCount()>0 end function s.filter(c,e,tp) return not c:IsCode(id) and c:IsSetCard(SET_GLADIATOR) and c:IsCanBeSpecialSummoned(e,110,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,110,tp,tp,false,false,POS_FACEUP)>0 then tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT|RESETS_STANDARD_DISABLE,0,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control a Level 7 or higher "Ancient Warriors" monster, your opponent must pay 400 LP to activate a card or effect. You can only use each of the following effects of "Ancient Warriors - Savage Don Ying" once per turn. If this card is Normal or Special Summoned: You can add 1 Level 7 or higher "Ancient Warriors" monster or 1 "Ancient Warriors" Continuous Spell/Trap from your Deck to your hand. If a monster is sent to your opponent's GY (except during the Damage Step): You can target 1 card in your opponent's GY; banish it, and if you do, draw 1 card.
--戦華の暴-董穎 --Ancient Warriors - Savage Don Ying --Scripted by Larry126 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:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Activate cost local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_ACTIVATE_COST) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(0,1) e3:SetCondition(s.costcon) e3:SetCost(s.costchk) e3:SetOperation(s.costop) c:RegisterEffect(e3) --Accumulate local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(id) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetTargetRange(0,1) c:RegisterEffect(e4) --Banish local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetCategory(CATEGORY_REMOVE+CATEGORY_DRAW) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e5:SetCode(EVENT_TO_GRAVE) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1,{id,1}) e5:SetCondition(s.rmcon) e5:SetTarget(s.rmtg) e5:SetOperation(s.rmop) c:RegisterEffect(e5) end s.listed_series={SET_ANCIENT_WARRIORS} function s.thfilter(c) return c:IsSetCard(SET_ANCIENT_WARRIORS) and (c:IsLevelAbove(7) or c:IsType(TYPE_CONTINUOUS)) 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.cfilter(c) return c:IsSetCard(SET_ANCIENT_WARRIORS) and c:IsLevelAbove(7) and c:IsFaceup() end function s.costcon(e) return Duel.IsExistingMatchingCard(s.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.costchk(e,te_or_c,tp) local ct=#{Duel.GetPlayerEffect(tp,id)} return Duel.CheckLPCost(tp,ct*400) end function s.costop(e,tp,eg,ep,ev,re,r,rp) Duel.PayLPCost(tp,400) end function s.rmcfilter(c,tp) return c:IsMonster() and c:IsControler(1-tp) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.rmcfilter,1,nil,tp) end function s.rmfilter(c) return c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) and Duel.IsPlayerCanDraw(tp,1) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.rmop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_REMOVED) then Duel.Draw(tp,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control a "Memento" monster, your opponent's monsters that can attack must attack the "Memento" monster you control with the highest ATK (their choice, if tied). When your opponent activates a monster effect on the field (except during the Damage Step): You can target 1 "Mementoal Tecuhtlica - Combined Creation" you control; it loses exactly 1000 ATK/DEF, and if it does, negate that activated effect. You can only activate this effect of "Mementotlan Cranium Burst" once per Chain.
--メメント・クレニアム・バースト --Mementotlan Cranium Burst --Scripted by Satellaa 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) e0:SetHintTiming(TIMING_ATTACK,TIMINGS_CHECK_MONSTER_E|TIMING_ATTACK) c:RegisterEffect(e0) --Opponent's monsters must attack your "Memento" monster with the highest ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_MUST_ATTACK) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetCondition(s.atcon) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_MUST_ATTACK_MONSTER) e2:SetValue(s.atlimit) c:RegisterEffect(e2) --Negate a monster effect activated in your opponent's field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE+CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.negcon) e3:SetTarget(s.negtg) e3:SetOperation(s.negop) c:RegisterEffect(e3) end s.listed_series={SET_MEMENTO} s.listed_names={CARD_MEMENTOAL_TECUHTLICA} function s.atcon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_MEMENTO),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.atlimit(e,c) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_MEMENTO),e:GetHandlerPlayer(),LOCATION_MZONE,0,nil) return g:GetMaxGroup(Card.GetAttack):IsContains(c) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) return re:IsMonsterEffect() and (loc&LOCATION_MZONE)~=0 and ep==1-tp and Duel.IsChainDisablable(ev) end function s.cfilter(c) return c:IsFaceup() and c:IsCode(CARD_MEMENTOAL_TECUHTLICA) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc:IsCode(CARD_MEMENTOAL_TECUHTLICA) end if chk==0 then return not Duel.HasFlagEffect(tp,id) and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsCode,CARD_MEMENTOAL_TECUHTLICA),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsCode,CARD_MEMENTOAL_TECUHTLICA),tp,LOCATION_MZONE,0,1,1,nil) Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,EFFECT_FLAG_OATH,1) Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:UpdateAttack(-1000,RESET_EVENT|RESETS_STANDARD,c)==-1000 and tc:UpdateDefense(-1000,RESET_EVENT|RESETS_STANDARD,c)==-1000 then Duel.NegateEffect(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Any monster sent from the hand or Main Deck to the GY is banished instead. When a Spell/Trap Card, or monster effect, is activated (Quick Effect): You can Tribute this card; negate the activation, and if you do, destroy that card. If this card is sent to the GY: You can add 1 Ritual Monster or 1 Ritual Spell from your Deck to your hand.
--虹光の宣告者 --Herald of the Arc Light local s,id=GetID() function s.initial_effect(c) --Synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --Location redirection local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetCode(EFFECT_TO_GRAVE_REDIRECT) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.rmtarget) e1:SetTargetRange(LOCATION_HAND|LOCATION_DECK,LOCATION_HAND|LOCATION_DECK) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1) --Negate activation local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.discon) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) --Add from the deck to the 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:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.rmtarget(e,c) return c:IsMonster() and Duel.IsPlayerCanRemove(e:GetHandlerPlayer(),c) end function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end return (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.filter(c) return c:IsType(TYPE_RITUAL) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Chaos Form". If this card is Special Summoned: You can Tribute 1 monster; your opponent cannot activate monster effects this turn. When this card destroys an opponent's monster by battle: You can target 1 Spell in your GY; add it to your hand. You can only use each effect of "Magician of Black Chaos MAX" once per turn.
--マジシャン・オブ・ブラックカオス・MAX --Magician of Black Chaos MAX --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --prevent activation local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCost(s.actcost) e1:SetOperation(s.actop) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.bdocon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={21082832} function s.actcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,false,nil,nil) end local sg=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,nil,nil) Duel.Release(sg,REASON_COST) end function s.actop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(0,1) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.aclimit(e,re,tp) return re:IsMonsterEffect() end function s.thfilter(c) return c:IsSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 5 WATER monsters You can also Xyz Summon this card by using "Number 37: Hope Woven Dragon Spider Shark" you control (transfer its materials to this card). Once per turn: You can detach 1 material from this card, then target 1 monster your opponent controls; banish it (until their next Standby Phase), and if you do, any monsters they currently control lose 1000 ATK until the end of this turn. Once per turn, during the End Phase, if this card is in your GY because this Xyz Summoned card was destroyed and sent there this turn: You can Special Summon it.
--SNo.37 スパイダー・シャーク --Number S37: Spider Shark --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 5 WATER monsters, or 1 "Number 37: Hope Woven Dragon Spider Shark" Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_WATER),5,3,s.ovfilter,aux.Stringid(id,0)) --Banish 1 opponent's monster until their next Standby Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1,1)) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={37279508} --"Number 37: Hope Woven Dragon Spider Shark" s.xyz_number=37 function s.ovfilter(c,tp,lc) return c:IsSummonCode(lc,SUMMON_TYPE_XYZ,tp,37279508) and c:IsFaceup() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and aux.RemoveUntil(tc,nil,REASON_EFFECT,PHASE_STANDBY,id,e,tp,aux.DefaultFieldReturnOp,function() return Duel.IsTurnPlayer(1-tp) end) then local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) if #g==0 then return end local c=e:GetHandler() for atkc in g:Iter() do --It loses 1000 ATK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-1000) e1:SetReset(RESETS_STANDARD_PHASE_END) atkc:RegisterEffect(e1) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetTurnID()==Duel.GetTurnCount() and c:IsXyzSummoned() and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can Special Summon 1 Level 5 or higher Flip monster from your Deck in face-down Defense Position, except "Conbirdable". During the Battle Phase, if this card is in your hand (Quick Effect): You can target 1 face-down monster on the field; send it to the GY, and if you do, Special Summon this card in face-down Defense Position. You can only use each effect of "Conbirdable" once per turn.
--半纏鳥官-コンバード --Conbirdable --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Level 5 or higher Flip monster from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.dsptg) e1:SetOperation(s.dspop) c:RegisterEffect(e1) --Special Summon this card in face-down Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_BATTLE_START|TIMING_BATTLE_END) e2:SetCondition(function() return Duel.IsBattlePhase() end) e2:SetTarget(s.selfsptg) e2:SetOperation(s.selfspop) c:RegisterEffect(e2) end s.listed_names={id} function s.dspfilter(c,e,tp) return c:IsLevelAbove(5) and c:IsType(TYPE_FLIP) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.dsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.dspfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.dspop(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 sg=Duel.SelectMatchingCard(tp,s.dspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,sg) end end function s.tgfilter(c,tp) return c:IsFacedown() and c:IsAbleToGrave() and Duel.GetMZoneCount(tp,c)>0 end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,tc,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc:IsRelateToEffect(e) and Duel.SendtoGrave(tc,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target Insect-Type monsters for attacks, except this one. If this card is Special Summoned: You can Special Summon 1 "Block Spider" from your Deck. You can only use this effect of "Block Spider" once per turn.
--ブロック・スパイダー --Block Spider local s,id=GetID() function s.initial_effect(c) --cannot be battle target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(s.bttg) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} function s.bttg(e,c) return c:IsFaceup() and c:IsRace(RACE_INSECT) and c~=e:GetHandler() end function s.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) 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:
Negate the activation of an Equip Spell Card and destroy it.
--アーマーブレイク --Armor Break local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsActiveType(TYPE_EQUIP) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters While your LP are higher than your opponent's, your opponent cannot target Plant monsters you control with card effects. You can only use each of the following effects of "Aromaseraphy Sweet Marjoram" once per turn. ● If this card is Synchro Summoned: You can add 1 "Humid Winds", "Dried Winds", or "Blessed Winds" from your Deck to your hand. ● If you gain LP: Target 1 card your opponent controls; destroy it.
--アロマセラフィ-スイート・マジョラム --Aromaseraphy Sweet Marjoram local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCondition(s.adcon) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_PLANT)) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --activate(destroy) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_RECOVER) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_names={28265983,92266279,15177750} function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.thfilter(c) return c:IsCode(28265983,92266279,15177750) 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 tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function s.adcon(e) local tp=e:GetHandlerPlayer() return Duel.GetLP(tp)>Duel.GetLP(1-tp) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return ep==tp end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(1-tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) if g then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can reduce the Levels of all Insect monsters you currently control by 1. If the battle position of this card is changed: You can Special Summon 1 "Oily Cicada" from your hand, Deck, or GY. You can only use each effect of "Oily Cicada" once per turn.
--オイリーゼミ --Oily Cicada --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Decrease levels of Insect monsters by 1 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE) 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.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon 1 "Oily Cicada" if this card's position changes local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_CHANGE_POS) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={id} function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) and c:IsLevelAbove(2) 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 end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) if #g==0 then return end local c=e:GetHandler() for tc in g:Iter() do --Reduce Level by 1 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(-1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.spfilter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target "Danger!" monsters you control with card effects during the turn they are Special Summoned. Once per turn: You can target 1 "Danger!" monster you control; while you control that face-up monster and this face-up card, that monster can attack directly, also your opponent's monsters cannot target it for attacks, but it does not prevent your opponent from attacking you directly.
--未界域-ユーマリア大陸 --Realm of Danger! --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.target) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --direct attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetTarget(s.datg) e3:SetOperation(s.daop) c:RegisterEffect(e3) end s.listed_series={SET_DANGER} function s.target(e,c) return c:IsSetCard(SET_DANGER) and c:IsStatus(STATUS_SPSUMMON_TURN) end function s.dafilter(c) return c:IsFaceup() and c:IsSetCard(SET_DANGER) end function s.datg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.dafilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.dafilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.dafilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.daop(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) and tc:IsFaceup()) then return end c:SetCardTarget(tc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_SINGLE_RANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetCondition(s.rcon) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_IGNORE_BATTLE_TARGET) e2:SetValue(1) tc:RegisterEffect(e2) end function s.rcon(e) return e:GetOwner():IsHasCardTarget(e:GetHandler()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be destroyed by battle. If this card is in face-up Defense Position, destroy it. If this card is Normal Summoned: Place 1 Fog Counter on it for each "Cloudian" monster on the field. You can remove 3 Fog Counters from anywhere on the field; discard 1 random card from your opponent's hand.
--雲魔物-アルトス --Cloudian - Altus local s,id=GetID() function s.initial_effect(c) --battle indestructable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --selfdes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_SELF_DESTROY) e2:SetCondition(s.sdcon) c:RegisterEffect(e2) --counter local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_COUNTER) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetOperation(s.addc) c:RegisterEffect(e3) --handes local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_HANDES) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCost(s.hdcost) e4:SetTarget(s.hdtg) e4:SetOperation(s.hdop) c:RegisterEffect(e4) end s.listed_series={SET_CLOUDIAN} s.counter_place_list={COUNTER_FOG} function s.sdcon(e) return e:GetHandler():IsPosition(POS_FACEUP_DEFENSE) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_CLOUDIAN) end function s.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then local ct=Duel.GetMatchingGroupCount(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) e:GetHandler():AddCounter(COUNTER_NEED_ENABLE+COUNTER_FOG,ct) end end function s.hdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,COUNTER_FOG,3,REASON_COST) end Duel.RemoveCounter(tp,1,1,COUNTER_FOG,3,REASON_COST) end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)~=0 end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND):RandomSelect(tp,1) Duel.SendtoGrave(g,REASON_EFFECT|REASON_DISCARD) end