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:
If this card in your possession is destroyed by an opponent's card and sent to your GY: Shuffle this card into the Deck. When this card is Normal Summoned: You can Special Summon 1 "Madolche" monster from your hand. * The above text is unofficial and describes the card's functionality in the OCG.
--マドルチェ・ミィルフィーヤ --Madolche Mewfeuille local s,id=GetID() function s.initial_effect(c) --to deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.retcon) e1:SetTarget(s.rettg) e1:SetOperation(s.retop) c:RegisterEffect(e1) --summon success local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_MADOLCHE} function s.retcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp and e:GetHandler():IsPreviousControler(tp) end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.retop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.filter(c,e,tp) return c:IsSetCard(SET_MADOLCHE) 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:
If the only face-up monsters on the field are 2 "Meklord" monsters: Draw 2 cards. You cannot conduct your Battle Phase the turn you activate this card.
--機皇帝の賜与 --Boon of the Meklord Emperor local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_MEKLORD} function s.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) return #g==2 and g:GetFirst():IsSetCard(SET_MEKLORD) and g:GetNext():IsSetCard(SET_MEKLORD) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPhase(PHASE_MAIN1) end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BP) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner FIRE monsters When this card is Synchro Summoned: Send 1 card from your hand to the Graveyard. If this card would be destroyed by a card effect, you can banish 1 "Laval" monster from your Graveyard instead.
--ラヴァル・グレイター --Laval the Greater local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_FIRE),1,99) c:EnableReviveLimit() --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetTarget(s.desreptg) c:RegisterEffect(e2) end s.listed_series={SET_LAVAL} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_EFFECT) end function s.repfilter(c) return c:IsSetCard(SET_LAVAL) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT) and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end if Duel.SelectEffectYesNo(tp,c,96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) return true else return false end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Immediately after this effect resolves, Link Summon 1 Link Monster using monster(s) you control as material. You can only activate 1 "World Legacy Awakens" per turn.
--星遺物からの目醒め --World Legacy Awakens local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.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.IsExistingMatchingCard(Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,Card.IsLinkSummonable,tp,LOCATION_EXTRA,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.LinkSummon(tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can shuffle 1 "Spellbook" Spell Card from your Graveyard into your Deck to target 1 face-up Spellcaster-Type monster on the field; increase its Level by 1 and its ATK by 500.
--魔導戦士 フォルス --Strength of Prophecy local s,id=GetID() function s.initial_effect(c) --atk/lv up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_SPELLBOOK} function s.cfilter(c) return c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() and c:IsAbleToDeckAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_SPELLCASTER) and c:IsLevelAbove(1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(500) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_LEVEL) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(1) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is added to your hand, except by drawing it: You can Special Summon this card. You can only use this effect of "Agnimal Candle" once per turn. Once per Chain, up to thrice per turn, if a monster is sent to your GY (except during the Damage Step): You can increase or decrease this card's Level by 1.
--火天獣-キャンドル --Agnimal Candle --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself when added to the hand 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_DELAY) e1:SetCode(EVENT_TO_HAND) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return not e:GetHandler():IsReason(REASON_DRAW) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Increase or decrease this card's Level by 1 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE) 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(3) e2:SetCondition(s.lvcon) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) 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 function s.cfilter(c,tp) return c:IsMonster() and c:IsControler(tp) end function s.lvcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:HasLevel() and not c:HasFlagEffect(id) end c:RegisterFlagEffect(id,RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,c,1,tp,0) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsFaceup() and c:IsRelateToEffect(e) and c:HasLevel()) then return end local b1=true local b2=c:IsLevelAbove(2) local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, --Increase its Level by 1 {b2,aux.Stringid(id,3)}) --Decrease its Level by 1 local value=(op==1 and op) or -1 ---Increase or decrease its Level by 1 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(value) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This effect can be used during either player's turn. When your opponent activates a Trap Card, Tribute this face-up card to negate the activation of the Trap Card and destroy it.
--トラップ処理班 Aチーム --A-Team: Trap Disposal Unit 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_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and rp~=tp and re:IsTrapEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then 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:
3 Level 5 monsters Once per turn, this card cannot be destroyed by battle. If this card has "Comics Hero King Arthur" as an Xyz Material, it gains this effect. ● When this card destroys a monster by battle and sends it to the Graveyard: You can detach 1 Xyz Material from this card; banish the destroyed monster, and if you do, inflict damage to your opponent equal to its original ATK.
--CX-CH レジェンド・アーサー --CXyz Comics Hero Legend Arthur local s,id=GetID() function s.initial_effect(c) --Xyz Summon procedure: 3 Level 5 monsters Xyz.AddProcedure(c,nil,5,3) c:EnableReviveLimit() --Once per turn, this card cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetCountLimit(1) e1:SetValue(s.valcon) c:RegisterEffect(e1) --Banish a monster destroyed by battle with this card and inflict damage to your opponent equal to its original ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE+CATEGORY_DAMAGE) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCondition(s.damcon) e2:SetCost(Cost.DetachFromSelf(1,1,nil)) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_names={77631175} --"Comics Hero King Arthur" function s.valcon(e,re,r,rp) return (r&REASON_BATTLE)~=0 end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return c:GetOverlayGroup():IsExists(Card.IsCode,1,nil,77631175) and c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc:IsMonster() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return not Duel.IsPlayerAffectedByEffect(bc:GetControler(),CARD_SPIRIT_ELIMINATION) and bc:IsAbleToRemove() end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_REMOVE,bc,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,bc:GetBaseAttack()) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetFirstTarget() if bc and bc:IsRelateToEffect(e) and Duel.Remove(bc,POS_FACEUP,REASON_EFFECT)>0 then Duel.Damage(1-tp,bc:GetBaseAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a face-up Xyz Monster. It gains ATK equal to its Rank x 200. If you would detach material to activate the effect of the equipped monster you control, you can send this card to the GY instead of detaching one of the materials required. * The above text is unofficial and describes the card's functionality in the OCG.
--エクシーズ・ユニット --Xyz Unit local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsType,TYPE_XYZ)) --ATK increase local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.atkval) c:RegisterEffect(e1) --Cost replacement local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_OVERLAY_REMOVE_REPLACE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.rcon) e2:SetOperation(s.rop) c:RegisterEffect(e2) end function s.atkval(e,c) return c:GetRank()*200 end function s.rcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_COST)~=0 and re:IsActivated() and re:IsActiveType(TYPE_XYZ) and ep==e:GetOwnerPlayer() and e:GetHandler():GetEquipTarget()==re:GetHandler() and re:GetHandler():GetOverlayCount()>=ev-1 end function s.rop(e,tp,eg,ep,ev,re,r,rp) return Duel.SendtoGrave(e:GetHandler(),REASON_COST) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "True Draco" and "True King" monsters on the field gain 300 ATK/DEF. The first time each Tribute Summoned "True Draco" or "True King" monster would be destroyed by battle each turn, it is not destroyed. Once per turn: You can destroy 1 other card you control or in your hand, and if you do, add 1 "True Draco" or "True King" card from your Deck to your hand.
--ドラゴニックD --Dragonic Diagram 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) --All "True Draco" and "True King" monsters on the field gain 300 ATK/DEF local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_FIELD) e1a:SetCode(EFFECT_UPDATE_ATTACK) e1a:SetRange(LOCATION_FZONE) e1a:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1a:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_TRUE_DRACO_KING)) e1a:SetValue(300) c:RegisterEffect(e1a) local e1b=e1a:Clone() e1b:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e1b) --The first time each Tribute Summoned "True Draco" or "True King" monster would be destroyed by battle each turn, it is not destroyed local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(function(e,c) return c:IsTributeSummoned() and c:IsSetCard(SET_TRUE_DRACO_KING) end) e2:SetValue(function(e,re,r,rp) return (r&REASON_BATTLE)>0 and 1 or 0 end) c:RegisterEffect(e2) --Destroy 1 other card you control or in your hand, and if you do, add 1 "True Draco" or "True King" card from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_series={SET_TRUE_DRACO_KING} function s.thfilter(c) return c:IsSetCard(SET_TRUE_DRACO_KING) and c:IsAbleToHand() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_HAND|LOCATION_ONFIELD,0,e:GetHandler()) if chk==0 then return #g>0 and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local exc=c:IsRelateToEffect(e) and c or nil Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,exc) if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 Reptile monster, then discard 1 card; Special Summon 1 Level 6 or lower FIRE Dinosaur monster from your Deck. You can banish this card from your GY, then target 1 Dragon Xyz Monster you control with no material; attach up to 2 Reptile and/or Dinosaur monsters with different names from your hand and/or GY to that monster as material. You can only use each effect of "Evoltile Megachirella" once per turn.
--エヴォルド・メガキレラ --Evoltile Megachirella --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Level 6 or lower FIRE Dinosaur monster from your Deck 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:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Attach up to 2 Reptile and/or Dinosaur monsters with different names from your hand and/or GY to 1 Dragon Xyz monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.atchcost) e2:SetTarget(s.atchtg) e2:SetOperation(s.atchop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsRace(RACE_DINOSAUR) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsLevelBelow(6) and c:IsCanBeSpecialSummoned(e,151,tp,false,false,POS_FACEUP) end function s.costfilter(c,e,tp,ft) return c:IsRace(RACE_REPTILE) and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup()) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end function s.spcost(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.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,e,tp,ft) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end local sg=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,e,tp,ft) Duel.Release(sg,REASON_COST) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc then Duel.SpecialSummon(tc,151,tp,tp,false,false,POS_FACEUP) end end function s.xyzfilter(c) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_XYZ) and c:GetOverlayCount()==0 end function s.atchcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,RACE_REPTILE|RACE_DINOSAUR) end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function s.atchtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,RACE_REPTILE|RACE_DINOSAUR) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atchop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsImmuneToEffect(e) and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,RACE_REPTILE|RACE_DINOSAUR) then local g=Duel.GetMatchingGroup(Card.IsRace,tp,LOCATION_HAND|LOCATION_GRAVE,0,nil,RACE_REPTILE|RACE_DINOSAUR) local sg=aux.SelectUnselectGroup(g,e,tp,1,2,aux.dncheck,1,tp,HINTMSG_ATTACH) if sg then Duel.Overlay(tc,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 Ritual Spell from your Deck to your hand, and add 1 Ritual Monster from your Deck or GY to your hand whose name is mentioned on that Ritual Spell. You can only activate 1 "Pre-Preparation of Rites" per turn.
--儀式の下準備 --Pre-Preparation of Rites local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,tp) return c:IsRitualSpell() and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil,c) end function s.filter2(c,mc) return c:IsRitualMonster() and c:IsAbleToHand() and s.isfit(c,mc) end function s.isfit(c,mc) return (mc.fit_monster and c:IsCode(table.unpack(mc.fit_monster))) or mc:ListsCode(c:GetCode()) end function s.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,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,tp) if #g>0 then local mg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter2),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,g:GetFirst()) if #mg>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=mg:Select(tp,1,1,nil) g:Merge(sg) 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:
Special Summon 1 "Tistina" monster from your hand or GY in Defense Position, but return it to the hand during the End Phase. You can only activate 1 "Play of the Tistina" per turn.
--ティスティナの戯れ --Play of the Tistina --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Tistina" monster from your hand or GY in Defense Position 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,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_TISTINA} function s.spfilter(c,e,tp) return c:IsSetCard(SET_TISTINA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Return it to the hand during the End Phase aux.DelayedOperation(g,PHASE_END,id,e,tp,function(ag) Duel.SendtoHand(ag,nil,REASON_EFFECT) end,nil,0,0,aux.Stringid(id,1)) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] You cannot Special Summon monsters, except "Qli" monsters. This effect cannot be negated. All "Qli" monsters you control gain 300 ATK. ---------------------------------------- [ Monster Effect ] You can Normal Summon this card without Tributing. If this card is Normal Summoned without Tributing, or is Special Summoned, its Level becomes 4 and its original ATK becomes 1800. If this card is Normal Summoned/Set, it is unaffected by activated effects from any monster whose original Level/Rank is lower than this card's current Level. When this card is Tribute Summoned by Tributing a "Qli" monster(s): You can target 1 card on the field; return it to the hand. Your opponent cannot activate cards or effects in response to this effect's activation.
--クリフォート・エイリアス --Qliphort Stealth local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --splimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_PZONE) e2:SetTargetRange(1,0) e2:SetCondition(s.splimcon) e2:SetTarget(s.splimit) c:RegisterEffect(e2) --atk up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_PZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_QLI)) e3:SetValue(300) c:RegisterEffect(e3) --summon with no tribute local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_SUMMON_PROC) e4:SetCondition(s.ntcon) c:RegisterEffect(e4) --change level local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_SUMMON_COST) e5:SetOperation(s.lvop) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE) e6:SetCode(EFFECT_SPSUMMON_COST) e6:SetOperation(s.lvop2) c:RegisterEffect(e6) --immune local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_SINGLE) e7:SetCode(EFFECT_IMMUNE_EFFECT) e7:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE) e7:SetRange(LOCATION_MZONE) e7:SetCondition(s.immcon) e7:SetValue(aux.qlifilter) c:RegisterEffect(e7) --tohand local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(id,1)) e8:SetCategory(CATEGORY_TOHAND) e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e8:SetCode(EVENT_SUMMON_SUCCESS) e8:SetProperty(EFFECT_FLAG_CARD_TARGET) e8:SetCondition(s.thcon) e8:SetTarget(s.thtg) e8:SetOperation(s.thop) c:RegisterEffect(e8) --tribute check local e9=Effect.CreateEffect(c) e9:SetType(EFFECT_TYPE_SINGLE) e9:SetCode(EFFECT_MATERIAL_CHECK) e9:SetValue(s.valcheck) e9:SetLabelObject(e8) c:RegisterEffect(e9) end s.listed_series={SET_QLI} function s.splimcon(e) return not e:GetHandler():IsForbidden() end function s.splimit(e,c) return not c:IsSetCard(SET_QLI) end function s.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.lvcon(e) return e:GetHandler():GetMaterialCount()==0 end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.lvcon) e1:SetValue(4) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_BASE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.lvcon) e2:SetValue(1800) e2:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) c:RegisterEffect(e2) end function s.lvop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(4) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE)&~(RESET_TOFIELD|RESET_LEAVE)) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_BASE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(1800) e2:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE)&~(RESET_TOFIELD|RESET_LEAVE)) c:RegisterEffect(e2) end function s.immcon(e) return e:GetHandler():IsNormalSummoned() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsTributeSummoned() and e:GetLabel()==1 end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetChainLimit(s.chlimit) end function s.chlimit(e,ep,tp) return tp==ep end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsSetCard,1,nil,SET_QLI) then e:GetLabelObject():SetLabel(1) else e:GetLabelObject():SetLabel(0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 LIGHT Tuner + 1+ non-Tuner DARK monsters If any card(s) have been banished this turn, this card gains 2000 ATK. This card can attack all monsters your opponent controls, once each, also banish any monster destroyed by battle with this card. If this card in its owner's control leaves the field because of an opponent's card: You can Special Summon 1 "Chaos" Synchro Monster from your Extra Deck, except "Chaos Archfiend". You can only use this effect of "Chaos Archfiend" once per turn.
--カオス・デーモン-混沌の魔神- --Chaos Archfiend --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon Procedure Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_DARK),1,99) --Gains 2000 ATK the turn a card is banished local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetCondition(function() return Duel.HasFlagEffect(0,id) end) e1:SetValue(2000) c:RegisterEffect(e1) --Can attack all monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ATTACK_ALL) e2:SetValue(1) c:RegisterEffect(e2) --Banish monsters destroyed by battle local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_BATTLE_DESTROY_REDIRECT) e3:SetValue(LOCATION_REMOVED) c:RegisterEffect(e3) --Special Summon 1"Chaos" Synchro Monster local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCountLimit(1,id) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) --Register if a card is removed aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_REMOVE) ge1:SetOperation(function() Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end) Duel.RegisterEffect(ge1,0) end) end s.listed_series={SET_CHAOS} s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_CHAOS) and c:IsType(TYPE_SYNCHRO) and not c:IsCode(id) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 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_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a face-up Field Spell is in any Field Zone: You can Special Summon this card from your hand. You can banish this card in your GY and 1 Link Monster you control; destroy 1 card your opponent controls. You can only use each effect of "Grid Sweeper" once per turn.
--グリッド・スィーパー --Grid Sweeper --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_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:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_FIELD),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.descfilter(c) return c:IsLinkMonster() and c:IsAbleToRemoveAsCost() end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.descfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.descfilter,tp,LOCATION_MZONE,0,1,1,nil) g:AddCard(e:GetHandler()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_ONFIELD,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can excavate the top card of your Deck, and if it is a Normal Spell, send it to the GY, otherwise place it on the bottom of your Deck. During the Main Phase of your next turn, you can activate the effect of that Spell in your GY (even if you no longer control this face-up card).
--D-HERO ダイヤモンドガイ --Destiny HERO - Diamond Dude local s,id=GetID() function s.initial_effect(c) --Excavate the top card of your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return end Duel.ConfirmDecktop(tp,1) local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() if tc:IsNormalSpell() then Duel.DisableShuffleCheck() Duel.SendtoGrave(g,REASON_EFFECT) local ae=tc:GetActivateEffect() if tc:IsLocation(LOCATION_GRAVE) and ae then local e1=Effect.CreateEffect(tc) e1:SetDescription(ae:GetDescription()) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_GRAVE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL|RESET_PHASE|PHASE_END|RESET_SELF_TURN&~RESET_TOFIELD,2) e1:SetCondition(s.spellcon) e1:SetTarget(s.spelltg) e1:SetOperation(s.spellop) tc:RegisterEffect(e1) end else Duel.MoveToDeckBottom(tc) end end function s.spellcon(e,tp,eg,ep,ev,re,r,rp,chk) return e:GetHandler():GetTurnID()~=Duel.GetTurnCount() end function s.spelltg(e,tp,eg,ep,ev,re,r,rp,chk) local ae=e:GetHandler():GetActivateEffect() local ftg=ae:GetTarget() if chk==0 then return not ftg or ftg(e,tp,eg,ep,ev,re,r,rp,chk) end if ae:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then e:SetProperty(EFFECT_FLAG_CARD_TARGET) else e:SetProperty(0) end if ftg then ftg(e,tp,eg,ep,ev,re,r,rp,chk) end end function s.spellop(e,tp,eg,ep,ev,re,r,rp) local ae=e:GetHandler():GetActivateEffect() local fop=ae:GetOperation() fop(e,tp,eg,ep,ev,re,r,rp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Gem-Knight Sapphire" + 1 "Gem-Knight" monster Must first be Fusion Summoned with the above Fusion Material Monsters. If this card attacks, it is changed to Defense Position at the end of the Battle Phase. When this card is sent from the field to the Graveyard: Target 1 card your opponent controls; return that target to the hand.
--ジェムナイト・アクアマリナ --Gem-Knight Aquamarine local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,false,false,27126980,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GEM_KNIGHT)) --spsummon condition local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetValue(s.splimit) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --to defense local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_PHASE|PHASE_BATTLE) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.poscon) e4:SetOperation(s.posop) c:RegisterEffect(e4) end s.listed_series={SET_GEM_KNIGHT} s.material_setcode={SET_GEM,SET_GEM_KNIGHT} function s.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or (st&SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return (e:GetHandler():GetPreviousLocation()&LOCATION_ONFIELD)~=0 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 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,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackedCount()>0 end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsAttackPos() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters with different names If this card is Link Summoned: You can discard 1 card; during the End Phase of this turn, add 1 Continuous or Field Spell from your GY to your hand. You can only use this effect of "Barricadeborg Blocker" once per turn. Face-up Spells you control cannot be destroyed by your opponent's card effects.
--警衛バリケイドベルグ --Barricadeborg Blocker --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Link summon procedure Link.AddProcedure(c,nil,2,2,s.lcheck) --Add 1 continuous or field spell from GY during end phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.regcon) e1:SetCost(s.regcost) e1:SetTarget(s.regtg) e1:SetOperation(s.regop) c:RegisterEffect(e1) --Your face-up spells cannot be destroyed by opponent's 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:SetTarget(s.imtg) e2:SetValue(aux.indoval) c:RegisterEffect(e2) end function s.lcheck(g,lc) return g:GetClassCount(Card.GetCode)==#g end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLinkSummoned() end function s.regcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.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_GRAVE) 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:IsAbleToHand() and c:IsSpell() and c:IsType(TYPE_FIELD+TYPE_CONTINUOUS) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,PLAYER_ALL,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.imtg(e,c) return c:IsFaceup() and c:IsSpell() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 4 or lower Dragon monster You cannot Special Summon monsters, except Dragon monsters. During your Main Phase: You can target 1 of your Dragon monsters that is banished or in your GY; Special Summon it to your zone that 2 or more Link Monsters point to. You can only use this effect of "Guardragon Pisty" once per turn. You can only Special Summon "Guardragon Pisty(s)" once per turn.
--守護竜ピスティ --Guardragon Pisty --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --Link summon procedure c:EnableReviveLimit() Link.AddProcedure(c,s.matfilter,1,1) --Cannot be special summoned local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) c:RegisterEffect(e1) --Special summon 1 Dragon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.matfilter(c,lc,sumtype,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON,lc,sumtype,tp) end function s.sumlimit(e,c) return not c:IsRace(RACE_DRAGON) end function s.filter(c,e,tp,zone) return c:IsRace(RACE_DRAGON) 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=Duel.GetZoneWithLinkedCount(2,tp)&ZONES_MMZ if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and s.filter(chkc,e,tp,zone) end if chk==0 then return 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 tc=Duel.GetFirstTarget() local zone=Duel.GetZoneWithLinkedCount(2,tp)&ZONES_MMZ if tc and tc:IsRelateToEffect(e) and zone~=0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a face-up "Gagaga" monster(s) you control is targeted by the effect of an opponent's monster: Negate the effect of that opponent's monster, and if you do, destroy it, then inflict damage to your opponent equal to the destroyed monster's ATK or DEF in the Graveyard (whichever is higher).
--ガガガラッシュ --Gagagarush local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE+CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BECOME_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GAGAGA} function s.filter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_GAGAGA) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and re:IsMonsterEffect() and eg:IsExists(s.filter,1,nil,tp) and Duel.IsChainDisablable(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_DISABLE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,re:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(re:GetHandler(),REASON_EFFECT)~=0 then Duel.BreakEffect() local a=re:GetHandler():GetAttack() local b=re:GetHandler():GetDefense() if b>a then a=b end if a<0 then a=0 end if a>0 then Duel.Damage(1-tp,a,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's Xyz Monster declares a direct attack: Special Summon 1 LIGHT Dragon-Type Xyz Monster from your Extra Deck in Attack Position, then the attacking monster attacks it instead, and you proceed to damage calculation. Its ATK becomes equal to the attacking monster's, also its effects are negated. You can only activate 1 "Double Dragon Descent" per turn.
--双龍降臨 --Double Dragon Descent local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return tc:IsType(TYPE_XYZ) and tc:IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.filter(c,e,tp) return c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_XYZ) 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.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCountFromEx(tp)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK)~=0 then local a=Duel.GetAttacker() if a:IsRelateToBattle() and a:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(a:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2,true) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e3,true) Duel.CalculateDamage(a,tc) 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 send the top 3 cards of your Deck to the GY. At the start of the Battle Phase: You can return this card to the hand, and if you do, Special Summon 1 Level 7 "Dragonmaid" monster from your hand or GY. You can only use each effect of "Laundry Dragonmaid" once per turn.
--ドラゴンメイド・ラドリー --Laundry Dragonmaid local s,id=GetID() function s.initial_effect(c) --mill local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --summon local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE_START) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_DRAGONMAID} function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,3) end Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,tp,3) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,3,REASON_EFFECT) end function s.spfilter(c,e,tp) return c:GetLevel()==7 and c:IsSetCard(SET_DRAGONMAID) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,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:
A monster that was Link Summoned using this card as material cannot be destroyed by battle or card effect for the rest of that turn. You can only use 1 of the following effects of "Salamangreat Wolvie" per turn, and only once that turn. ● If this card is Special Summoned from the GY: You can target 1 FIRE monster in your GY; add it to your hand. ● If this card is added from your GY to your hand by an effect: You can reveal this card, then target 1 FIRE monster in your GY; add it to your hand.
--転生炎獣ウルヴィー --Salamangreat Wolvie --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --A link monster using this card cannot be destroyed by battle or card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(s.lkcon) e1:SetOperation(s.lkop) c:RegisterEffect(e1) --Add 1 FIRE monster from GY, if this card is special summoned local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon1) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Add 1 FIRE monster from GY, if this card is added from GY local e3=e2:Clone() e3:SetCode(EVENT_TO_HAND) e3:SetCondition(s.thcon2) e3:SetCost(s.thcost) c:RegisterEffect(e3) end --If sent as link material function s.lkcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_LINK end --A link monster using this card cannot be destroyed by battle or card effects this turn function s.lkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetDescription(3008) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) rc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) rc:RegisterEffect(e2) end --If this card was special summoned from GY function s.thcon1(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE) end --If this card was added from GY to hand function s.thcon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (r&REASON_EFFECT)~=0 and c:IsPreviousLocation(LOCATION_GRAVE) and c:IsPreviousControler(tp) end --Reveal this card from hand function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsPublic() end end --Check for FIRE monster that can be added function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToHand() end --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end --Add 1 FIRE monster from GY 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:
Add 1 "Vaylantz" Field Spell from your Deck to your hand, then you can apply the following effect. ● Destroy 1 Pendulum Monster Card you control, and if you do, add 1 "Senet Switch" from your Deck to your hand. If this card is in your GY, except the turn it was sent there: You can banish this card; place 1 face-up "Vaylantz" Pendulum Monster from your Extra Deck in your Pendulum Zone. You can only use each effect of "Vaylantz Wars - The Place of Beginning" once per turn.
--VV~始まりの地~ --Vaylantz Wars - The Place of Beginning --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Search 1 "Valiants" Field Spell local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Place 1 "Valiants" monster in the Pendulum Zone local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.pztg) e2:SetOperation(s.pzop) c:RegisterEffect(e2) end s.listed_names={63394872} s.listed_series={SET_VAYLANTZ} function s.thfilter(c) return c:IsType(TYPE_FIELD) and c:IsSpell() and c:IsSetCard(SET_VAYLANTZ) 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) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.desfilter(c) return c:IsFaceup() and c:IsOriginalType(TYPE_PENDULUM) and c:IsOriginalType(TYPE_MONSTER) end function s.senetfilter(c) return c:IsCode(63394872) and c:IsAbleToHand() 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<1 or Duel.SendtoHand(g,nil,REASON_EFFECT)<1 or not g:GetFirst():IsLocation(LOCATION_HAND) then return end Duel.ConfirmCards(1-tp,g) if Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(s.senetfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil) if #dg<1 then return end Duel.HintSelection(dg,true) Duel.BreakEffect() if Duel.Destroy(dg,REASON_EFFECT)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,s.senetfilter,tp,LOCATION_DECK,0,1,1,nil) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end function s.pzfilter(c) return c:IsFaceup() and c:IsSetCard(SET_VAYLANTZ) and not c:IsForbidden() end function s.pztg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.pzfilter,tp,LOCATION_EXTRA,0,1,nil) and Duel.CheckPendulumZones(tp) end end function s.pzop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.pzfilter,tp,LOCATION_EXTRA,0,1,1,nil):GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 Winged Beast-Type monsters You can detach 1 Xyz Material from this card, then target 1 face-up monster your opponent controls; its ATK becomes 0.
--零鳥姫リオート・ハルピュイア --Ice Princess Zereort local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WINGEDBEAST),5,2) c:EnableReviveLimit() --atkdown local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:GetAttack()>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()>0 then local e1=Effect.CreateEffect(c) 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 2 Flip monsters with different names from your Deck, your opponent randomly picks 1 for you to Special Summon to their field in face-down Defense Position, and you add the other to your hand, then you can Special Summon 1 "Mimighoul" monster from your hand. If your opponent Special Summons a monster(s) (except during the Damage Step): You can banish this card from your GY, then target 1 face-down monster your opponent controls; change it to face-up Attack or Defense Position. You can only use 1 "Mimighoul Maker" effect per turn, and only once that turn.
--ミミグル・メーカー --Mimighoul Maker --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Reveal 2 Flip monsters to Special Summon or add to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.revtg) e1:SetOperation(s.revop) c:RegisterEffect(e1) --Change 1 face-down monster to face-up Attack or Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) end s.listed_series={SET_MIMIGHOUL} function s.revfilter(c,e,tp) return c:IsType(TYPE_FLIP) and not c:IsPublic() and c:IsAbleToHand() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE,1-tp) end function s.revtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)==0 then return false end local g=Duel.GetMatchingGroup(s.revfilter,tp,LOCATION_DECK,0,nil,e,tp) return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MIMIGHOUL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.revop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)==0 then return end local g=Duel.GetMatchingGroup(s.revfilter,tp,LOCATION_DECK,0,nil,e,tp) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SELECT) if #sg~=2 then return end Duel.ConfirmCards(1-tp,sg) local sc=sg:RandomSelect(1-tp,1):GetFirst() if not sc or Duel.SpecialSummon(sc,0,tp,1-tp,false,false,POS_FACEDOWN_DEFENSE)==0 then return end Duel.ConfirmCards(tp,sc) sg:RemoveCard(sc) if Duel.SendtoHand(sg,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return end local hg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) if #hg==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local hsg=hg:Select(tp,1,1,nil) if #hsg>0 then Duel.BreakEffect() Duel.SpecialSummon(hsg,0,tp,tp,false,false,POS_FACEUP) end end function s.postg(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:IsFacedown() and chkc:IsCanChangePosition() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local pos=(POS_FACEUP_ATTACK|POS_FACEUP_DEFENSE)&~tc:GetPosition() pos=Duel.SelectPosition(tp,tc,pos) Duel.ChangePosition(tc,pos) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Destroy as many Spells/Traps you control as possible, then destroy as many Spells/Traps your opponent controls as possible, up to the number of cards destroyed by this effect.
--嵐 --Storm 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_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) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,1,c) end local g1=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,c) local g2=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) local ct1=#g1 local ct2=#g2 g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,ct1+((ct1>ct2) and ct2 or ct1),0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,e:GetHandler()) local ct1=Duel.Destroy(g1,REASON_EFFECT) if ct1==0 then return end local g2=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) local ct2=#g2 if ct2==0 then return end Duel.BreakEffect() if ct2<=ct1 then Duel.Destroy(g2,REASON_EFFECT) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g3=g2:Select(tp,ct1,ct1,nil) Duel.HintSelection(g3) Duel.Destroy(g3,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this Attack Position card is changed to face-up Defense Position: Target 1 monster your opponent controls; destroy that target.
--ドリーム・ピエロ --Dream Clown local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_CHANGE_POS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:GetPreviousPosition()&POS_ATTACK)~=0 and c:IsFaceup() and c:IsDefensePos() 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) 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_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All face-up LIGHT monsters you control gain 300 ATK for each Equip Card equipped to this card.
--ヴァイロン・チャージャー --Vylon Charger local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_LIGHT)) e1:SetValue(s.atkval) c:RegisterEffect(e1) end function s.atkval(e,c) return e:GetHandler():GetEquipCount()*300 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by Tributing 1 Normal Summoned/Set monster. You can only use each of the following effects of "Gizmek Yata, the Gleaming Vanguard" once per turn. ● During your Main Phase, if this card was Normal or Special Summoned this turn, you can: Immediately after this effect resolves, Normal Summon 1 monster. If you do, you cannot Special Summon monsters for the rest of this turn, except monsters with the same original Type as that monster. ● If this card Special Summoned by its own effect is Tributed: Gain 2050 LP. * The above text is unofficial and describes the card's functionality in the OCG.
--機巧嘴-八咫御先 --Gizmek Yata, the Gleaming Vanguard --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) e1:SetValue(1) c:RegisterEffect(e1) --normal summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.nscon) e2:SetTarget(s.nstg) e2:SetOperation(s.nsop) c:RegisterEffect(e2) --recover local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_RECOVER) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_RELEASE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.rccon) e3:SetTarget(s.rctg) e3:SetOperation(s.rcop) c:RegisterEffect(e3) --check aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SUMMON_SUCCESS) ge1:SetLabel(id) ge1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) ge1:SetOperation(aux.sumreg) Duel.RegisterEffect(ge1,0) local ge2=ge1:Clone() ge2:SetCode(EVENT_SPSUMMON_SUCCESS) ge2:SetLabel(id) Duel.RegisterEffect(ge2,0) end) end function s.spcon(e,c) if c==nil then return true end return Duel.CheckReleaseGroup(c:GetControler(),Card.IsSummonType,1,false,1,true,c,c:GetControler(),nil,false,e:GetHandler(),SUMMON_TYPE_NORMAL) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,Card.IsSummonType,1,1,false,true,true,c,nil,nil,false,e:GetHandler(),SUMMON_TYPE_NORMAL) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST) g:DeleteGroup() end function s.nscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.filter(c) return c:IsSummonable(true,nil) end function s.nstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.nsop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Summon(tp,tc,true,nil) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit(tc)) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.splimit(tc) return function(e,c,sump,sumtype,sumpos,targetp,se) return c:GetOriginalRace()~=tc:GetOriginalRace() end end function s.rccon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.rctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2050) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,2050) end function s.rcop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 Insect Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. If this card is in your GY, except the turn it was sent there: You can banish 2 Insect monsters from your GY; add this card to your hand. You can only use this effect of "Beetrooper Landing" once per turn.
--騎甲虫隊上陸態勢 --Beetrooper Landing --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate c:RegisterEffect(Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsRace,RACE_INSECT))) --Return itself to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(aux.exccon) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsRace(RACE_INSECT) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.thcost(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,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,2,2,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Insect monster you control; equip this card to it. While you control the equipped monster, your opponent's monsters cannot attack Insect monsters, except the equipped monster. While this card is equipped to a monster, each time your opponent Normal or Special Summons a monster(s), OR activates a card or effect, place 1 Scale Counter on each face-up monster they control. Each monster your opponent controls loses 100 ATK/DEF for each Scale Counter it has.
--蝕みの鱗粉 --Corrosive Scales local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.counter_place_list={0x1045} function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) 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_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) then return end local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) c:CancelToGrave() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(s.eqlimit) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.atkcon1) e2:SetValue(s.atktg) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCondition(s.ctcon1) e3:SetOperation(s.ctop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_CHAINING) e5:SetRange(LOCATION_SZONE) e5:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e5:SetOperation(s.regop) c:RegisterEffect(e5) local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e6:SetCode(EVENT_CHAIN_SOLVED) e6:SetRange(LOCATION_SZONE) e6:SetCondition(s.ctcon2) e6:SetOperation(s.ctop) c:RegisterEffect(e6) local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_FIELD) e7:SetCode(EFFECT_UPDATE_ATTACK) e7:SetRange(LOCATION_SZONE) e7:SetTargetRange(0,LOCATION_MZONE) e7:SetCondition(s.atkcon2) e7:SetValue(s.atkval) c:RegisterEffect(e7) local e8=e7:Clone() e8:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e8) end end function s.eqlimit(e,c) return c:GetControler()==e:GetHandlerPlayer() or e:GetHandler():GetEquipTarget()==c end function s.atkcon1(e) local ec=e:GetHandler():GetEquipTarget() return ec and ec:GetControler()==e:GetHandlerPlayer() end function s.atktg(e,c) return c:IsRace(RACE_INSECT) and c~=e:GetHandler():GetEquipTarget() end function s.ctcon1(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetEquipTarget() and eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do tc:AddCounter(0x1045,1) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_CHAIN,0,1) end function s.ctcon2(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetEquipTarget() and ep~=tp and e:GetHandler():GetFlagEffect(id)~=0 end function s.atkcon2(e) return e:GetHandler():GetEquipTarget() end function s.atkval(e,c) return c:GetCounter(0x1045)*-100 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can Special Summon 1 "Fluffal" monster from your hand, except "Fluffal Penguin". This effect can only be used once while this card is face-up on the field. If this card is sent to the Graveyard as a Fusion Material for a Fusion Summon of a "Frightfur" Fusion Monster: You can draw 2 cards, then discard 1 card. You can only use this effect of "Fluffal Penguin" once per turn.
--ファーニマル・ペンギン --Fluffal Penguin local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_NO_TURN_RESET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,id) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end s.listed_series={SET_FLUFFAL,SET_FRIGHTFUR} s.listed_names={id} function s.spfilter(c,e,tp) return c:IsSetCard(SET_FLUFFAL) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and r==REASON_FUSION and c:GetReasonCard():IsOriginalSetCard(SET_FRIGHTFUR) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)==2 then Duel.ShuffleHand(p) Duel.BreakEffect() Duel.DiscardHand(p,nil,1,1,REASON_EFFECT|REASON_DISCARD) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control a Level 7 or higher Machine monster, your opponent's monsters cannot target Level 6 or lower Machine monsters you control for attacks, also your opponent cannot target them with card effects. If a face-up Machine monster(s) you control is destroyed by battle or card effect: You can target 1 Machine monster in your GY; add it to your hand. You can only use this effect of "Machina Defense Perimeter" once per turn.
--機甲部隊の防衛圏 --Machina Defense Perimeter --Scripted by Hel 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 target level <=6 local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.cannottgeff) e2:SetCondition(s.cannottgcon) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --cannot attack level <=6 local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(0,LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e3:SetCondition(s.cannottgcon) e3:SetValue(s.cannotatk) c:RegisterEffect(e3) --Add to Hand local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,id) e4:SetCondition(s.tohandcon) e4:SetTarget(s.tohandtg) e4:SetOperation(s.tohandop) c:RegisterEffect(e4) end function s.cfilter(c) return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsLevelAbove(7) end function s.cannottgcon(e) return Duel.IsExistingMatchingCard(s.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler()) end function s.cannottgeff(e,c) return c:IsLevelBelow(6) and c:IsRace(RACE_MACHINE) end function s.cannotatk(e,c) return c:IsFaceup() and c:IsLevelBelow(6) and c:IsRace(RACE_MACHINE) end function s.tohandconfilter(c,tp) return c:GetPreviousControler()==tp and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_DESTROY) and (c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT)) and c:IsRace(RACE_MACHINE) and c:IsPreviousPosition(POS_FACEUP) end function s.tohandcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tohandconfilter,1,nil,tp) end function s.tohandfilter(c) return c:IsAbleToHand() and c:IsRace(RACE_MACHINE) end function s.tohandtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tohandfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.tohandfilter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.tohandop(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:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 2 Spells/Traps you control to the GY. Once per turn: You can target 1 Spell/Trap your opponent controls; destroy it. This card cannot attack the turn this effect is activated. * The above text is unofficial and describes the card's functionality in the OCG.
--オオアリクイクイアリ --Anteatereatingant local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Must be special summon by its own method local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --Special summon procedure (from hand) 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) --Destroy 1 of opponent's spells/traps local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCost(s.descost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.spfilter(c) return c:IsSpellTrap() and c:IsAbleToGraveAsCost() end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_ONFIELD,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>1 and aux.SelectUnselectGroup(g,e,tp,2,2,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_ONFIELD,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_TOGRAVE,aux.ChkfMMZ(1),nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_COST) g:DeleteGroup() end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end --Cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) e:GetHandler():RegisterEffect(e1) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: You can Special Summon this card from your hand in Defense Position, and if you do, it cannot be destroyed by battle. If this card is Special Summoned: You can add from your Deck to your hand 1 "Polymerization" or 1 Spell/Trap that mentions an "Elemental HERO" monster's card name. During your Main Phase: You can shuffle this card into the Deck, and if you do, Special Summon 1 "Elemental HERO" Normal Monster from your Deck. You can only use each effect of "Elemental HERO Spirit of Neos" once per turn.
--E・HERO スピリット・オブ・ネオス --Elemental HERO Spirit of Neos --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon itself local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,{id,0}) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Search 1 Spell/Trap that mentions an "Elemental HERO", or 1 "Polymerization" 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_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Special Summon 1 "Elemental HERO" Normal Monster from your Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end s.listed_names={CARD_POLYMERIZATION} s.listed_series={SET_ELEMENTAL_HERO} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-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,POS_FACEUP_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetDescription(3000) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end function s.thfilter(c) if not c:IsAbleToHand() then return false end return c:IsCode(CARD_POLYMERIZATION) or (c:IsSpellTrap() and c:ListsCodeWithArchetype(SET_ELEMENTAL_HERO)) 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.spfilter(c,e,tp) return c:IsType(TYPE_NORMAL) and c:IsSetCard(SET_ELEMENTAL_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetMZoneCount(tp,c)>0 and c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and c:IsLocation(LOCATION_DECK|LOCATION_EXTRA) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can pay 600 LP; Fusion Summon 1 "P.U.N.K." Fusion Monster from your Extra Deck, using monsters from your hand or field as material. During your opponent's turn (Quick Effect): You can pay 600 LP; immediately after this effect resolves, Synchro Summon 1 "P.U.N.K." Synchro Monster using monsters you control as material. You can only use each effect of "Ukiyoe-P.U.N.K. Sharakusai" once per turn.
--Uk-P.U.N.K.娑楽斎 --Ukiyoe-P.U.N.K. Sharakusai --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Fusion Summon local fusparam=aux.FilterBoolFunction(Card.IsSetCard,SET_PUNK) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.PayLP(600)) e1:SetTarget(Fusion.SummonEffTG(fusparam)) e1:SetOperation(Fusion.SummonEffOP(fusparam)) c:RegisterEffect(e1) --Synchro Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(_,tp)return Duel.IsTurnPlayer(1-tp)end) e2:SetCost(Cost.PayLP(600)) e2:SetTarget(s.sctg) e2:SetOperation(s.scop) c:RegisterEffect(e2) end s.listed_series={SET_PUNK} function s.scfilter(c) return c:IsSetCard(SET_PUNK) and c:IsSynchroSummonable(nil) end function s.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.scop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.scfilter,tp,LOCATION_EXTRA,0,nil) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SynchroSummon(tp,sg:GetFirst(),nil) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Level 6 monsters Once per turn, you can also Xyz Summon "Gaia Stream, the Graceful Force" by using 1 Rank 5 or 7 Xyz Monster you control (transfer its materials to this card). Cannot be used as material for an Xyz Summon the turn it was Xyz Summoned. Cannot attack directly. Gains ATK equal to the combined Levels/Ranks of its attached materials x 200. At the end of the Damage Step, if this card battled: Detach 1 material from this card.
--流麗の騎士ガイアストリーム --Gaia Stream, the Graceful Force --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2+ Level 6 monsters OR 1 Rank 5 or 7 Xyz Monster you control Xyz.AddProcedure(c,nil,6,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --Cannot be used as material for an Xyz Summon the turn it was Xyz Summoned local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e0:SetCondition(s.matxyzcond) e0:SetValue(1) c:RegisterEffect(e0) --Cannot attack directly local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) c:RegisterEffect(e1) --Gains ATK equal to the combined Levels/Ranks of its attached materials x 200 local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.atkval) c:RegisterEffect(e2) --Detach 1 material from this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_DAMAGE_STEP_END) e3:SetOperation(s.detachop) c:RegisterEffect(e3) end s.listed_names={id} function s.ovfilter(c,tp,lc) return c:IsRank(5,7) and c:IsType(TYPE_XYZ,lc,SUMMON_TYPE_XYZ,tp) and c:IsFaceup() end function s.xyzop(e,tp,chk) if chk==0 then return not Duel.HasFlagEffect(tp,id) end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,EFFECT_FLAG_OATH,1) return true end function s.matxyzcond(e) local c=e:GetHandler() return c:IsStatus(STATUS_SPSUMMON_TURN) and c:IsXyzSummoned() end function s.atkval(e,c) local g=e:GetHandler():GetOverlayGroup():Filter(aux.OR(Card.HasLevel,Card.HasRank),nil) return 200*(g:GetSum(Card.GetLevel)+g:GetSum(Card.GetRank)) end function s.detachop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:GetOverlayCount()>0 then c:RemoveOverlayCard(tp,1,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If "Vaylantz World - Konig Wissen" is in a Field Zone or if you control a FIRE "Vaylantz" monster: You can Special Summon this card to your Main Monster Zone in its same column. You can only use this effect of "Vaylantz Dominator Duke" once per turn. ---------------------------------------- [ Monster Effect ] You can target 1 Set card in the Spell & Trap Zone; that Set card cannot be activated this turn (even if this card leaves the field). If this card in the Monster Zone moves to another Monster Zone: You can target 1 face-up monster in your opponent's Main Monster Zone; take control of that face-up monster, but it cannot declare an attack nor activate its effects, also it is treated as a "Vaylantz" monster. You can only use each effect of "Vaylantz Dominator Duke" once per turn.
--ヴァリアンツD-デューク --Vaylantz Dominator Duke --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Prevent activation local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.catg) e2:SetOperation(s.caop) c:RegisterEffect(e2) --Take control local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_CONTROL) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_MOVE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.ctcon) e3:SetTarget(s.cttg) e3:SetOperation(s.ctop) c:RegisterEffect(e3) end s.listed_names={CARD_VALIANTS_KOENIGWISSEN} s.listed_series={SET_VAYLANTZ} function s.spconfilter(c) return c:IsFaceup() and c:IsSetCard(SET_VAYLANTZ) and c:IsAttribute(ATTRIBUTE_FIRE) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsEnvironment(CARD_VALIANTS_KOENIGWISSEN,PLAYER_ALL,LOCATION_FZONE) or Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then local zone=(1<<c:GetSequence())&ZONES_MMZ return zone~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local zone=(1<<c:GetSequence())&ZONES_MMZ if zone~=0 then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone) end end function s.cafilter(c) return c:IsFacedown() and c:GetSequence()<5 end function s.catg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE) and s.cafilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.cafilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) Duel.SelectTarget(tp,s.cafilter,tp,LOCATION_SZONE,LOCATION_SZONE,1,1,nil) end function s.caop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFacedown() and tc:IsRelateToEffect(e) then --Cannot activate card this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) end end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_MZONE) and c:IsPreviousLocation(LOCATION_MZONE) end function s.ctfilter(c) return c:IsFaceup() and c:IsControlerCanBeChanged() end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MMZONE) and chkc:IsControler(1-tp) and s.ctfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.ctfilter,tp,0,LOCATION_MMZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.ctfilter,tp,0,LOCATION_MMZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.ctop(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 tc:IsControler(1-tp) and tc:IsControlerCanBeChanged() and Duel.GetControl(tc,tp) then local c=e:GetHandler() --Cannot activate its effects local e1=Effect.CreateEffect(c) e1:SetDescription(3302) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) --Cannot declare an attack local e2=e1:Clone() e2:SetDescription(3206) e2:SetCode(EFFECT_CANNOT_ATTACK) tc:RegisterEffect(e2) --Treated as a "Vaylantz" monster local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,3)) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_ADD_SETCODE) e3:SetValue(SET_VAYLANTZ) e3:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e3) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Avian" + "Elemental HERO Wildheart" Must be Special Summoned with "Dark Fusion". If this card attacks, your opponent cannot activate any Spell/Trap Cards until the end of the Damage Step. If this card inflicts battle damage to your opponent: Destroy all Set Spells/Traps your opponent controls.
--E-HERO ワイルド・サイクロン --Evil HERO Wild Cyclone local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion material Fusion.AddProcMix(c,true,true,21844576,86188410) --lizard check local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(CARD_CLOCK_LIZARD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCondition(s.lizcon) e0:SetValue(1) c:RegisterEffect(e0) --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.EvilHeroLimit) c:RegisterEffect(e1) --Prevent Spell/Traps activation while battling local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,1) e2:SetValue(s.aclimit) e2:SetCondition(s.actcon) c:RegisterEffect(e2) --Destroy all face-down Spell/Trap local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_DAMAGE) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.activate) c:RegisterEffect(e3) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} s.dark_calling=true s.listed_names={CARD_DARK_FUSION,21844576,86188410} function s.lizcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),EFFECT_SUPREME_CASTLE) end function s.aclimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) end function s.actcon(e) return Duel.GetAttacker()==e:GetHandler() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_SZONE,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(Card.IsFacedown,tp,0,LOCATION_SZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Ninja" monsters with different Types Must first be either Fusion Summoned, or Special Summoned from your Extra Deck by Tributing the above cards. If this card is Special Summoned or flipped face-up: You can banish 1 other "Ninja" or "Ninjitsu Art" card from your hand, GY, or face-up field, then target 1 card on the field; banish it. You can only use this effect of "Yaguramaru the Armor Ninja" once per turn.
--鎧の忍者-櫓丸 --Yaguramaru the Armor Ninja --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Summon procedure: 2 "Ninja" monsters with different Types Fusion.AddProcMixN(c,true,true,s.ffilter,2) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit,nil,nil,nil,false) --Banish 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) 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:SetCost(s.rmcost) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP) c:RegisterEffect(e2) end s.listed_series={SET_NINJA,SET_NINJITSU_ART} function s.ffilter(c,fc,sumtype,sp,sub,mg,sg) return c:IsSetCard(SET_NINJA,fc,sumtype,sp) and (not sg or sg:FilterCount(aux.TRUE,c)==0 or not sg:IsExists(Card.IsRace,1,c,c:GetRace(),fc,sumtype,sp)) end function s.contactfil(tp) return Duel.GetReleaseGroup(tp) end function s.contactop(g) Duel.Release(g,REASON_COST|REASON_MATERIAL) end function s.splimit(e,se,sp,st) return (st&SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION or not e:GetHandler():IsLocation(LOCATION_EXTRA) end function s.rmcostfilter(c) return (c:IsSetCard(SET_NINJA) or c:IsSetCard(SET_NINJITSU_ART)) and c:IsAbleToRemoveAsCost() and (c:IsFaceup() or not c:IsOnField()) and (not c:IsLocation(LOCATION_GRAVE) or aux.SpElimFilter(c,true)) end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.rmcostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.rmcostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,1,c) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder", "Raviel, Lord of Phantasms", or "Armityle the Chaos Phantasm" in your Monster Zones with card effects, also those monsters cannot be destroyed by your opponent's card effects while you control them. If you control "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder", "Raviel, Lord of Phantasms" or "Armityle the Chaos Phantasm" in your Monster Zone: You can draw 2 cards. You can only use this effect of "Fallen Paradise" once per turn.
--失楽園 --Fallen Paradise 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) --Untargetable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetRange(LOCATION_FZONE) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.immtg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --Indes local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetValue(s.tgvalue) c:RegisterEffect(e3) --Draw local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_FZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCountLimit(1,id) e4:SetCondition(s.drcon) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end s.listed_names={6007213,32491822,69890967,43378048} function s.immtg(e,c) return c:IsCode(6007213,32491822,69890967,43378048) end function s.tgvalue(e,re,rp) return rp==1-e:GetHandlerPlayer() end function s.drcfilter(c) return c:IsFaceup() and c:IsCode(6007213,32491822,69890967,43378048) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.drcfilter,tp,LOCATION_MZONE,0,1,nil) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control this Normal Summoned/Set card (Quick Effect): You can target up to 3 Level 4 or lower Insect monsters in your GY; change this card's ATK to 0, and if you do, Special Summon those monsters, but their effects are negated. You can only use this effect of "Queen Butterfly Danaus" once per turn.
--クイーン・バタフライ ダナウス --Queen Butterfly Danaus --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon up to 3 Level 4 or lower Insect monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcond) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcond(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsNormalSummoned() and not c:IsAttack(0) and aux.StatChangeDamageStepCondition() end function s.spfilter(c,e,tp) return c:IsRace(RACE_INSECT) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end ft=math.min(ft,3) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,ft,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup()) or c:IsAttack(0) then return end --Change its ATK to 0 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) if not c:IsAttack(0) then return end local ct=Duel.GetLocationCount(tp,LOCATION_MZONE) if ct==0 then return end local g=Duel.GetTargetCards(e) if #g==0 then return end if #g>ct or (#g>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) g=g:Select(tp,1,1,nil) end for tc in g:Iter() do if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2,true) end end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you take battle damage: You can Special Summon this card from your hand, and if you do, gain Life Points equal to the damage you took.
--BK ベイル --Battlin' Boxer Veil local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return ep==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) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ev) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then Duel.Recover(tp,ev,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent from the field to the Graveyard, all face-up WATER monsters you control gain 500 ATK until the end of this turn.
--深海の大ウナギ --Deepsea Macrotrema local s,id=GetID() function s.initial_effect(c) --to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WATER),tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control a "Gadget" monster, this card gains 2000 ATK.
--起動兵士デッドリボルバー --Boot-Up Soldier - Dread Dynamo local s,id=GetID() function s.initial_effect(c) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetCondition(s.atkcon) e1:SetValue(2000) c:RegisterEffect(e1) end s.listed_series={SET_GADGET} function s.atkcon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_GADGET),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Attack Position monster you control with 800 or more ATK; equip this card to it. It gains 800 ATK. You can send this equipped card to the GY, then target 1 face-up card on the field; destroy it, then change the ATK of the monster this card was equipped to, to 0, also its battle position cannot be changed. You can only use 1 "Rocket Hand" effect per turn, and only once that turn. * The above text is unofficial and describes the card's functionality in the OCG.
--ロケットハンド --Rocket Hand local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.filter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsAttackAbove(800) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) or not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Equip(tp,c,tc) --Atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(800) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Equip limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_EQUIP_LIMIT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetValue(1) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) else c:CancelToGrave(false) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetEquipTarget() end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end e:SetLabelObject(e:GetHandler():GetEquipTarget()) Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,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 ec=e:GetLabelObject() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and ec and ec:IsFaceup() and ec:IsLocation(LOCATION_MZONE) then Duel.BreakEffect() 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) ec:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e2:SetReset(RESET_EVENT|RESETS_STANDARD) ec:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Fusion, Synchro, and Xyz Monsters your opponent controls cannot activate their effects. Once per turn, when a card(s) is added from the Main Deck to your opponent's hand (except during the Draw Phase or the Damage Step): You can destroy that card(s). ---------------------------------------- [ Monster Effect ] 4 Dragon monsters (1 Fusion, 1 Synchro, 1 Xyz, and 1 Pendulum) Must be Fusion Summoned. If this card is Special Summoned: Destroy all cards your opponent controls. Cannot be destroyed by your opponent's card effects. Your opponent cannot target this card with card effects. When this card destroys an opponent's monster by battle: You can Special Summon 1 "Supreme King Dragon" monster from your Deck or Extra Deck. If this card in the Monster Zone is destroyed by battle or card effect: You can place this card in your Pendulum Zone.
--覇王龍ズァーク --Supreme King Z-ARC local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,s.fusfilter1,s.fusfilter2,s.fusfilter3,s.fusfilter4) Pendulum.AddProcedure(c,false) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.fuslimit) c:RegisterEffect(e1) --act limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_ACTIVATE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_PZONE) e2:SetTargetRange(0,1) e2:SetValue(s.limval) c:RegisterEffect(e2) --destroy drawn local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_HAND) e3:SetRange(LOCATION_PZONE) e3:SetCountLimit(1) e3:SetCondition(s.ddcon) e3:SetTarget(s.ddtg) e3:SetOperation(s.ddop) c:RegisterEffect(e3) --destroy all local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) --Immune local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetRange(LOCATION_MZONE) e5:SetValue(aux.tgoval) c:RegisterEffect(e5) local e6=e5:Clone() e6:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e6:SetValue(s.tgvalue) c:RegisterEffect(e6) --special summon local e7=Effect.CreateEffect(c) e7:SetDescription(aux.Stringid(id,2)) e7:SetCategory(CATEGORY_SPECIAL_SUMMON) e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e7:SetCode(EVENT_BATTLE_DESTROYING) e7:SetCondition(aux.bdocon) e7:SetTarget(s.sptg) e7:SetOperation(s.spop) c:RegisterEffect(e7) --pendulum local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(id,3)) e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e8:SetCode(EVENT_DESTROYED) e8:SetProperty(EFFECT_FLAG_DELAY) e8:SetCondition(s.pencon) e8:SetTarget(s.pentg) e8:SetOperation(s.penop) c:RegisterEffect(e8) end s.listed_series={SET_SUPREME_KING_DRAGON} s.miracle_synchro_fusion=true function s.fusfilter1(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(TYPE_FUSION,fc,sumtype,tp) end function s.fusfilter2(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(TYPE_SYNCHRO,fc,sumtype,tp) end function s.fusfilter3(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(TYPE_XYZ,fc,sumtype,tp) end function s.fusfilter4(c,fc,sumtype,tp) return c:IsRace(RACE_DRAGON,fc,sumtype,tp) and c:IsType(TYPE_PENDULUM,fc,sumtype,tp) end function s.limval(e,re,rp) local rc=re:GetHandler() return rc:IsLocation(LOCATION_MZONE) and re:IsMonsterEffect() and rc:IsType(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ) end function s.ddcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()~=PHASE_DRAW end function s.ddfilter(c,tp) return c:IsControler(1-tp) and c:IsPreviousLocation(LOCATION_DECK) end function s.ddtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=eg:Filter(s.ddfilter,nil,tp) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.ddop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=eg:Filter(s.ddfilter,nil,tp) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.tgvalue(e,re,rp) return rp~=e:GetHandlerPlayer() end function s.spfilter(c,e,tp,rp) if c:IsLocation(LOCATION_DECK) and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end if c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,rp,nil,c)<=0 then return false end return c:IsSetCard(SET_SUPREME_KING_DRAGON) 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 loc~=0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil,e,tp,rp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil,e,tp,rp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return false end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Mitsurugi Ritual". Monsters your opponent controls lose 800 ATK. You can reveal this card in your hand; Special Summon 1 "Mitsurugi" monster from your Deck, then Tribute 1 monster you control. You can only use this effect of "Ame no Habakiri no Mitsurugi" once per Duel. If this card is Tributed: You can add 1 "Mitsurugi" card from your Deck to your hand, except "Ame no Habakiri no Mitsurugi", then you can Special Summon this card. You can only use this effect of "Ame no Habakiri no Mitsurugi" once per turn.
--天羽々斬之巳剣 --Ame no Habakiri no Mitsurugi --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Monsters your opponent controls lose 800 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(-800) c:RegisterEffect(e1) --Special Summon 1 "Mitsurugi" monster from your Deck, then Tribute 1 monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RELEASE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_DUEL) e2:SetCost(Cost.SelfReveal) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Add 1 "Mitsurugi" card from your Deck to your hand then you can Special Summon this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_RELEASE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_MITSURUGI} s.listed_names={id,81560239} --"Mitsurugi Ritual" function s.spfilter(c,e,tp) return c:IsSetCard(SET_MITSURUGI) 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.IsPlayerCanRelease(tp) 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) Duel.SetOperationInfo(0,CATEGORY_RELEASE,nil,1,tp,LOCATION_MZONE) 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 sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #sg>0 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=Duel.SelectMatchingCard(tp,Card.IsReleasableByEffect,tp,LOCATION_MZONE,0,1,1,nil) if #rg>0 then Duel.HintSelection(rg) Duel.BreakEffect() Duel.Release(rg,REASON_EFFECT) end end end function s.thfilter(c) return c:IsSetCard(SET_MITSURUGI) and c:IsAbleToHand() and not c:IsCode(id) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,tp,0) 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 or Duel.SendtoHand(g,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,g) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() 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:
Once per turn: You can Tribute 1 Dragon "Dragunity" monster, then target 1 Level 4 or lower Winged Beast monster in your GY; Special Summon that target.
--ドラグニティ-ブラックスピア --Dragunity Darkspear local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_DRAGUNITY} function s.cfilter(c) return c:IsSetCard(SET_DRAGUNITY) and c:IsRace(RACE_DRAGON) 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.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckMMZ,nil) end local rg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckMMZ,nil) Duel.Release(rg,REASON_COST) end function s.filter(c,e,sp) return c:IsLevelBelow(4) and c:IsRace(RACE_WINGEDBEAST) and c:IsCanBeSpecialSummoned(e,0,sp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 face-up card on the field; shuffle 2 of your banished "Virtual World" cards with different names from each other into the Deck, then destroy that card. During your Main Phase: You can banish this card from your GY, then target 1 "Virtual World" monster you control; increase or decrease its Level/Rank by 3 until the end of this turn. You can only use each effect of "Virtual World Gate - Chuche" once per turn.
--電脳堺門-朱雀 --Virtual World Gate - Chuche --Scripted by Naim 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) --Shuffle 2 of your banished "Virtual World" cards with different names from each other into the Deck and destroy 1 face-up card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E|TIMING_EQUIP) e1:SetCountLimit(1,id) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Increase or decrease the Level/Rank of 1 "Virtual World" monster you control by 3 until the end of this turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp) return Duel.IsMainPhase() and Duel.IsTurnPlayer(tp) end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.lvrnktg) e2:SetOperation(s.lvrnkop) c:RegisterEffect(e2) end s.listed_series={SET_VIRTUAL_WORLD} function s.tdfilter(c) return c:IsSetCard(SET_VIRTUAL_WORLD) and c:IsFaceup() and c:IsAbleToDeck() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local exc=not c:IsStatus(STATUS_EFFECT_ENABLED) and c or nil if chkc then return chkc:IsOnField() and chkc:IsFaceup() and (not exc or chkc~=exc) end local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil) if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,exc) and aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local tg=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,tp,LOCATION_REMOVED) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil) if #g<2 then return end local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_TODECK) if #sg~=2 then return end Duel.HintSelection(sg) if Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=2 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.BreakEffect() Duel.Destroy(tc,REASON_EFFECT) end end function s.lvrnkfilter(c) return c:IsSetCard(SET_VIRTUAL_WORLD) and c:IsFaceup() and (c:HasLevel() or c:HasRank()) end function s.lvrnktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.lvrnkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.lvrnkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.lvrnkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.lvrnkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and (tc:HasLevel() or tc:HasRank()) then local lvrnk=tc:HasLevel() and tc:GetLevel() or tc:GetRank() local b2=lvrnk>3 local op=nil if b2 then op=Duel.SelectEffect(tp, {true,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) else op=1 end local c=e:GetHandler() local val=op==1 and 3 or -3 if tc:HasLevel() then --Increase or decrease its Level by 3 tc:UpdateLevel(val,RESETS_STANDARD_PHASE_END,c) elseif tc:HasRank() then --Increase or decrease its Rank by 3 tc:UpdateRank(val,RESETS_STANDARD_PHASE_END,c) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card, then target 1 Level 2 monster in your GY, except "Silvervine Senri"; Special Summon it, then you can Special Summon 1 Level 2 monster from your hand with a different Attribute than the monster Special Summoned by this effect. You can only use this effect of "Silvervine Senri" once per turn.
--マタタビ仙狸 --Silvervine Senri --Scripted by FiftyFour local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={id} function s.spfilter(c,e,tp) return c:IsLevel(2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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.GetMZoneCount(tp,e:GetHandler())>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.sphfilter(c,e,tp,att) return c:IsLevel(2) and not c:IsAttribute(att) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(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)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then local g=Duel.GetMatchingGroup(s.sphfilter,tp,LOCATION_HAND,0,nil,e,tp,tc:GetAttribute()) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Vendread" monster from your hand, Deck, or GY in face-down Defense Position, except "Vendread Scavenger", then apply the following effect. ● Ritual Summon any 1 "Vendread" Ritual Monster from your hand or GY by Tributing monsters you control, including the monster Special Summoned by this card, whose total Levels equal or exceed the Level of the Ritual Monster. You can only activate 1 "Ravenous Vendread" per turn.
--ラヴェナス・ヴェンデット --Ravenous Vendread --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) local rparams={handler=c,lvtype=RITPROC_GREATER,filter=s.ritualfil,matfilter=s.matfilter,extrafil=s.extrafil,location=LOCATION_HAND|LOCATION_GRAVE,forcedselection=s.ritcheck} --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RELEASE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target(Ritual.Target(rparams))) e1:SetOperation(s.operation(Ritual.Target(rparams),Ritual.Operation(rparams))) c:RegisterEffect(e1) end s.listed_series={SET_VENDREAD} s.listed_names={29348048} function s.ritualfil(c) return c:IsSetCard(SET_VENDREAD) and c:IsRitualMonster() end function s.matfilter(c,e,tp) return (Duel.IsPlayerCanRelease(tp,c) and c:IsLocation(LOCATION_MZONE)) or s.extramatfil(c,e,tp) end function s.extramatfil(c,e,tp) return c:IsSetCard(SET_VENDREAD) and not c:IsCode(29348048) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.extrafil(e,tp,mg) if not Duel.IsPlayerCanRelease(tp) then return nil end return Duel.GetMatchingGroup(s.extramatfil,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp) end function s.ritcheck(e,tp,g,sc) local obj=e:GetLabelObject() local res=obj and g:IsContains(obj) local ct=g:FilterCount(aux.NOT(Card.IsLocation),obj,LOCATION_MZONE) return res and ct==0,not res and ct~=0 end function s.spfilter(c,e,tp,eg,ep,ev,re,r,rp,rittg) if not s.extramatfil(c,e,tp) then return false end e:SetLabelObject(c) local res=rittg(e,tp,eg,ep,ev,re,r,rp,0) e:SetLabelObject(nil) return res end function s.target(rittg) return function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp,eg,ep,ev,re,r,rp,rittg) end rittg(e,tp,eg,ep,ev,re,r,rp,1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end end function s.operation(rittg,ritop) return function(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp,eg,ep,ev,re,r,rp,rittg) if #sg==0 then return end if Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then Duel.ConfirmCards(1-tp,sg) Duel.BreakEffect() e:SetLabelObject(sg:GetFirst()) ritop(e,tp,eg,ep,ev,re,r,rp) e:SetLabelObject(nil) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card destroys an opponent's monster by battle and sends it to the GY: You can target that destroyed monster in your opponent's GY; Special Summon that target to your field in Defense Position.
--ジャッカルの霊騎士 --Ghost Knight of Jackal local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCondition(aux.bdogcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and bc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,bc,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is treated as a Normal Monster while face-up on the field. While equipped with a "Noble Arms" Equip Spell Card, this card becomes an Effect Monster with this effect. ● You can target 1 "Noble Knight" monster in your Graveyard; add it to your hand, and if you do, destroy 1 "Noble Arms" Equip Spell Card you control. You can only use this effect of "Noble Knight Gwalchavad" once per turn.
--聖騎士ガラハド --Noble Knight Gwalchavad local s,id=GetID() function s.initial_effect(c) --Normal monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.eqcon1) e1:SetValue(TYPE_NORMAL) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_REMOVE_TYPE) e2:SetValue(TYPE_EFFECT) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_NOBLE_KNIGHT,SET_NOBLE_ARMS} function s.eqcon1(e) local eg=e:GetHandler():GetEquipGroup() return not eg or not eg:IsExists(Card.IsSetCard,1,nil,SET_NOBLE_ARMS) end function s.eqcon2(e) local eg=e:GetHandler():GetEquipGroup() return eg and eg:IsExists(Card.IsSetCard,1,nil,SET_NOBLE_ARMS) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return s.eqcon2(e) end function s.thfilter(c) return c:IsSetCard(SET_NOBLE_KNIGHT) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc: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.desfilter(c) return c:IsFaceup() and c:IsSetCard(SET_NOBLE_ARMS) and c:IsType(TYPE_EQUIP) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_SZONE,0,1,1,nil) Duel.BreakEffect() Duel.Destroy(dg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If your "Nekroz" card(s) is banished face-up (except during the Damage Step): You can target 1 Spell/Trap on the field; banish it. You can only use this effect of "Nekroz of Metaltron" once per turn. ---------------------------------------- [ Monster Effect ] You can Ritual Summon this card with any "Nekroz" Ritual Spell. Must be Ritual Summoned, using monsters, and you cannot use Level 9 monsters. During the Main Phase (Quick Effect): You can target 1 face-up monster your opponent controls; banish this card (until the End Phase), and if you do, banish that monster. You can only use this effect of "Nekroz of Metaltron" once per turn. Any monster destroyed by battle with your "Nekroz" monster is banished.
--メタトロンの影霊依 --Nekroz of Metaltron --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Pendulum Summon procedure Pendulum.AddProcedure(c) c:AddMustBeRitualSummoned() --Banish 1 Spell/Trap on the field 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:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_REMOVE) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.strmcon) e1:SetTarget(s.strmtg) e1:SetOperation(s.strmop) c:RegisterEffect(e1) --Banish this card until the End Phase and banish 1 face-up monster your opponent controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e2:SetCondition(function() return Duel.IsMainPhase() end) e2:SetTarget(s.mrmtg) e2:SetOperation(s.mrmop) c:RegisterEffect(e2) --Any monster destroyed by battle with your "Nekroz" monster is banished local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_BATTLE_DESTROY_REDIRECT) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetValue(LOCATION_REMOVED) e3:SetTarget(function(e,c) return c:IsSetCard(SET_NEKROZ) end) c:RegisterEffect(e3) end s.listed_series={SET_NEKROZ} function s.mat_filter(c) return not c:IsLevel(9) end function s.strmconfilter(c,tp) return c:IsSetCard(SET_NEKROZ) and c:IsPreviousControler(tp) and c:IsFaceup() end function s.strmcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.strmconfilter,1,nil,tp) end function s.strmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsSpellTrap,Card.IsAbleToRemove),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,aux.AND(Card.IsSpellTrap,Card.IsAbleToRemove),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) end function s.strmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.mrmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() and chkc:IsAbleToRemove() end local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g+c,2,tp,0) end function s.mrmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and aux.RemoveUntil(c,nil,REASON_EFFECT,PHASE_END,id,e,tp,aux.DefaultFieldReturnOp) and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Flip 1 face-up monster on the field into face-down Defense Position. You cannot select "Desertapir".
--砂バク --Desertapir local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:GetCode()~=id and c:IsCanTurnSet() end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Plant-Type monster you control destroys an opponent's monster by battle and sends it to the Graveyard: Inflict damage to your opponent equal to the destroyed monster's ATK in the Graveyard.
--ブロッサム・ボンバー --Blossom Bombardment local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() local bc=tc:GetBattleTarget() return tc:IsRelateToBattle() and tc:IsStatus(STATUS_OPPO_BATTLE) and tc:IsControler(tp) and tc:IsRace(RACE_PLANT) and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) local atk=eg:GetFirst():GetBattleTarget():GetAttack() if atk<0 then atk=0 end Duel.SetTargetParam(atk) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Cyberse monsters When this card destroys an opponent's monster by battle and sends it to the GY: You can Tribute 1 monster that this card points to; Special Summon that destroyed monster to any zone this card points to. If you Special Summon to your opponent's field by this effect, this card can make a second attack during this Battle Phase (although your opponent gains control of that Special Summoned monster).
--ベクター・スケア・デーモン --Vector Scare Archfiend 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.IsRace,RACE_CYBERSE),2) --Special summon back a monster this card destroyed by battle 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_BATTLE_DESTROYING) e1:SetCondition(aux.bdogcon) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.cfilter(c,tp,g,zone) return g:IsContains(c) and (Duel.CheckLocation(c:GetControler(),LOCATION_MZONE,c:GetSequence(),true) or Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local lg=c:GetLinkedGroup() local zone=c:GetLinkedZone(1-tp) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,tp,lg,zone) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,tp,lg,zone) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local bc=c:GetBattleTarget() local zone1=c:GetLinkedZone(tp) local zone2=c:GetLinkedZone(1-tp) if chk==0 then return c:GetLinkedZone()~=0 and (bc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone1,true) or bc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp,zone2)) end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,bc,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:GetLinkedZone()~=0 and tc:IsRelateToEffect(e) then local zone1=c:GetLinkedZone(tp) local zone2=c:GetLinkedZone(1-tp) if tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone1) and (not tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp,zone2) or Duel.SelectYesNo(tp,aux.Stringid(id,1))) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP,zone1) else if Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP,zone2)~=0 and c:IsRelateToBattle() then --Can make a second attack local e1=Effect.CreateEffect(c) e1:SetDescription(3201) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) c:RegisterEffect(e1) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 or more Tuners + 1 non-Tuner monster If this card is Synchro Summoned: You can target monsters your opponent controls and/or in their Graveyard, up to the number of Synchro Materials used for the Synchro Summon of this card; banish them. If this Synchro Summoned card is destroyed by battle or card effect: You can target 1 banished monster, except this card; Special Summon it to your field.
--水晶機巧-グリオンガンド --Crystron Quariongandrax local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon Procedure Synchro.AddProcedure(c,nil,2,99,Synchro.NonTuner(nil),1,1) --Banish monsters from the opponent's field and/or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) --Special Summon 1 banished monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Multiple tuners local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_MULTIPLE_TUNERS) c:RegisterEffect(e3) end function s.rmfilter(c) return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c,false,true) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ct=e:GetHandler():GetMaterialCount() if chkc then return chkc:IsLocation(LOCATION_GRAVE|LOCATION_MZONE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end if chk==0 then return ct>0 and Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_GRAVE|LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_GRAVE|LOCATION_MZONE,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSynchroSummoned() and (r&REASON_EFFECT+REASON_BATTLE)~=0 end function s.spfilter(c,e,tp) return c:IsFaceup() 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:GetHandler() if chkc then return chkc:IsLocation(LOCATION_REMOVED) and s.spfilter(chkc,e,tp) and chkc~=c end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,c,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,c,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
After you Normal Summon this card, you can Normal Summon 1 "Nordic" monster during your Main Phase this turn, in addition to your Normal Summon/Set. (You can only gain this effect once per turn.) If this face-up card on the field is sent to the GY: Target 1 "Nordic Relic" card in your GY; add that target to your hand.
--極星霊ドヴェルグ --Dverg of the Nordic Alfar local s,id=GetID() function s.initial_effect(c) --extra summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.sumop) c:RegisterEffect(e1) --salvage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_NORDIC_RELIC,SET_NORDIC} function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_NORDIC)) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEUP) end function s.filter(c) return c:IsSetCard(SET_NORDIC_RELIC) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 "Cloudian" monster from your GY. Cannot be destroyed by battle. If this card is in face-up Defense Position, destroy it. Once per turn: You can target 1 face-up monster on the field; place 1 Fog Counter on that target.
--雲魔物-ストーム・ドラゴン --Cloudian - Storm Dragon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --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) --spsummon proc local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_SPSUMMON_PROC) e3:SetProperty(EFFECT_FLAG_UNCOPYABLE) e3:SetRange(LOCATION_HAND) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --counter local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.cttg) e4:SetOperation(s.ctop) 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.spfilter(c) return c:IsSetCard(SET_CLOUDIAN) and c:IsMonster() and c:IsAbleToRemoveAsCost() 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_GRAVE,0,nil,ATTRIBUTE_WIND) return aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,ATTRIBUTE_WIND) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then tc:AddCounter(COUNTER_FOG,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time your opponent Special Summons a monster(s), place 1 Nut Counter on this card. You can remove 1 Nut Counter from this card to target 1 monster your opponent controls; destroy that target.
--ドングリス --Rodenut local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x17) --spsummon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetOperation(s.ctop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.counter_place_list={0x17} function s.ctop(e,tp,eg,ep,ev,re,r,rp) if eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) then e:GetHandler():AddCounter(0x17,1) end end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x17,1,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x17,1,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with any "Vendread" Ritual Spell. When a card or effect is activated that would destroy a card on the field (Quick Effect): You can banish 1 Zombie monster from your GY; negate the activation, and if you do, destroy that card. If this card is Tributed, or banished, for a Ritual Summon: All monsters your opponent controls lose 500 ATK/DEF. You can only use each effect of "Vendread Chimera" once per turn.
--ヴェンデット・キマイラ --Vendread Chimera --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --reduce atk local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_RELEASE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.atkcon) e2:SetOperation(s.atkop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_REMOVE) c:RegisterEffect(e3) end function s.condition(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 re:IsHasCategory(CATEGORY_NEGATE) and Duel.GetChainInfo(ev-1,CHAININFO_TRIGGERING_EFFECT):IsHasType(EFFECT_TYPE_ACTIVATE) then return false end local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY) return ex and tg~=nil and tc+tg:FilterCount(Card.IsOnField,nil)-#tg>0 end function s.cfilter(c) return c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return 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.operation(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.atkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_RITUAL) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetValue(-500) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can reveal 1 "Impcantation" monster in your hand and Special Summon 2 monsters with that monster's name from your Deck, then shuffle the revealed monster into the Deck. Once per turn, if a Ritual Monster is Special Summoned to your field (except during the Damage Step): You can target 1 card on the field; destroy it. You can only activate 1 "Impcantation Thanatosis" per turn.
--魔神儀の隠れ房 --Impcantation Thanatosis --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_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) --Destroy 1 card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_IMPCANTATION} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.revfilter(c,e,tp) return c:IsSetCard(SET_IMPCANTATION) and c:IsMonster() and c:IsAbleToDeck() and not c:IsPublic() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp,c:GetCode()) end function s.spfilter(c,e,tp,cd) return c:IsCode(cd) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end local g=Duel.GetMatchingGroup(s.revfilter,tp,LOCATION_HAND,0,nil,e,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local tc=g:Select(tp,1,1,nil):GetFirst() Duel.ConfirmCards(1-tp,tc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp,tc:GetCode()) if #sg==2 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)==2 then Duel.BreakEffect() Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end end function s.descfilter(c,tp) return c:IsFaceup() and c:IsType(TYPE_RITUAL) and c:IsControler(tp) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.descfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,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 function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster effect is activated: Detach 1 material from your DARK Xyz Monster; negate the activation, and if you do, destroy that card, then if the detached material was a "The Phantom Knights", "Raidraptor", or "Xyz Dragon" card, 1 "Raidraptor" Xyz Monster you control gains ATK equal to that destroyed monster's original ATK. You can only activate 1 "Raidraptor's Phantom Knights Claw" per turn.
--RR-ファントム・クロー --Raidraptor's Phantom Knights Claw --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_NEGATE+CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_XYZ_DRAGON,SET_THE_PHANTOM_KNIGHTS,SET_RAIDRAPTOR} function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsMonsterEffect() and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAttribute(ATTRIBUTE_DARK) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Group.CreateGroup() local mg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) for tc in aux.Next(mg) do g:Merge(tc:GetOverlayGroup()) end if chk==0 then return #g>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ) local sc=g:Select(tp,1,1,nil):GetFirst() if sc:IsSetCard({SET_XYZ_DRAGON,SET_THE_PHANTOM_KNIGHTS,SET_RAIDRAPTOR}) then e:SetLabel(1) else e:SetLabel(0) end Duel.SendtoGrave(sc,REASON_COST) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_DETACH_MATERIAL,e,0,0,0,0) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_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.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_RAIDRAPTOR) and c:IsType(TYPE_XYZ) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) and Duel.Destroy(eg,REASON_EFFECT)~=0 and e:GetLabel()==1 then local atk=Duel.GetOperatedGroup():GetFirst():GetBaseAttack() local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) if #g>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local sc=g:Select(tp,1,1,nil):GetFirst() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Flip Summoned: You can Special Summon 1 "Photon Caesar" from your hand or Deck.
--フォトン・カイザー --Photon Caesar local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_names={id} 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|LOCATION_HAND,0,1,nil,e,tp) end 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.filter,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:
If a face-up "X-Saber" monster is on the field: Target 2 "X-Saber" monsters in any Graveyard; Special Summon both to your side of the field.
--ガトムズの緊急指令 --Gottoms' Emergency Call 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_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_X_SABER} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_X_SABER),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end function s.filter(c,e,tp) return c:IsSetCard(SET_X_SABER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,2,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,2,2,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local sg=Duel.GetTargetCards(e) if #sg~=2 then return end Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand or GY and you control a LIGHT "Tistina" monster: You can Special Summon this card. You can only use this effect of "Hound of the Tistina" once per turn. "Tistina" monsters you control can attack directly while your opponent controls a face-down Defense Position monster.
--ティスティナの猟犬 --Hound of the Tistina --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --"Tistina" monsters can attack directly local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DIRECT_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_TISTINA)) e2:SetCondition(function(e) return Duel.IsExistingMatchingCard(Card.IsFacedown,e:GetHandlerPlayer(),0,LOCATION_MZONE,1,nil) end) c:RegisterEffect(e2) end s.listed_series={SET_TISTINA} function s.spconfilter(c) return c:IsFaceup() and c:IsSetCard(SET_TISTINA) and c:IsAttribute(ATTRIBUTE_LIGHT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,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:
Once per turn: You can banish 1 Dragon monster from your GY, then target 1 monster you control; it gains 700 ATK until the end of this turn (even if this card leaves the field). When this face-up card on the field is sent to the GY: You can target 1 of your banished Dragon monsters; Special Summon that target. You can only control 1 "Castle of Dragon Souls".
--竜魂の城 --Castle of Dragon Souls local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCost(s.cost) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCondition(aux.StatChangeDamageStepCondition) e2:SetCost(s.atkcost) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --spsummon 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:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) if chk==0 then return true end end function s.cfilter(c,tp) return c:IsRace(RACE_DRAGON) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,c) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local label=e:GetLabel() if chkc then return s.atktg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end if chk==0 then if Duel.IsPhase(PHASE_DAMAGE) then if label==1 then e:SetLabel(0) end return (label~=1 or s.atkcost(e,tp,eg,ep,ev,re,r,rp,0)) and s.atktg(e,tp,eg,ep,ev,re,r,rp,0) end return true end if (label~=1 or s.atkcost(e,tp,eg,ep,ev,re,r,rp,0)) and s.atktg(e,tp,eg,ep,ev,re,r,rp,0) and (Duel.IsPhase(PHASE_DAMAGE) or Duel.SelectYesNo(tp,aux.Stringid(id,2))) then e:SetCategory(CATEGORY_ATKCHANGE) e:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e:SetOperation(s.atkop) if label==1 then s.atkcost(e,tp,eg,ep,ev,re,r,rp,1) end s.atktg(e,tp,eg,ep,ev,re,r,rp,1) else e:SetCategory(0) e:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e:SetOperation(nil) end end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(700) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsPreviousPosition(POS_FACEUP) end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Cycle of the World". This card's name becomes "Ruin, Queen of Oblivion" while in the hand or on the field. While this Ritual Summoned card is on the field, Ritual Monsters you control cannot be destroyed by card effects. If all monsters used to Ritual Summon this card were Ritual Monsters, it can make a second attack during each Battle Phase. If this card destroys an opponent's monster by battle: You can inflict damage to your opponent equal to that destroyed monster's original ATK.
--破滅の美神ルイン --Ruin, Supreme Queen of Oblivion local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --code local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_HAND) e1:SetValue(46427957) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCondition(s.indcon) e2:SetTarget(s.indtg) e2:SetValue(1) c:RegisterEffect(e2) --extra attack local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_EXTRA_ATTACK) e3:SetCondition(s.condition) e3:SetValue(1) c:RegisterEffect(e3) --damage local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EVENT_BATTLE_DESTROYING) e4:SetCondition(aux.bdocon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end s.listed_names={32828635,46427957} function s.indcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRitualSummoned() end function s.indtg(e,c) return c:IsType(TYPE_RITUAL) end function s.mfilter(c) return not c:IsType(TYPE_RITUAL) end function s.condition(e) local c=e:GetHandler() local mg=c:GetMaterial() return c:GetSummonType()==SUMMON_TYPE_RITUAL and #mg>0 and not mg:IsExists(s.mfilter,1,nil) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local tc=e:GetHandler():GetBattleTarget() local atk=tc:GetBaseAttack() if atk<0 then atk=0 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(atk) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card destroys a monster by battle and sends it to the GY: Inflict damage to your opponent equal to the original Level of that monster in the GY x 100. You can banish this card from your GY; Special Summon 1 Fiend monster with 2000 or less ATK from your hand.
--ヘルウェイ・パトロール --Stygian Street Patrol 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:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCondition(aux.bdgcon) e1:SetTarget(s.damtarget) e1:SetOperation(s.damoperation) c:RegisterEffect(e1) --Special summon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptarget) e2:SetOperation(s.spoperation) c:RegisterEffect(e2) end function s.damtarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() local m=0 if a==e:GetHandler() then m=d:GetLevel()*100 else m=a:GetLevel()*100 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(m) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,m) end function s.damoperation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.filter(c,e,tp) local atk=c:GetAttack() return atk>=0 and atk<=2000 and c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.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.spoperation(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:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 FIRE monster from your GY. Gains 300 ATK during your Battle Phase only.
--炎の精霊 イフリート --Spirit of Flames local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCondition(s.atkcon) e2:SetValue(300) c:RegisterEffect(e2) end function s.atkcon(e) local tp=Duel.GetTurnPlayer() return tp==e:GetHandler():GetControler() and Duel.IsBattlePhase() end function s.spfilter(c,tp) return c:IsAttribute(ATTRIBUTE_FIRE) 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_GRAVE,0,nil,ATTRIBUTE_WIND) return aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,ATTRIBUTE_WIND) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Aleister the Invoker" + 1 DARK monster Each player can only attempt to activate 1 monster effect per turn. Each player can only attack with 1 monster during each Battle Phase.
--召喚獣カリギュラ --Invoked Caliga local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,86120751,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_DARK)) --activate limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.aclimit1) c:RegisterEffect(e1) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EFFECT_CANNOT_ACTIVATE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(1,0) e3:SetCondition(s.econ1) e3:SetValue(s.elimit) c:RegisterEffect(e3) local e4=e1:Clone() e4:SetOperation(s.aclimit3) c:RegisterEffect(e4) local e6=e3:Clone() e6:SetCondition(s.econ2) e6:SetTargetRange(0,1) c:RegisterEffect(e6) --attack limit local e7=Effect.CreateEffect(c) e7:SetType(EFFECT_TYPE_FIELD) e7:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e7:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e7:SetRange(LOCATION_MZONE) e7:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e7:SetCondition(s.atkcon) e7:SetTarget(s.atktg) c:RegisterEffect(e7) local e8=Effect.CreateEffect(c) e8:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e8:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e8:SetCode(EVENT_ATTACK_ANNOUNCE) e8:SetRange(LOCATION_MZONE) e8:SetOperation(s.checkop) e8:SetLabelObject(e7) c:RegisterEffect(e8) end function s.aclimit1(e,tp,eg,ep,ev,re,r,rp) if ep~=tp or not re:IsMonsterEffect() then return end e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_CONTROL|RESET_PHASE|PHASE_END,0,1) end function s.econ1(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.aclimit3(e,tp,eg,ep,ev,re,r,rp) if ep==tp or not re:IsMonsterEffect() then return end e:GetHandler():RegisterFlagEffect(id+1,RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_CONTROL|RESET_PHASE|PHASE_END,0,1) end function s.econ2(e) return e:GetHandler():GetFlagEffect(id+1)~=0 end function s.elimit(e,re,tp) return re:IsMonsterEffect() end function s.atkcon(e) return e:GetHandler():GetFlagEffect(id+2)~=0 end function s.atktg(e,c) return c:GetFieldID()~=e:GetLabel() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():GetFlagEffect(id+2)~=0 then return end local fid=eg:GetFirst():GetFieldID() e:GetHandler():RegisterFlagEffect(id+2,RESETS_STANDARD_PHASE_END,0,1) e:GetLabelObject():SetLabel(fid) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Your opponent selects 1 monster they control. Switch control of the selected monster and this card.
--ダミー・ゴーレム --Dummy Golem local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) 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_CONTROL,nil,0,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) or not c:IsRelateToEffect(e) or not c:IsAbleToChangeControler() or not Duel.IsExistingMatchingCard(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) then return end Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_CONTROL) local g=Duel.SelectMatchingCard(1-tp,Card.IsAbleToChangeControler,1-tp,LOCATION_MZONE,0,1,1,nil) Duel.SwapControl(c,g:GetFirst(),0,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Level/Rank 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Jet" once per turn this way. If this card is Special Summoned: You can add 1 "Spright" Spell/Trap from your Deck to your hand. You can only use this effect of "Spright Jet" once per turn.
--スプライト・ジェット --Spright Jet --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self 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,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Search 1 "Splight" Spell/Trap local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_SPRIGHT} function s.spconfilter(c) return c:IsFaceup() and (c:IsLevel(2) or c:IsRank(2)) end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.thfilter(c) return c:IsSetCard(SET_SPRIGHT) 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:
2+ monsters, except Tokens Gains 300 ATK for each monster co-linked to this card. You can target 1 Link-3 or lower monster co-linked to this card; Tribute it, and if you do, Special Summon "V-LAN Tokens" (Cyberse/LIGHT/Level 1/ATK 0/DEF 0) equal to the Tributed monster's Link Rating, also you cannot Special Summon monsters with the same Link Rating as that targeted monster for the rest of this turn. You can only use this effect of "V-LAN Hydra" once per turn.
--V-LAN ヒドラ --V-LAN Hydra local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() Link.AddProcedure(c,s.matfilter,2) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) c:RegisterEffect(e1) --token local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.tktg) e2:SetOperation(s.tkop) c:RegisterEffect(e2) end s.listed_names={13536607} function s.matfilter(c,lc,sumtype,tp) return not c:IsType(TYPE_TOKEN,lc,sumtype,tp) end function s.atkval(e,c) return #(c:GetMutualLinkedGroup():Filter(Card.IsMonster,nil))*300 end function s.rfilter(c,tp,g) local lk=c:GetLink() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if c:IsControler(tp) then return c:IsFaceup() and c:IsLinkMonster() and c:IsLinkBelow(3) and c:IsReleasableByEffect() and g:IsContains(c) and ((c:GetSequence()>4 and ft>=lk) or (c:GetSequence()<=4 and (ft+1)>=lk)) and (ft==1 or not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) elseif c:IsControler(1-tp) then return c:IsFaceup() and c:IsLinkMonster() and c:IsLinkBelow(3) and c:IsReleasableByEffect() and g:IsContains(c) and ft>=lk and (ft==1 or not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) else return false end end function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local lg=c:GetMutualLinkedGroup() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.rfilter(chkc,tp,lg) end if chk==0 then return Duel.IsExistingTarget(s.rfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp,lg) and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_LIGHT) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=Duel.SelectTarget(tp,s.rfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp,lg) local ct=rg:GetFirst():GetLink() Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,ct,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,ct,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local ct=tc:GetLink() if tc and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 then local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<ct or (ft>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_LIGHT) then return end for i=1,ct do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetLabel(ct) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLink(e:GetLabel()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Level 8 or higher Dragon Synchro Monster: Special Summon as many monsters as possible from your GY that were destroyed and sent to your GY by battle or an opponent's card effect this turn. You can only activate 1 "Stardust Mirage" per turn.
--スターダスト・ミラージュ --Stardust Mirage --Scripted by AlphaKretin 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(TIMING_END_PHASE,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsLevelAbove(8) and c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_DRAGON) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.spfilter(c,e,tp,turn) return c:GetTurnID()==turn and c:IsReason(REASON_DESTROY) and (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,Duel.GetTurnCount()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp,Duel.GetTurnCount()) if #g==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,ft,ft,nil) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand or GY) during a Duel in which your opponent has activated a monster effect in their hand or GY. You can only Special Summon "Carnot the Eternal Machine" once per turn. Once per turn, if your opponent activates a monster effect (except during the Damage Step): You can make this card gain 1000 ATK. If this card is sent to the GY, except from the hand or Deck: Shuffle this card into the Deck.
--無窮機竜カルノール --Carnot the Eternal Machine --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --You can only Special Summon "Etermakina Carnord(s)" once per turn c:SetSPSummonOnce(id) --Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --This card gains 1000 ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(function(e,tp,eg,ep,ev,re) return ep==1-tp and re:IsMonsterEffect() end) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --Shuffle this card into the Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(function(e) return not e:GetHandler():IsPreviousLocation(LOCATION_HAND|LOCATION_DECK) end) e3:SetTarget(s.tdtg) e3:SetOperation(s.tdop) c:RegisterEffect(e3) --Register if a player activated a monster effect in the hand or GY this Duel aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_CHAIN_SOLVED) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) end) end s.listed_names={id} function s.regop(e,tp,eg,ep,ev,re,r,rp) if not re:IsMonsterEffect() or Duel.HasFlagEffect(rp,id) then return end local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) if loc==LOCATION_HAND or loc==LOCATION_GRAVE then Duel.RegisterFlagEffect(rp,id,0,0,0) end 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.HasFlagEffect(1-tp,id) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --Gains 1000 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Turbo Rocket" + 1 or more non-Tuner monsters Once per turn, you can destroy 1 face-up monster on the field and inflict damage to its controller equal to half of its ATK.
--ワンショット・キャノン --Turbo Cannon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterSummonCode(6142213),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --destroy & damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.material={6142213} s.listed_names={6142213} function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,g:GetFirst():GetControler(),g:GetFirst():GetAttack()/2) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local dam=tc:GetAttack()/2 local p=tc:GetControler() if Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Damage(p,dam,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, while you have no cards in your hand, you can draw 1 card and reveal it. For a Monster Card drawn with this effect, inflict damage to your opponent equal to the Level of that monster x 200. For a Spell or Trap Card, you take 500 damage.
--インフェルニティ・リローダー --Infernity Randomizer local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)==0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,1,tp,1) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)~=0 then return end local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() Duel.Draw(tp,1,REASON_EFFECT) if tc then Duel.ConfirmCards(1-tp,tc) Duel.BreakEffect() if tc:IsMonster() then Duel.Damage(1-tp,tc:GetLevel()*200,REASON_EFFECT) else Duel.Damage(tp,500,REASON_EFFECT) end Duel.ShuffleHand(tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
A non Machine-Type Monster attacking "Steel Scorpion" will be destroyed at the End Phase of your opponent's 2nd turn after the attack.
--鉄のサソリ --Steel Scorpion local s,id=GetID() function s.initial_effect(c) -- local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLED) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) local g=Group.CreateGroup() g:KeepAlive() e1:SetLabelObject(g) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e2:SetCode(1082946) e2:SetLabelObject(e1) e2:SetCondition(s.resetcon) e2:SetOperation(s.resetop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCondition(function(e)return #e:GetLabelObject():GetLabelObject():GetLabelObject()>0 end) e3:SetOperation(s.endop) e3:SetCountLimit(1) e3:SetLabelObject(e2) Duel.RegisterEffect(e3,0) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler()==Duel.GetAttackTarget() and not Duel.GetAttacker():IsRace(RACE_MACHINE) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetAttacker() if tc and tc:IsRelateToBattle() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(id) e1:SetLabelObject(e) e1:SetLabel(0) e1:SetOwnerPlayer(tp) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) e:GetLabelObject():AddCard(tc) end end function s.rfilter(c,e) if not c:IsLocation(LOCATION_MZONE) then return true end local eff={c:GetCardEffect(id)} for _,te in ipairs(eff) do if te:GetLabelObject()==e then return false end end return true end function s.resetcon(e) local g=e:GetLabelObject():GetLabelObject() local rg=g:Filter(s.rfilter,nil,e:GetLabelObject()) g:Sub(rg) return #g>0 end function s.resetop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject():GetLabelObject() local sg=g:Select(tp,1,1,nil) Duel.HintSelection(sg) s.desop(sg:GetFirst(),e:GetLabelObject(),e:GetHandler(),false) end function s.endop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject():GetLabelObject():GetLabelObject() local tc=g:GetFirst() for tc in aux.Next(g) do s.desop(tc,e:GetLabelObject():GetLabelObject(),e:GetHandler(),true) end end function s.desop(tc,e,c,check) local eff={tc:GetCardEffect(id)} for _,te in ipairs(eff) do if te:GetLabelObject()==e and (not check or te:GetOwnerPlayer()~=Duel.GetTurnPlayer()) then local ct=te:GetLabel()+1 te:SetLabel(ct) c:SetTurnCounter(ct) if ct==3 and Duel.Destroy(tc,REASON_EFFECT)>0 then --to be added if andre's PRs are merged --tc:SetReasonPlayer(te:GetOwnerPlayer()) --tc:SetReasonEffect(te) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a face-up "Dark Magician Girl": Special Summon 1 "Dark Magician" from your hand or Deck.
--賢者の宝石 --Sage's Stone 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:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_DARK_MAGICIAN,CARD_DARK_MAGICIAN_GIRL} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_DARK_MAGICIAN_GIRL),tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c,e,tp) return c:IsCode(CARD_DARK_MAGICIAN) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end 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 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,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:
Target 1 "Majespecter" monster you control; until the end of this turn, its ATK/DEF become double its current ATK/DEF, and if they do, any battle damage it inflicts to your opponent is halved. * The above text is unofficial and describes the card's functionality in the OCG.
--マジェスペクター・ソニック --Majespecter Sonics local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) 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_MAJESPECTER} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_MAJESPECTER) 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_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(tc:GetAttack()*2) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_DEFENSE_FINAL) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(tc:GetDefense()*2) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e3:SetReset(RESETS_STANDARD_PHASE_END) e3:SetValue(aux.ChangeBattleDamage(1,HALF_DAMAGE)) tc:RegisterEffect(e3) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 card; destroy all face-up Continuous Traps on the field.
--邪気退散 --Malice Dispersion 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_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsFaceup() and c:IsContinuousTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,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,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 "Ninja" monster to target 1 monster your opponent controls; banish that target. While that card is banished, its Monster Card Zone cannot be used. When this face-up card leaves the field: Return the card banished by this effect to the same Monster Card Zone, in the same battle position.
--忍法 影縫いの術 --Ninjitsu Art of Shadow Sealing local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --return local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCondition(s.retcon) e2:SetOperation(s.retop) c:RegisterEffect(e2) end s.listed_series={SET_NINJA} function s.cfilter(c) return c:IsSetCard(SET_NINJA) end function s.filter(c,e) return c:IsAbleToRemove() and c:IsCanBeEffectTarget(e) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not c:IsRelateToEffect(e) or not tc then return end local seq=tc:GetSequence() if tc:IsControler(1-tp) then seq=seq+16 end if tc:IsRelateToEffect(e) and Duel.Remove(tc,0,REASON_EFFECT|REASON_TEMPORARY)~=0 and tc:IsLocation(LOCATION_REMOVED) then c:SetCardTarget(tc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE_FIELD) e1:SetRange(LOCATION_SZONE) e1:SetLabel(seq) e1:SetCondition(s.discon) e1:SetOperation(s.disop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end function s.discon(e) return e:GetHandler():GetCardTargetCount()>0 end function s.disop(e,tp) return 0x1<<e:GetLabel() end function s.retcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_REMOVED) and not c:IsLocation(LOCATION_DECK) then e:SetLabelObject(tc) tc:CreateEffectRelation(e) return true else return false end end function s.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=e:GetLabelObject() if tc and tc:IsRelateToEffect(e) then local seq=tc:GetPreviousSequence() if seq>4 then Duel.SendtoGrave(tc,REASON_RULE|REASON_RETURN) end local zone=0x1<<seq Duel.ReturnToField(tc,tc:GetPreviousPosition(),zone) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If an EARTH Machine monster(s) is Normal or Special Summoned to your field (except during the Damage Step): You can Special Summon this card from your hand, but its original ATK/DEF become halved. You can only use this effect of "Heavy Freight Train Derricrane" once per turn. If this card is detached from an Xyz Monster and sent to the GY to activate that monster's effect: You can target 1 card your opponent controls; destroy it.
--重機貨列車デリックレーン --Heavy Freight Train Derricrane local s,id=GetID() function s.initial_effect(c) --Special Summon itself local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_HAND) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Destroy 1 target local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.spfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then local atk=c:GetBaseAttack() local def=c:GetBaseDefense() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(atk/2) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(def/2) c:RegisterEffect(e2) end Duel.SpecialSummonComplete() end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_COST) and re:IsActivated() and re:IsActiveType(TYPE_XYZ) and c:IsPreviousLocation(LOCATION_OVERLAY) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(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:
You can discard this card; add 1 "Dark Fusion", or 1 card that mentions it, from your Deck to your hand, except "Evil HERO Adusted Gold". You can only use this effect of "Evil HERO Adusted Gold" once per turn. Cannot attack unless you control a Fusion Monster.
--E-HERO アダスター・ゴールド --Evil HERO Adusted Gold --Scripted by AlphaKretin 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:SetCountLimit(1,id) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --cannot attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_ATTACK) e2:SetCondition(s.atkcon) c:RegisterEffect(e2) end s.listed_names={CARD_DARK_FUSION} function s.thfilter(c) return c:IsAbleToHand() and not c:IsCode(id) and (c:IsCode(CARD_DARK_FUSION) or c:ListsCode(CARD_DARK_FUSION)) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.atkcon(e) return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_FUSION),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target face-up cards on the field, up to the number of Attack Position "Abyss Actor" monsters with different names you control; destroy them. If you control a Level 7 or higher "Abyss Actor" monster, your opponent cannot activate cards or effects in response to this card's activation. If this Set card in its owner's control is destroyed by an opponent's card effect, and you have a face-up "Abyss Actor" Pendulum Monster in your Extra Deck: You can add up to 2 "Abyss Actor" cards and/or "Abyss Script" Spells with different names from your Deck to your hand.
--魔界台本「魔王の降臨」 --Abyss Script - Rise of the Abyss King 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) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_ABYSS_ACTOR,SET_ABYSS_SCRIPT} function s.cfilter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsSetCard(SET_ABYSS_ACTOR) end function s.lmfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ABYSS_ACTOR) and c:IsLevelAbove(7) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) local ct=g:GetClassCount(Card.GetCode) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) if Duel.IsExistingMatchingCard(s.lmfilter,tp,LOCATION_MZONE,0,1,nil) and e:IsHasType(EFFECT_TYPE_ACTIVATE) then Duel.SetChainLimit(s.chainlm) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) Duel.Destroy(g,REASON_EFFECT) end function s.chainlm(e,rp,tp) return tp==rp end function s.filter2(c) return c:IsSetCard(SET_ABYSS_ACTOR) and c:IsFaceup() and c:IsType(TYPE_PENDULUM) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and rp==1-tp and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil) end function s.thfilter(c) return (c:IsSetCard(SET_ABYSS_ACTOR) or (c:IsSetCard(SET_ABYSS_SCRIPT) 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) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g<=0 then return end local sg=aux.SelectUnselectGroup(g,e,tp,1,2,aux.dncheck,1,tp,HINTMSG_ATOHAND) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned from the Graveyard: You can destroy all face-up monsters your opponent controls. You cannot conduct your Battle Phase the turn you activate this effect.
--大狼雷鳴 --Thunderclap Skywolf local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_BATTLE_PHASE)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BP) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,0),nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control 2 or more face-up monsters with the same name, except Tokens: Apply this effect, depending on how many you control. ● Exactly 2: Destroy 1 Spell/Trap Card your opponent controls. ● Exactly 3: Destroy all Spell/Trap Cards your opponent controls.
--同姓同名同盟条約 --Treaty on Uniform Nomenclature 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_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_ATTACK) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and not c:IsType(TYPE_TOKEN) end function s.get_count(g) if #g==0 then return 0 end local ret=0 repeat local tc=g:GetFirst() g:RemoveCard(tc) local ct1=#g g:Remove(Card.IsCode,nil,tc:GetCode()) local ct2=#g local c=ct1-ct2+1 if c>ret then ret=c end until #g==0 or #g<=ret return ret end function s.condition(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) local ct=s.get_count(g) e:SetLabel(ct) return ct==2 or ct==3 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) if e:GetLabel()==2 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) else Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) local ct=s.get_count(g) if ct==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.Destroy(g,REASON_EFFECT) elseif ct==3 then local g=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Fusion, Synchro, Xyz, or Link Monster(s) is sent to the GY (except during the Damage Step): You can Special Summon this card from your hand. If this card is Special Summoned from the hand: You can target 1 "Dogmatika" card in your GY, except "Dogmatika Ashiyan"; add it to your hand. When an opponent's monster declares an attack: You can make all "Dogmatika" monsters you currently control gain 500 ATK. You can only use each effect of "Dogmatika Ashiyan" once per turn.
--教導の神徒 --Dogmatika Ashiyan --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 "Dogmatika" card from GY to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcond) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Increase the ATK of all "Dragma" monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.atkcon) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_DOGMATIKA} s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsType,1,nil,TYPE_EXTRA) 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) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 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 function s.thcond(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSummonLocation(LOCATION_HAND) end function s.thfilter(c) return c:IsSetCard(SET_DOGMATIKA) and c:IsAbleToHand() and not c:IsCode(id) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_DOGMATIKA),tp,LOCATION_MZONE,0,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_DOGMATIKA),tp,LOCATION_MZONE,0,nil) for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
A Synchro Monster that used this card as a Synchro Material gains 300 ATK.
--フレア・リゾネーター --Flare Resonator local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local sync=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(300) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sync:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Neos" (or 1 Fusion Monster that mentions it) + 1 Effect Monster on the field Must be Special Summoned with "Dark Fusion". Cannot be destroyed by battle or card effects. If this card is Special Summoned, or a monster(s) is sent to your opponent's GY while this card is on the field: You can target 1 face-up monster your opponent controls; take control of it. You can only use this effect of "Evil HERO Neos Lord" once per turn.
--E-HERO ネオス・ロード --Evil HERO Neos Lord local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: "Elemental HERO Neos" or 1 Fusion Monster that mentions it + 1 Effect Monster on the field Fusion.AddProcMix(c,true,true,{CARD_NEOS,s.neosfusionmatfilter},s.effectmatfilter) c:AddMustBeSpecialSummonedByDarkFusion() --Take control of 1 face-up monster your opponent controls local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.ctrltg) e1:SetOperation(s.ctrlop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.ctrlcon) c:RegisterEffect(e2) --Cannot be destroyed by battle or card effects local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetRange(LOCATION_MZONE) e3:SetValue(1) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e4) end s.listed_names={CARD_NEOS,CARD_DARK_FUSION} s.listed_series={SET_HERO,SET_EVIL_HERO} s.material_setcode={SET_ELEMENTAL_HERO,SET_HERO,SET_NEOS} function s.neosfusionmatfilter(c,fc,sumtype,tp) return c:IsType(TYPE_FUSION,fc,sumtype,tp) and c:ListsCode(CARD_NEOS) end function s.effectmatfilter(c,fc,sumtype,tp) return c:IsType(TYPE_EFFECT,fc,sumtype,tp) and c:IsOnField() end function s.ctrltg(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:IsControlerCanBeChanged() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsControlerCanBeChanged),tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsControlerCanBeChanged),tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0) end function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp) end end function s.ctrlconfilter(c,tp) return c:IsControler(1-tp) and c:IsMonster() end function s.ctrlcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.ctrlconfilter,1,nil,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Dark Magician" + "Flame Swordsman" You take no Battle Damage from battles involving this card. When this card is destroyed by battle and sent to the Graveyard: Special Summon 1 "Mirage Knight" from your hand or Deck.
--黒炎の騎士-ブラック・フレア・ナイト- --Dark Flare Knight local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials Fusion.AddProcMix(c,true,true,CARD_DARK_MAGICIAN,CARD_FLAME_SWORDSMAN) --You take no Battle Damage from battles involving this card local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetValue(1) c:RegisterEffect(e1) --Special Summon 1 "Mirage Knight" from your hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCondition(function(e) return e:GetHandler():IsLocation(LOCATION_GRAVE) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.material_setcode=SET_DARK_MAGICIAN s.listed_names={CARD_DARK_MAGICIAN,CARD_FLAME_SWORDSMAN,49217579} --Mirage Knight function s.spfilter(c,e,tp) return c:IsCode(49217579) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP)>0 then sc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Spellcaster monster + 1 Dragon monster Cannot be used as Fusion Material. This card loses 100 ATK for each of your banished cards. If a monster uses its activated effect to Special Summon itself, or a monster(s) with its same original Type (except during the Damage Step): You can target 1 of those Special Summoned monsters; banish that monster, also banish all monsters from the field with its same original Type. You can only use this effect of "Mysterion the Dragon Crown" once per turn.
--ミュステリオンの竜冠 --Mysterion the Dragon Crown --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: 1 Spellcaster monster + 1 Dragon monster Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON)) --Cannot be used as Fusion Material local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e0:SetValue(1) c:RegisterEffect(e0) --This card loses 100 ATK for each of your banished cards local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(function(e,cc) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_REMOVED,0)*-100 end) c:RegisterEffect(e1) --Banish 1 Special Summoned monster, also banish all monsters from the field with its same original Type local e2a=Effect.CreateEffect(c) e2a:SetDescription(aux.Stringid(id,0)) e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2a:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2a:SetCode(EVENT_CUSTOM+id) e2a:SetRange(LOCATION_MZONE) e2a:SetCountLimit(1,id) e2a:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e2a:SetTarget(s.rmtg) e2a:SetOperation(s.rmop) c:RegisterEffect(e2a) local g=Group.CreateGroup() g:KeepAlive() e2a:SetLabelObject(g) --Register summons local e2b=Effect.CreateEffect(c) e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2b:SetCode(EVENT_SPSUMMON_SUCCESS) e2b:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2b:SetRange(LOCATION_MZONE) e2b:SetLabelObject(e2a) e2b:SetOperation(s.regop) c:RegisterEffect(e2b) end function s.tgfilter(c,rc,e) return c:IsLocation(LOCATION_MZONE) and (rc==c or (c:IsFaceup() and rc:IsOriginalRace(c:GetOriginalRace()))) and c:IsAbleToRemove() and (not e or c:IsCanBeEffectTarget(e)) end function s.tgfilter2(c,e) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsAbleToRemove() and (not e or c:IsCanBeEffectTarget(e)) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local rc=re:GetHandler() local g=e:GetLabelObject():Filter(s.tgfilter2,nil,e) if chkc then return g:IsContains(chkc) and s.tgfilter(chkc,nil) end if chk==0 then return #g>0 end local tc=nil if #g==1 then tc=g:GetFirst() Duel.SetTargetCard(tc) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) tc=g:Select(tp,1,1,nil) Duel.SetTargetCard(tc) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,tc,1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsOriginalRace,tc:GetOriginalRace()),tp,LOCATION_MZONE,LOCATION_MZONE,tc)+tc Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if eg:IsContains(c) then return end local rc=re:GetHandler() if not (re and re:IsActivated() and re:IsMonsterEffect() and rc) then return end local tg=eg:Filter(s.tgfilter,nil,rc) if #tg>0 then for tc in tg:Iter() do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target up to 2 face-up monsters you control, including a Fiend monster; Special Summon this card from your hand, and if you do, destroy those monsters. You can only use this effect of "Berserk Archfiend" once per turn. When a monster(s) is destroyed by this card's effect: You can target face-up monsters your opponent controls equal to the number destroyed; this card gains ATK equal to their combined original ATK, until the end of your next turn.
--バーサーク・デーモン --Berserk Archfiend --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand and destroy 2 monsters you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Gain ATK equal to the total original ATK of your opponent's monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_CUSTOM+id) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.rescon(sg,e,tp,mg) return sg:IsExists(Card.IsRace,1,nil,RACE_FIEND) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeEffectTarget,e),tp,LOCATION_MZONE,0,nil,e) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and #g>0 and aux.SelectUnselectGroup(g,e,tp,1,2,s.rescon,0) end local dg=aux.SelectUnselectGroup(g,e,tp,1,2,s.rescon,1,tp,HINTMSG_TARGET,s.rescon) Duel.SetTargetCard(dg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0) then return end local g=Duel.GetTargetCards(e) if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 then local og=Duel.GetOperatedGroup() Duel.RaiseSingleEvent(c,EVENT_CUSTOM+id,e,REASON_EFFECT,tp,tp,#og) end end function s.cfilter(c) return c:IsFaceup() and c:GetBaseAttack()>0 end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return ev==1 and chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.cfilter(chkc) end local c=e:GetHandler() if chk==0 then return c:IsRelateToEffect(e) and Duel.IsExistingTarget(s.cfilter,tp,0,LOCATION_MZONE,ev,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.cfilter,tp,0,LOCATION_MZONE,ev,ev,nil) local atk=g:GetSum(Card.GetBaseAttack) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,tp,atk) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsFaceup() and c:IsRelateToEffect(e)) then return end local g=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil) if #g==0 then return end local atk=g:GetSum(Card.GetBaseAttack) local ct=Duel.IsTurnPlayer(tp) and 3 or 2 --Gains ATK equal to those monsters' total original ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END,ct) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Lord of D." + "Divine Dragon Ragnarok" Your opponent cannot target Dragon monsters on the field with card effects. Once per turn: You can Special Summon 1 Dragon monster from your hand. * The above text is unofficial and describes the card's functionality in the OCG.
--竜魔人 キングドラグーン --King Dragun local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,17985575,62113340) --cannot be target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_DRAGON)) e1:SetValue(aux.tgoval) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.filter(c,e,tp) return c:IsRace(RACE_DRAGON) 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:
Negate the effect of your opponent's first Trap Card or effect that resolves each turn while you control a Spellcaster monster, and if you do, destroy that card.
--魔術師の左手 --Magician's Left Hand 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) --negate local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.negcon) e2:SetOperation(s.negop) c:RegisterEffect(e2) aux.DoubleSnareValidity(c,LOCATION_SZONE) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),tp,LOCATION_MZONE,0,1,nil) and rp==1-tp and re:IsTrapEffect() and Duel.IsChainDisablable(ev) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if Duel.NegateEffect(ev) and rc:IsRelateToEffect(re) then Duel.Destroy(rc,REASON_EFFECT) end end