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 "Cyber Dragon" is in your GY: You can activate 1 of these effects. If you have 3 or more "Cyber Dragon" in your GY at this card's activation, you can activate both effects and resolve in sequence. You can only activate 1 "Cyber Repair Plant" per turn. ● Add 1 LIGHT Machine monster from your Deck to your hand. ● Target 1 LIGHT Machine monster in your GY; shuffle that target into your Deck.
--サイバー・リペア・プラント --Cyber Repair Plant local s,id=GetID() function s.initial_effect(c) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,CARD_CYBER_DRAGON) end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_CYBER_DRAGON} function s.thfilter(c) return c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand() end function s.tdfilter(c) return c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return e:GetLabel()~=0 and chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) local b3=b1 and b2 and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,3,nil,CARD_CYBER_DRAGON) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}, {b3,aux.Stringid(id,3)}) e:SetLabel(op) local cat=0 if op==1 or op==3 then cat=CATEGORY_TOHAND+CATEGORY_SEARCH e:SetCategory(cat) e:SetProperty(0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end if op==2 or op==3 then cat=cat|CATEGORY_TODECK e:SetCategory(cat) e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() local breakeff=false if op==1 or op==3 then --Add 1 LIGHT Machine monster from your Deck to your hand 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) breakeff=true end end if op==2 or op==3 then --Shuffle 1 LIGHT Machine monster from your GY into your Deck local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then if breakeff then Duel.BreakEffect() end Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Trap Card is activated: Send 1 "Laval" monster from your hand to the Graveyard; negate the activation and destroy it. If this card is in the Graveyard: You can banish 2 FIRE monsters from your Graveyard; add this card to your hand.
--炎渦の胎動 --Burgeoning Whirlflame local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_LAVAL} function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsTrapEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:IsSetCard(SET_LAVAL) and c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():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 function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) 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.thfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_MZONE|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) if chk==0 then return e:GetHandler():IsAbleToHand() and not e:GetHandler():IsStatus(STATUS_CHAINING) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only during your opponent's Standby Phase. Select 1 random card from your opponent's hand and look at it. Unless the selected card or a card with the same name is Normal Summoned or activated by the end of your next turn, inflict 1000 damage to your opponent. If the selected card or a card with the same name is Normal Summoned or activated by the end of your next turn, you take 1000 damage.
--王宮の重税 --Royal Writ of Taxation local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_STANDBY_PHASE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_STANDBY) and Duel.GetTurnPlayer()~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)>0 end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)==0 then return end local g=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0):RandomSelect(tp,1) local tc=g:GetFirst() Duel.ConfirmCards(tp,tc) Duel.ShuffleHand(1-tp) local code=tc:GetCode() 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.damcon) e1:SetOperation(s.damop) e1:SetLabel(0) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetOperation(s.damop2) e2:SetLabelObject(e1) e2:SetLabel(code) e2:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_CHAIN_SOLVING) e3:SetOperation(s.damop3) e3:SetLabelObject(e1) e3:SetLabel(code) e3:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e3,tp) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and e:GetLabel()==0 end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(1-tp,1000,REASON_EFFECT) end function s.damop2(e,tp,eg,ep,ev,re,r,rp) if eg:GetFirst():IsCode(e:GetLabel()) then Duel.Damage(tp,1000,REASON_EFFECT) e:GetLabelObject():SetLabel(1) end end function s.damop3(e,tp,eg,ep,ev,re,r,rp) if re:GetHandler():IsCode(e:GetLabel()) then Duel.Damage(tp,1000,REASON_EFFECT) e:GetLabelObject():SetLabel(1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Fairy monsters If this card is Special Summoned: You can inflict 200 damage to your opponent for each card they control. If this Link Summoned card is destroyed by battle or effect: You can Special Summon 1 Link-2 or lower "Trickstar" monster from your Extra Deck, then inflict 200 damage to your opponent for each card they control. You can only use each effect of "Trickstar Foxglove Witch" once per turn.
--トリックスター・フォクシーウィッチ --Trickstar Foxglove Witch local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_FAIRY),2) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg2) e2:SetOperation(s.damop2) c:RegisterEffect(e2) end s.listed_series={SET_TRICKSTAR} function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local d=Duel.GetFieldGroupCount(p,LOCATION_ONFIELD,0)*200 Duel.Damage(p,d,REASON_EFFECT) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (r&REASON_EFFECT+REASON_BATTLE)~=0 and c:IsLinkSummoned() and c:IsPreviousLocation(LOCATION_MZONE) end function s.damfilter(c,e,tp) return c:IsSetCard(SET_TRICKSTAR) and c:IsLinkBelow(2) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.damtg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.damfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200) end function s.damop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.damfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)~=0 then Duel.BreakEffect() local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local d=Duel.GetFieldGroupCount(p,LOCATION_ONFIELD,0)*200 Duel.Damage(p,d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 "Amazoness" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. During your Main Phase: You can banish this card from your GY; once, if you Fusion Summon an "Amazoness" Fusion Monster this turn, you can also send 1 "Amazoness" monster from your Extra Deck to the GY as material. You can only use 1 "Amazoness Secret Arts" effect per turn, and only once that turn.
--アマゾネスの秘術 --Amazoness Secret Arts --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Fusion Summon 1 "Amazoness" monster local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsSetCard,SET_AMAZONESS)) e1:SetDescription(aux.Stringid(id,0)) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --Allow Fusion material from the Extra Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetOperation(s.fexop) c:RegisterEffect(e2) end s.listed_series={SET_AMAZONESS} function s.fexop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Extra Fusion Material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL) e1:SetCountLimit(1) e1:SetTargetRange(LOCATION_EXTRA,0) e1:SetTarget(function(e,c) return c:IsSetCard(SET_AMAZONESS) and c:IsAbleToGrave() end) e1:SetValue(s.matval) e1:SetLabelObject({s.extrafil_replacement}) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,2)) end function s.matval(e,c) return c and c:IsSetCard(SET_AMAZONESS) and c:IsControler(e:GetHandlerPlayer()) end function s.extrafil_repl_filter(c) return c:IsMonster() and c:IsAbleToGrave() and c:IsSetCard(SET_AMAZONESS) end function s.extrafil_replacement(e,tp,mg) local g=Duel.GetMatchingGroup(s.extrafil_repl_filter,tp,LOCATION_EXTRA,0,nil) return g,s.fcheck_replacement end function s.fcheck_replacement(tp,sg,fc) return sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA)<=1 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be used to Ritual Summon any Ritual Monster. You must also Tribute "Impcantation" monsters from your hand or field whose total Levels equal or exceed the Level of the Ritual Monster you Ritual Summon. If this card is in your GY: You can send 1 "Impcantation" card from your hand or face-up field to the GY, except "Impcantation Inception"; Special Summon 1 "Impcantation" monster from your Deck, then add this card from the GY to your hand. You can only use this effect of "Impcantation Inception" once per turn.
--魔神儀の祝誕 --Impcantation Inception --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) Ritual.AddProcGreater({handler=c,matfilter=s.matfil}) -- local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_IMPCANTATION} function s.matfil(c) return c:IsSetCard(SET_IMPCANTATION) end function s.spcfilter(c,tp) return c:IsSetCard(SET_IMPCANTATION) and not c:IsCode(id) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil,tp) Duel.SendtoGrave(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_IMPCANTATION) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) and c:IsRelateToEffect(e) then Duel.BreakEffect() Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If an opponent's card effect activates, before resolving that effect, toss a coin twice, and if the result is 2 Heads, negate that effect. You can only use this effect of "Ms. Judge" once per turn.
--Ms.JUDGE --Ms. Judge local s,id=GetID() function s.initial_effect(c) --Toss a coin and negate an effect when it resolves local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_CHAINING) e0:SetRange(LOCATION_MZONE) e0:SetOperation(aux.chainreg) c:RegisterEffect(e0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.discon) e1:SetOperation(s.disop) c:RegisterEffect(e1) end s.toss_coin=true function s.discon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and Duel.IsChainDisablable(ev) and e:GetHandler():GetFlagEffect(1)>0 end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.CountHeads(Duel.TossCoin(tp,2))==2 then Duel.NegateEffect(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Battle Phase, activate 1 of these effects. ● Target 1 monster on the field; it cannot be destroyed by battle or by card effects during this Battle Phase. ● You take no battle damage during this Battle Phase.
--攻撃の無敵化 --Impenetrable Attack local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return true end local opt=0 if Duel.IsExistingTarget(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) then opt=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,1)) else opt=Duel.SelectOption(tp,aux.Stringid(id,1))+1 end e:SetLabel(opt) if opt==0 then e:SetProperty(EFFECT_FLAG_CARD_TARGET) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) else e:SetProperty(0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e2) end else local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_BATTLE) Duel.RegisterEffect(e1,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you have only 1 original Type of monster in your Graveyard, all monsters you control with the same Type gain 800 ATK.
--一族の結束 --Solidarity local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetLabel(0) e2:SetTarget(s.tg) e2:SetValue(800) c:RegisterEffect(e2) --adjust local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_ADJUST) e3:SetRange(LOCATION_SZONE) e3:SetOperation(s.adjustop) c:RegisterEffect(e3) e3:SetLabelObject(e2) end function s.tg(e,c) return c:IsRace(e:GetLabel()) end function s.adjustop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_GRAVE,0,nil) local te=e:GetLabelObject() if #g==0 then te:SetLabel(0) else local ct=g:GetClassCount(Card.GetOriginalRace) if ct==1 then te:SetLabel(g:GetFirst():GetOriginalRace()) else te:SetLabel(0) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 Level 4 or lower monster you control; increase its Level by its original Level until the end of this turn. If your monster(s) in the Extra Monster Zone would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only use this effect of "Cyberse Synchron" once per turn.
--サイバース・シンクロン --Cyberse Synchron --Scripted by Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Increase level local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Destruction replacement for monsters in the Extra Monster zone local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end --Check for level 4 or lower monster function s.filter(c) return c:IsFaceup() and c:IsLevelBelow(4) end --Activation legality 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_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g:GetFirst(),1,tp,g:GetFirst():GetOriginalLevel()) end --Performing the effect of increasing levels function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(tc:GetOriginalLevel()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end --Check for your monster in EMZ function s.repfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsInExtraMZone(tp) and c:IsReason(REASON_EFFECT|REASON_BATTLE) and not c:IsReason(REASON_REPLACE) end --Activation legality function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end --Substutite destruction function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Special Summon 1 "Poisonous Snake Token" (Reptile-Type/EARTH/Level 3/ATK 1200/DEF 1200). When the "Poisonous Snake Token" is destroyed as a result of battle, inflict 500 points of damage to your opponent's Life Points.
--スネークポット --Cobra Jar 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_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={86801872} function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,1200,1200,3,RACE_REPTILE,ATTRIBUTE_EARTH) then local token=Duel.CreateToken(tp,id+1) if Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetLabelObject(token) e1:SetCondition(s.damcon) e1:SetOperation(s.damop) Duel.RegisterEffect(e1,tp) end Duel.SpecialSummonComplete() end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local tok=e:GetLabelObject() if eg:IsContains(tok) then return true else if not tok:IsLocation(LOCATION_MZONE) then e:Reset() end return false end end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(1-tp,500,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned or Set. Must first be Special Summoned (from your hand) in face-up Defense Position, by banishing "Crashbug X", "Crashbug Y", and "Crashbug Z" from your Graveyard. Switch the ATK and DEF of all face-up Attack Position monsters on the field. There can only be 1 face-up "Super Crashbug" on the field.
--スーパーバグマン --Super Crashbug local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --There can only be 1 face-up "Super Crashbug" on the field c:SetUniqueOnField(1,1,id) --Must first be Special Summoned (from your hand) in face-up Defense Position, by banishing "Crashbug X", "Crashbug Y", and "Crashbug Z" from your GY local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM) e0:SetCode(EFFECT_SPSUMMON_PROC) e0:SetRange(LOCATION_HAND) e0:SetTargetRange(POS_FACEUP_DEFENSE,0) e0:SetCondition(s.spcon) e0:SetTarget(s.sptg) e0:SetOperation(s.spop) c:RegisterEffect(e0) --Switch the ATK and DEF of all face-up Attack Position monsters on the field local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SWAP_AD) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(function(e,c) return c:IsPosition(POS_FACEUP_ATTACK) end) c:RegisterEffect(e1) end s.listed_names={87526784,23915499,50319138,id} --"Crashbug X", "Crashbug Y", "Crashbug Z" function s.spcostfilter(c) return c:IsCode(87526784,23915499,50319138) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.rescon(sg,e,tp,mg) return Duel.GetMZoneCount(tp,sg)>0 and sg:GetClassCount(Card.GetCode)==3 end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) return #rg>=3 and Duel.GetMZoneCount(tp,rg)>0 and aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Dark Blade" + "Pitch-Dark Dragon" Each time this card inflicts Battle Damage to your opponent, you can select up to 3 Monster Cards from your opponent's Graveyard and remove them from play.
--闇魔界の竜騎士 ダークソード --Dark Blade the Dragon Knight local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,11321183,47415292) --remove 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_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCondition(s.rmcon) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.filter(c) return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Mimighoul" monsters you control that were not Normal or Special Summoned this turn gain ATK equal to their original DEF. Any player who controls a face-down monster cannot Normal Summon monsters, nor declare an attack with monsters that were Special Summoned this turn. During your Main Phase: You can add 1 "Mimighoul" monster from your Deck or GY to your hand. You can only use this effect of "Mimighoul Dungeon" once per turn.
--ミミグル・ダンジョン --Mimighoul Dungeon --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --"Mimighoul" monsters you control that were not Normal or Special Summoned this turn gain ATK equal to their original DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_FZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c:IsSetCard(SET_MIMIGHOUL) and not c:IsStatus(STATUS_SUMMON_TURN|STATUS_SPSUMMON_TURN) end) e1:SetValue(function(e,c) return c:GetBaseDefense() end) c:RegisterEffect(e1) --Any player who controls a face-down monster cannot Normal Summon monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_SUMMON) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(1,1) e2:SetTarget(function(e,c,sump) return Duel.IsExistingMatchingCard(Card.IsFacedown,sump,LOCATION_MZONE,0,1,nil) end) c:RegisterEffect(e2) --Any player who controls a face-down monster cannot declare an attack with monsters that were Special Summoned this turn local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_FZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(function(e,c) return c:IsStatus(STATUS_SPSUMMON_TURN) and Duel.IsExistingMatchingCard(Card.IsFacedown,c:GetControler(),LOCATION_MZONE,0,1,nil) end) c:RegisterEffect(e3) --Add 1 "Mimighoul" monster from your Deck or GY to your hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_FZONE) e4:SetCountLimit(1,id) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end s.listed_series={SET_MIMIGHOUL} function s.thfilter(c) return c:IsSetCard(SET_MIMIGHOUL) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only while you control a face-up "Power Tool Dragon". Select up to 3 Equip Cards on your side of the field and/or in your Graveyard and return them to the Deck, and inflict 500 damage to your opponent for each card returned.
--パワー・ブレイク --Power Break local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) 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={2403771} function s.cfilter(c) return c:IsFaceup() and c:IsCode(2403771) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c) return c:IsType(TYPE_EQUIP) and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_SZONE|LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_SZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_SZONE|LOCATION_GRAVE,0,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*500) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) local g=Duel.GetOperatedGroup() local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA) if ct>0 then Duel.Damage(1-tp,ct*500,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent to the GY as Link Material for the Link Summon of a "Trickstar" monster: You can Special Summon this card, but banish it when it leaves the field. You can only use this effect of "Trickstar Nightshade" once per turn.
--トリックスター・ヒヨス --Trickstar Nightshade local s,id=GetID() function s.initial_effect(c) --Special summon itself from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_TRICKSTAR} function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and r==REASON_LINK and c:GetReasonCard():IsSetCard(SET_TRICKSTAR) 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) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The activation of LIGHT monsters' effects cannot be negated.
--神星なる領域 --Constellar Belt local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --inactivatable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_INACTIVATE) e2:SetRange(LOCATION_SZONE) e2:SetValue(s.efilter) c:RegisterEffect(e2) end function s.efilter(e,ct) local te=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT) local tc=te:GetHandler() return te:IsMonsterEffect() and tc:IsAttribute(ATTRIBUTE_LIGHT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Aesir" or "Nordic" monster you control; its ATK/DEF become double its original ATK/DEF, until the end of this turn, but it cannot attack your opponent directly this turn.
--極星宝メギンギョルズ --Nordic Relic Megingjord local s,id=GetID() function s.initial_effect(c) --Targeted "Aesir" or "Nordic" monster has its ATK/DEF doubled, but cannot attack directly 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_NORDIC,SET_AESIR} function s.filter(c) return c:IsFaceup() and c:IsSetCard({SET_NORDIC,SET_AESIR}) 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 local exc=nil if Duel.IsPhase(PHASE_DAMAGE) and Duel.GetAttackTarget()==nil then exc=Duel.GetAttacker() end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,exc) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,exc) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --ATK/DEF becomes doubled of original ATK/DEF 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:GetBaseAttack()*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:GetBaseDefense()*2) tc:RegisterEffect(e2) --Cannot attack directly this turn local e3=Effect.CreateEffect(e:GetHandler()) e3:SetDescription(3207) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a "Fabled" monster(s) is sent from the hand to your GY (except during the Damage Step): You can Tribute this card, then target 1 of those monsters; Special Summon it.
--魔轟神ディフ --Fabled Dyf 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_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_FABLED} function s.filter(c,e,tp) return c:IsSetCard(SET_FABLED) and c:IsMonster() and c:IsPreviousLocation(LOCATION_HAND) and c:IsControler(tp) and c:IsCanBeEffectTarget(e) 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 eg:IsContains(chkc) and s.filter(chkc,e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and eg:IsExists(s.filter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=eg:FilterSelect(tp,s.filter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.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:
2 Level 4 Winged Beast-Type monsters Once per turn: You can detach 1 Xyz Material from this card; negate the effects of as many face-up cards your opponent currently controls as possible, and if you do, this card gains 300 ATK for each face-up card currently on the field, except this card. These changes last until your next Standby Phase.
--零鳥獣シルフィーネ --Ice Beast Zerofyne local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WINGEDBEAST),4,2) c:EnableReviveLimit() --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,nil) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsNegatable,tp,0,LOCATION_ONFIELD,nil) local tc=g:GetFirst() if not tc then return end local c=e:GetHandler() for tc in aux.Next(g) do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,2) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,2) tc:RegisterEffect(e2) if tc:IsType(TYPE_TRAPMONSTER) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,2) tc:RegisterEffect(e3) end end if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local atk=Duel.GetMatchingGroupCount(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c)*300 if atk>0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_STANDBY,2) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate 1 of these effects. ● Discard 1 card; add 2 "Machina" monsters with different names from each other from your Deck to your hand. ● Discard 1 "Machina" card; add 2 "Machina" cards with different names from each other from your Deck to your hand, except "Machina Redeployment". You can only activate 1 "Machina Redeployment" per turn.
--機甲部隊の再編制 --Machina Redeployment --Scripted by Eerie code local s,id=GetID() function s.initial_effect(c) --activate (option 1) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost(s.cfilter1)) e1:SetTarget(s.target(s.filter1)) e1:SetOperation(s.activate(s.filter1)) c:RegisterEffect(e1) --activate (option 2) local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCost(s.cost(s.cfilter2)) e2:SetTarget(s.target(s.filter2)) e2:SetOperation(s.activate(s.filter2)) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_MACHINA} function s.cfilter1(c) return c:IsDiscardable() end function s.cfilter2(c) return s.cfilter1(c) and c:IsSetCard(SET_MACHINA) end function s.filter1(c) return c:IsSetCard(SET_MACHINA) and c:IsMonster() and c:IsAbleToHand() end function s.filter2(c) return c:IsSetCard(SET_MACHINA) and not c:IsCode(id) and c:IsAbleToHand() end function s.cost(cfil) return function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(cfil,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,cfil,1,1,REASON_COST|REASON_DISCARD) end end function s.target(fil) return function(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(fil,tp,LOCATION_DECK,0,nil) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,2,0,0) end end function s.activate(fil) return function(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(fil,tp,LOCATION_DECK,0,nil) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_ATOHAND) if #sg==2 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:
During your Main Phase 1: You can send this card from your hand to the Graveyard, then target 1 "Bujin" monster you control; it can make a second attack during each Battle Phase this turn. Other monsters cannot attack during the turn you activate this effect.
--武神器-ヤツカ --Bujingi Swallow local s,id=GetID() function s.initial_effect(c) --Targeted "Bujin" monster can make a second attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_BUJIN} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_BUJIN) and not c:IsHasEffect(EFFECT_EXTRA_ATTACK) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.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) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_OATH) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.ftarget) e1:SetLabel(g:GetFirst():GetFieldID()) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.ftarget(e,c) return e:GetLabel()~=c:GetFieldID() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Can make a second attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3201) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Normal or Flip Summons a monster that has a Level: Target that face-up monster; Special Summon 1 "Clone Token", with the same original Type, Attribute, Level, ATK, and DEF as that target. When that target is destroyed and sent to the GY, destroy this Token.
--クローン複製 --Cloning local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_names={86871615} 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) local ec=eg:GetFirst() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and ec:GetOriginalLevel()>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,ec:GetBaseAttack(),ec:GetBaseDefense(), ec:GetOriginalLevel(),ec:GetOriginalRace(),ec:GetOriginalAttribute()) end ec:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() if not ec:IsRelateToEffect(e) or ec:IsFacedown() then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,ec:GetBaseAttack(),ec:GetBaseDefense(), ec:GetOriginalLevel(),ec:GetOriginalRace(),ec:GetOriginalAttribute()) then return end ec:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_EXC_GRAVE,0,0) local token=Duel.CreateToken(tp,id+1) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(ec:GetBaseAttack()) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) token:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(ec:GetBaseDefense()) token:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_CHANGE_LEVEL) e3:SetValue(ec:GetOriginalLevel()) token:RegisterEffect(e3) local e4=e1:Clone() e4:SetCode(EFFECT_CHANGE_RACE) e4:SetValue(ec:GetOriginalRace()) token:RegisterEffect(e4) local e5=e1:Clone() e5:SetCode(EFFECT_CHANGE_ATTRIBUTE) e5:SetValue(ec:GetOriginalAttribute()) token:RegisterEffect(e5) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) local de=Effect.CreateEffect(e:GetHandler()) de:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) de:SetRange(LOCATION_MZONE) de:SetCode(EVENT_TO_GRAVE) de:SetCondition(s.descon) de:SetOperation(s.desop) de:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) token:RegisterEffect(de) end function s.dfilter(c) return c:IsReason(REASON_DESTROY) and c:GetFlagEffect(id)~=0 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.dfilter,1,nil) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card as an Effect Monster (Spellcaster/LIGHT/Level 4/ATK 1400/DEF 1800). (This card is also still a Trap.) If Summoned this way, while it is in the Monster Zone, other "Altergeist" Traps you control cannot be destroyed by card effects, also neither player can target them with card effects.
--オルターガイスト・エミュレルフ --Altergeist Emulatelf local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_ALTERGEIST} 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.IsPlayerCanSpecialSummonMonster(tp,id,SET_ALTERGEIST,TYPE_MONSTER|TYPE_EFFECT,1400,1800,4,RACE_SPELLCASTER,ATTRIBUTE_LIGHT) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,SET_ALTERGEIST,TYPE_MONSTER|TYPE_EFFECT,1400,1800,4,RACE_SPELLCASTER,ATTRIBUTE_LIGHT) then return end c:AddMonsterAttribute(TYPE_TRAP+TYPE_EFFECT) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() --untargetable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetTargetRange(LOCATION_ONFIELD,0) e1:SetTarget(s.etarget) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) 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.etarget) e2:SetValue(1) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2,true) Duel.SpecialSummonComplete() end function s.etarget(e,c) return c:IsSetCard(SET_ALTERGEIST) and c:IsTrap() and c~=e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase 2, if this card was Normal Summoned this turn: You can send 1 Spell Card from your hand to the Graveyard; Set 1 Continuous Spell Card directly from your Deck. You can only use this effect of "Watch Dog" once per turn. You cannot Special Summon during the turn you activate this effect.
--番犬-ウォッチドッグ --Watch Dog local s,id=GetID() function s.initial_effect(c) --sset local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetOperation(s.regop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.condition) e2:SetCost(s.cost) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 and Duel.IsPhase(PHASE_MAIN2) end function s.cfilter(c) return c:IsSpell() and c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e2:SetDescription(aux.Stringid(id,1)) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetTargetRange(1,0) Duel.RegisterEffect(e2,tp) end function s.filter(c) return c:IsContinuousSpell() and c:IsSSetable() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SSet(tp,g:GetFirst()) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 face-up monster your opponent controls; halve that target's ATK until the End Phase.
--アーマード・ビー --Armored Bee local s,id=GetID() function s.initial_effect(c) --atk down local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) 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 function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsFaceup() and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then 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) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Zombie monsters Synchro Monsters you control cannot be destroyed by card effects. FIRE monsters you control cannot be destroyed by battle. During your opponent's turn (Quick Effect): You can target 1 of your banished Zombie Synchro Monsters; Special Summon it to your zone this card points to. You can only use this effect of "Shiranui Skillsaga Supremacy" once per turn.
--麗神-不知火 --Shiranui Skillsaga Supremacy --scripted by Naim local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_ZOMBIE),2) --indes by effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_SYNCHRO)) e1:SetValue(1) c:RegisterEffect(e1) --indes by battle local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_FIRE)) e2:SetValue(1) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetHintTiming(0,TIMING_END_PHASE) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.filter(c,e,tp,zone) return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp)&ZONES_MMZ if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc,e,tp,zone) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil,e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local zone=c:GetLinkedZone(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 this card is Normal Summoned: You can add 1 Spellcaster monster with 1850 ATK from your Deck to your hand. Once per turn (Quick Effect): You can target 1 face-up monster your opponent controls; your opponent can send 1 card with that monster's name from their Deck or Extra Deck to the GY to negate this effect, otherwise return both this card and that monster to the hand.
--妖精伝姫-カグヤ --Fairy Tail - Luna local s,id=GetID() function s.initial_effect(c) --Add to hand 1 Spellcaster with 1850 ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Return monsters to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.filter(c) return c:GetAttack()==1850 and c:IsRace(RACE_SPELLCASTER) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.thfilter(c) return c:IsFaceup() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_MZONE,1,1,nil) g:AddCard(e:GetHandler()) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,g,2,0,LOCATION_MZONE) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_DECK|LOCATION_EXTRA) end function s.cfilter(c,code) return c:IsCode(code) and c:IsAbleToGraveAsCost() end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if Duel.IsChainDisablable(0) then local g=Duel.GetMatchingGroup(s.cfilter,tp,0,LOCATION_DECK|LOCATION_EXTRA,nil,tc:GetCode()) if #g>0 and Duel.SelectYesNo(1-tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=g:Select(1-tp,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT) Duel.NegateEffect(0) return end end if tc:IsRelateToEffect(e) then local rg=Group.FromCards(c,tc) Duel.SendtoHand(rg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Flip monsters During your Main Phase: You can Fusion Summon 1 "Shaddoll" Fusion Monster from your Extra Deck, using monsters from your hand or field as Fusion Material. If this card is in your GY: You can send 1 "Shaddoll" card from your hand or face-up field to the GY, and if you do, Special Summon this card. You can only use each effect of "Shaddoll Construct" once per turn.
--シャドール・ネフィリム --Shaddoll Construct local s,id=GetID() function s.initial_effect(c) --Link Summon procedure c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_FLIP),2,2) --Fusion summon local params = {aux.FilterBoolFunction(Card.IsSetCard,SET_SHADDOLL)} 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:SetTarget(Fusion.SummonEffTG(table.unpack(params))) e1:SetOperation(Fusion.SummonEffOP(table.unpack(params))) c:RegisterEffect(e1) --Special summon itself from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SHADDOLL} function s.cfilter(c) return (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsSetCard(SET_SHADDOLL) and c:IsAbleToGraveAsCost() end function s.mzfilter(c) return c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local sg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,nil) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and #sg>=1 and (ft>0 or sg:IsExists(s.mzfilter,1,nil)) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local sg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,nil) local g=nil if ft<=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) g=sg:FilterSelect(tp,s.mzfilter,1,1,nil) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) g=sg:Select(tp,1,1,nil) end if Duel.SendtoGrave(g,REASON_EFFECT)~=0 and g:GetFirst():IsLocation(LOCATION_GRAVE) 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:
1 Tuner + 1 or more non-Tuner monsters At the start of the Damage Step, if this card battles a Special Summoned monster: You can make this card's ATK become double its current ATK until the end of the Damage Step. Once per turn, during the End Phase, if this card is in the Graveyard because this Synchro Summoned card was sent there from the field this turn: You can target 1 "Speedroid" monster in your Graveyard, except "Hi-Speedroid Puzzle"; add it to your hand.
--HSR快刀乱破ズール --Hi-Speedroid Puzzle local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --Double ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_START) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --to grave local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.regcon) e2:SetOperation(s.regop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1) e3:SetRange(LOCATION_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_SPEEDROID} s.listed_names={id} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and (bc:GetSummonType()&SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(c:GetAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) c:RegisterEffect(e1) end end function s.regcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:GetSummonType()==SUMMON_TYPE_SYNCHRO end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.thfilter(c) return c:IsSetCard(SET_SPEEDROID) and not c:IsCode(id) 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.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is Level 4 while in face-up Defense Position.
--シャインナイト --Shine Knight local s,id=GetID() function s.initial_effect(c) --lvchange 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) c:RegisterEffect(e1) end function s.lvcon(e) return e:GetHandler():IsDefensePos() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you have 3 or more "Salamangreat" monsters in your GY: You can send this card from your hand to the GY, then target 1 "Salamangreat" Link Monster in your GY and 1 card in your opponent's Spell & Trap Zone; return that targeted monster from your GY to the Extra Deck, and if you do, destroy the targeted card on the field. If a card(s) in your opponent's Spell & Trap Zone is destroyed and sent to the GY, while this card is in your GY (except during the Damage Step): You can Special Summon this card in Defense Position. You can only use 1 "Salamangreat Foxer" effect per turn, and only once that turn.
--転生炎獣フォクサー --Salamangreat Foxer --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TODECK) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.condition) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.spcon) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SALAMANGREAT} function s.cfilter(c) return c:IsMonster() and c:IsSetCard(SET_SALAMANGREAT) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,3,nil) end function s.filter(c) return c:GetSequence()<5 end function s.tdfilter(c) return c:IsMonster() and c:IsSetCard(SET_SALAMANGREAT) and c:IsLinkMonster() and c:IsAbleToExtra() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_SZONE,1,nil) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local lg=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_SZONE,1,1,nil) e:SetLabelObject(g:GetFirst()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,1-tp,LOCATION_SZONE) Duel.SetOperationInfo(0,CATEGORY_TODECK,lg,1,tp,LOCATION_GRAVE) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local sc=e:GetLabelObject() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local lc=g:GetFirst() if lc==sc then lc=g:GetNext() end if lc and lc:IsRelateToEffect(e) and Duel.SendtoDeck(lc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and sc and sc:IsRelateToEffect(e) then Duel.Destroy(sc,REASON_EFFECT) end end function s.spfilter(c,tp) return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_SZONE) and not c:IsPreviousControler(tp) and c:GetPreviousSequence()<5 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,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can send 1 "Speedroid" card from your Deck to the GY. During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY, then target 1 "Speedroid" monster in your GY; shuffle it into the Deck, and if you do, Special Summon 1 "Speedroid" Synchro Monster from your Extra Deck with the same Level but a different name, but negate its effects. You can only use this effect of "Speedroid Ultra Hound" once per turn.
--SRマジックハウンド --Speedroid Ultra Hound --scripted by Hatter local s,id=GetID() function s.initial_effect(c) --send to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --send to deck and special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SPEEDROID} function s.tgfilter(c) return c:IsSetCard(SET_SPEEDROID) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.exfilter(c,lv,code,e,tp) return c:IsSetCard(SET_SPEEDROID) and c:IsType(TYPE_SYNCHRO) and c:IsLevel(lv) and not c:IsCode(code) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.filter(c,e,tp) return c:HasLevel() and c:IsSetCard(SET_SPEEDROID) and c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.exfilter,tp,LOCATION_EXTRA,0,1,nil,c:GetLevel(),c:GetCode(),e,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler(),e,tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not tc or not tc:IsRelateToEffect(e) then return end if Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.exfilter,tp,LOCATION_EXTRA,0,1,1,nil,tc:GetLevel(),tc:GetCode(),e,tp) local sc=sg:GetFirst() if sc and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)>0 then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If there are 3 face-up "3-Hump Lacooda" cards on your side of the field, Tribute 2 of them to draw 3 cards.
--みつこぶラクーダ --3-Hump Lacooda local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and c:IsCode(id) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,3,nil) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,2,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,2,2,false,nil,nil) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,3) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(3) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,3) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) is Special Summoned to your opponent's field (except during the Damage Step): You can Special Summon this card from your hand. During the End Phase: You can banish this card you control; take control of 1 monster your opponent controls with the lowest ATK (your choice, if tied), but while it is face-up on your field, it cannot activate its effects also you cannot Special Summon monsters from the Extra Deck, except Link Monsters. You can only use each effect of "Mad Hacker" once per turn.
--マッド・ハッカー --Mad Hacker --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Take control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_CONTROL) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.ctcost) e2:SetTarget(s.cttg) e2:SetOperation(s.ctop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsControler,1,nil,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) 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.ctcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() end Duel.Remove(c,POS_FACEUP,REASON_COST) end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil):GetMinGroup(Card.GetAttack) if chk==0 then return g and g:IsExists(Card.IsAbleToChangeControler,1,nil) end Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_CONTROL)<1 then return end local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil):GetMinGroup(Card.GetAttack) if not g or #g==0 then return end if #g:Match(Card.IsAbleToChangeControler,nil)<1 then return end if #g>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) g=g:Select(tp,1,1,nil) end if #g==0 then return end Duel.HintSelection(g,true) if Duel.GetControl(g,tp) then local c=e:GetHandler() local tc=g:GetFirst() --Cannot activate its effects local e1=Effect.CreateEffect(c) e1:SetDescription(3302) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL) tc:RegisterEffect(e1,true) --Cannot Special Summon non-Link monsters from Extra Deck local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetRange(LOCATION_MZONE) e2:SetAbsoluteRange(tp,1,0) e2:SetTarget(function(_,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_LINK) end) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL) tc:RegisterEffect(e2,true) --Lizard check local e3=aux.createContinuousLizardCheck(c,LOCATION_MZONE,function(_,c) return c:IsOriginalType(TYPE_LINK) end) e3:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CONTROL) tc:RegisterEffect(e3,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Special Summon 1 "Meklord Army" monster from your hand.
--機動要塞フォルテシモ --Fortissimo the Mobile Fortress local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_FZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_MEKLORD_ARMY} function s.filter(c,e,sp) return c:IsSetCard(SET_MEKLORD_ARMY) and c:IsCanBeSpecialSummoned(e,0,sp,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_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end 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:
During your Main Phase: You can change as many monsters your opponent controls as possible to face-down Defense Position, then you can send all face-up cards your opponent controls to the GY. If this card in its owner's possession is destroyed by an opponent's card: You can change as many monsters your opponent controls as possible to face-down Defense Position, then you can send all face-up cards your opponent controls to the GY. You can only use each effect of "Crystal God Tistina" once per turn.
--結晶神ティスティナ --Crystal God Tistina --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Flip opponent's monsters face-down local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --Flip opponent's monsters face-down when destroyed local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_POSITION+CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,0,1-tp,LOCATION_ONFIELD) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,nil) if #g==0 or Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE)==0 then return end local gg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_ONFIELD,nil) if #gg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.SendtoGrave(gg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you Ritual Summon exactly 1 "Nekroz" Ritual Monster with a card effect that requires use of monsters, this card you control can be used as the entire Tribute. You can only use each of the following effects of "Emilia, Dance Priestess of the Nekroz" once per turn. If you have a Warrior "Nekroz" monster in your field or GY: You can Special Summon this card from your hand. If this card is Normal or Special Summoned: You can add 1 "Nekroz" Ritual Monster or 1 "Nekroz" Spell from your Deck to your hand.
--影霊依の舞巫女 エミリア --Emilia, Dance Priestess of the Nekroz --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --If you Ritual Summon exactly 1 "Nekroz" Ritual Monster with a card effect that requires use of monsters, this card you control can be used as the entire Tribute local e1=Ritual.AddWholeLevelTribute(c,aux.FilterBoolFunction(Card.IsSetCard,SET_NEKROZ)) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) --Special Summon this card from your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Add 1 "Nekroz" Ritual Monster or 1 "Nekroz" Spell from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) end s.listed_series={SET_NEKROZ} function s.spconfilter(c) return c:IsRace(RACE_WARRIOR) and c:IsSetCard(SET_NEKROZ) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,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,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thfilter(c) return c:IsSetCard(SET_NEKROZ) and (c:IsRitualMonster() or c:IsSpell()) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 face-up "Number C39: Utopia Ray" you control; equip this card from your hand to that target. It gains 1100 ATK. When the equipped monster destroys an opponent's monster by battle: Inflict 1000 damage to your opponent. You can only control 1 face-up "ZW - Phoenix Bow".
--ZW-不死鳥弩弓 --ZW - Phoenix Bow local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddZWEquipLimit(c,s.eqcon,function(tc,c,tp) return s.filter(tc) and tc:IsControler(tp) end,s.equipop,e1) --damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.damcon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end s.listed_names={56840427} function s.eqcon(e) return e:GetHandler():CheckUniqueOnField(e:GetHandlerPlayer()) end function s.filter(c) return c:IsFaceup() and c:IsCode(56840427) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not tc:IsRelateToEffect(e) or tc:IsFacedown() or tc:GetControler()~=tp or not c:CheckUniqueOnField(tp) then Duel.SendtoGrave(c,REASON_EFFECT) return end s.equipop(c,e,tp,tc) end function s.equipop(c,e,tp,tc) if not aux.EquipAndLimitRegister(c,e,tp,tc) then return end --atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1100) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetEquipTarget() return ec and eg:IsContains(ec) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card attacks a face-down Defense Position monster and destroys it and sends it to the Graveyard as a result of battle, your opponent returns 1 random card from their hand to their Deck. Their Deck is then shuffled.
--レガシーハンター --Legacy Hunter local s,id=GetID() function s.initial_effect(c) --todeck 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_BATTLE_DESTROYING) 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() local bc=c:GetBattleTarget() return bc:GetBattlePosition()==POS_FACEDOWN_DEFENSE and c:IsRelateToBattle() and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0,nil) if #g==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Dragon Normal Monster in your GY; Special Summon that target. You can only activate 1 "Silver's Cry" per turn.
--銀龍の轟咆 --Silver's Cry local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.spfilter(c,e,tp) return c:IsRace(RACE_DRAGON) and c:IsType(TYPE_NORMAL) 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.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsRace(RACE_DRAGON) 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 activation, treat this card as an Equip Card, and equip it to a monster you control. Once per turn, during the equipped monster's attack, you can send 1 monster with 1000 or less ATK from your hand to the Graveyard during the Damage Step to have the equipped monster gain the ATK of the sent monster, until the End Phase.
--アサルト・スピリッツ --Assault Spirits 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,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:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(s.atkcon) e1:SetCost(s.atkcost) e1:SetOperation(s.atkop) 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(s.eqlimit) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetLabelObject(tc) c:RegisterEffect(e2) else c:CancelToGrave(false) end end function s.eqlimit(e,c) return c:GetControler()==e:GetOwnerPlayer() and c==e:GetLabelObject() end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local ph=Duel.GetCurrentPhase() return a==e:GetHandler():GetEquipTarget() and ph==PHASE_DAMAGE and not Duel.IsDamageCalculated() end function s.cfilter(c) return c:IsMonster() and c:IsAttackBelow(1000) and c:IsAbleToGraveAsCost() end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) e:SetLabel(g:GetFirst():GetAttack()) Duel.SendtoGrave(g,REASON_COST) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local a=Duel.GetAttacker() if c:IsRelateToEffect(e) and a:IsRelateToBattle() and a:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(e:GetLabel()) a:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Plant-Type monster(s) is Special Summoned from the Graveyard to your side of the field: It gains 1000 ATK while this card is face-up on the field. Destroy this card during your 2nd End Phase after activation.
--オーバー・デッド・ライン --Overdoom Line local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.acttg) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_SZONE) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --atk local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetCondition(s.atkcon) e3:SetTarget(s.atktg) e3:SetValue(1000) c:RegisterEffect(e3) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) e3:SetLabelObject(g) end function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESETS_STANDARD_PHASE_END|RESET_SELF_TURN,2) c:RegisterEffect(e1) c:SetTurnCounter(0) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() ct=ct+1 c:SetTurnCounter(ct) if ct==2 then Duel.Destroy(c,REASON_EFFECT) end end function s.filter(c,e,tp) return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:IsControler(tp) and c:IsPreviousLocation(LOCATION_GRAVE) and (not e or c:IsRelateToEffect(e)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.filter,1,nil,nil,tp) end Duel.SetTargetCard(eg) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local atkg=e:GetLabelObject() if c:GetFlagEffect(id)==0 then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE,0,1) atkg:Clear() end local g=eg:Filter(s.filter,nil,e,tp) local tc=g:GetFirst() for tc in aux.Next(g) do tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) atkg:AddCard(tc) end end function s.atkcon(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.atktg(e,c) return e:GetLabelObject():IsContains(c) and c:GetFlagEffect(id)~=0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to an "Inzektor" monster. It gains 500 ATK. Your opponent cannot activate cards or effects in response to the activation of the equipped monster's effects.
--甲虫装機の魔弓 ゼクトアロー --Inzektor Crossbow - Zektarrow local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsSetCard,SET_INZEKTOR)) --Atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(500) c:RegisterEffect(e2) --chain limit local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_CHAINING) e4:SetCondition(s.chcon) e4:SetOperation(s.chop) c:RegisterEffect(e4) end s.listed_series={SET_INZEKTOR} function s.chcon(e,tp,eg,ep,ev,re,r,rp) return re:GetHandler()==e:GetHandler():GetEquipTarget() end function s.chop(e,tp,eg,ep,ev,re,r,rp) Duel.SetChainLimit(s.chlimit) end function s.chlimit(e,ep,tp) return ep==tp end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can add 1 Level 3, 4 or 5 Fish-Type monster from your Deck to your hand.
--マーメイド・シャーク --Mermaid Shark local s,id=GetID() function s.initial_effect(c) --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) local lv=c:GetLevel() return (lv==3 or lv==4 or lv==5) and c:IsRace(RACE_FISH) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no Effect Monsters: You can Special Summon this card from your hand. If you control a face-up non-Effect Monster: You can banish this card from your hand or GY; Special Summon 1 "Tenyi" monster from your Deck, except "Tenyi Spirit - Ashuna", also you cannot Special Summon monsters for the rest of this turn, except Wyrm monsters. You can only use each effect of "Tenyi Spirit - Ashuna" once per turn.
--天威龍-アーダラ --Tenyi Spirit - Ashuna --Scripted by AlphaKretin 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_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --spsummon deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND|LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon2) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end s.listed_series={SET_TENYI} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.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.spcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsNonEffectMonster),tp,LOCATION_MZONE,0,1,nil) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_TENYI) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e2:SetDescription(aux.Stringid(id,2)) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetTargetRange(1,0) Duel.RegisterEffect(e2,tp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsRace(RACE_WYRM) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters, including a Ritual Monster While this card is in the Extra Monster Zone, monsters your opponent controls cannot target "Nephthys" monsters in the Main Monster Zones for attacks. This card gains effects based on the number of Ritual Monsters used for its Link Summon. ● 1+: Cannot be destroyed by battle. ● 2+: Cannot be destroyed by card effects, also it gains 1200 ATK. ● 3: Neither player can target this card with card effects, also it gains another 1200 ATK.
--焔凰神-ネフティス --Nephthys, the Sacred Flame local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,nil,2,99,s.lcheck) c:EnableReviveLimit() --effect gain local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MATERIAL_CHECK) e1:SetValue(s.matcheck) c:RegisterEffect(e1) --cannot select battle target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.atcon) e2:SetValue(s.atlimit) c:RegisterEffect(e2) end s.listed_series={SET_NEPHTHYS} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_RITUAL,lc,sumtype,tp) end function s.matcheck(e,c) local ct=c:GetMaterial():FilterCount(Card.IsType,nil,TYPE_RITUAL) if ct>=1 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e1) c:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) end if ct>=2 then 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(1200) e2:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetValue(1) e3:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e3) c:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) end if ct==3 then local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetRange(LOCATION_MZONE) e4:SetValue(1200) e4:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e5:SetRange(LOCATION_MZONE) e5:SetValue(1) e5:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) c:RegisterEffect(e5) c:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) end end function s.atcon(e) return e:GetHandler():GetSequence()>4 end function s.atlimit(e,c) return c:IsFaceup() and c:IsSetCard(SET_NEPHTHYS) and c:GetSequence()<5 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned by a card effect. (Quick Effect): You can target 1 Machine monster you control; destroy both that Machine monster and all monsters your opponent controls with ATK less than or equal to it. If a face-up EARTH Machine monster(s) you control, except "Machina Citadel", is destroyed by battle or card effect while this card is in your GY: You can Special Summon this card. You can only use each effect of "Machina Citadel" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--マシンナーズ・カーネル --Machina Citadel --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:EnableUnsummonable() c:AddMustBeSpecialSummonedByCardEffect() --Destroy 1 Machine monster you control and all monsters your opponent controls with ATK less than or equal to it local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} function s.desfilter(c,tp) return c:IsRace(RACE_MACHINE) and c:IsFaceup() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttackBelow,c:GetAttack()),tp,0,LOCATION_MZONE,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.desfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local tc=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst() local dg=tc+Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsRace(RACE_MACHINE) and tc:IsFaceup() then local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g+tc,REASON_EFFECT) end end end function s.spconfilter(c,tp) return c:IsPreviousAttributeOnField(ATTRIBUTE_EARTH) and c:IsPreviousRaceOnField(RACE_MACHINE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and not c:IsPreviousCodeOnField(id) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as a "The Phantom Knights" and "Raidraptor" card.) If you Xyz Summon using a DARK Xyz Monster as material: You can target 1 card on the field; destroy it. If this face-up card in the Spell & Trap Zone is destroyed by a card effect: You can Set 1 "Rank-Up-Magic" Spell directly from your Deck or GY. You can only use each effect of "Raider's Unbreakable Mind" once per turn.
--レイダーズ・アンブレイカブル・マインド --Raider's Unbreakable Mind --Scripted by Eerie Code 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) --Destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Set 1 "Rank-Up-Magic" Spell from your Deck or GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.setcon) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_series={SET_THE_PHANTOM_KNIGHTS,SET_RAIDRAPTOR,SET_RANK_UP_MAGIC} function s.desconfilter(c,tp) return c:IsXyzSummoned() and c:IsSummonPlayer(tp) and c:GetMaterial():IsExists(s.matfilter,1,nil) end function s.matfilter(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsType(TYPE_XYZ) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.desconfilter,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,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_STZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsReason(REASON_EFFECT) end function s.setfilter(c) return c:IsSetCard(SET_RANK_UP_MAGIC) and c:IsSpell() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.setfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.SSet(tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Standby Phase: You can reveal this card in your hand, and it will remain revealed until the end of this turn; gain 500 LP.
--黄金の天道虫 --Golden Ladybug local s,id=GetID() function s.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_RECOVER) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1) e1:SetCondition(s.reccon) e1:SetCost(s.reccost) e1:SetTarget(s.rectg) e1:SetOperation(s.recop) c:RegisterEffect(e1) end function s.reccon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.reccost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsPublic() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PUBLIC) e1:SetReset(RESETS_STANDARD_PHASE_END) e:GetHandler():RegisterEffect(e1) end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you take battle damage: Target 1 monster in your Graveyard with ATK less than or equal to the amount of damage you took; Special Summon that target.
--ダメージ・ゲート --Damage Gate local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep==tp end function s.filter(c,e,tp,dam) return c:IsAttackBelow(dam) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp,ev) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp,ev) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,ev) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) 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:
Add 1 "Darklord" card from your Deck to your hand, except "Banishment of the Darklords". You can only activate 1 "Banishment of the Darklords" per turn.
--堕天使の追放 --Banishment of the Darklords 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 s.listed_series={SET_DARKLORD} s.listed_names={id} function s.filter(c) return c:IsSetCard(SET_DARKLORD) and not c:IsCode(id) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, if a Normal Monster you control would be destroyed by battle with an Effect Monster, it is not destroyed. If you control a Normal Monster: You can Special Summon this card from your hand. You can only use this effect of "Submareed Tour Ride" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--游覧艇サブマリード --Submareed Tour Ride --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Battle protection local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCountLimit(1) e2:SetTarget(s.indtg) e2:SetValue(function(_,_,r) return r&REASON_BATTLE==REASON_BATTLE end) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_NORMAL),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 function s.indtg(e,c) local bt=c:GetBattleTarget() return c:IsType(TYPE_NORMAL) and bt and bt:IsType(TYPE_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Cyber Dragon" monster + 1+ monsters in the Extra Monster Zone Cannot be used as Fusion Material. Must first be Special Summoned (from your Extra Deck) by sending the above cards from either field to the GY. The original ATK of this card becomes 1200 x the number of materials used for its Special Summon.
--キメラテック・メガフリート・ドラゴン --Chimeratech Megafleet Dragon local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixRep(c,true,true,s.matfilter,1,99,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_CYBER_DRAGON)) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit) --cannot be fusion material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) end s.listed_series={SET_CYBER_DRAGON} s.material_setcode={SET_CYBER,SET_CYBER_DRAGON} function s.matfilter(c,fc,sumtype,tp) return c:GetSequence()>4 and c:IsLocation(LOCATION_MZONE) and (c:IsControler(tp) or c:IsFaceup()) end function s.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function s.cfilter(c,tp) return c:IsAbleToGraveAsCost() and (c:IsControler(tp) or c:IsFaceup()) end function s.contactfil(tp) return Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,tp) end function s.contactop(g,tp,c) Duel.SendtoGrave(g,REASON_COST|REASON_MATERIAL) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) e1:SetValue(#g*1200) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: You can target 1 "Ritual Beast" monster in your Graveyard; Special Summon it. You can only Special Summon "Ritual Beast Tamer Lara(s)" once per turn.
--霊獣使い レラ --Ritual Beast Tamer Lara local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --spsuccess local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_RITUAL_BEAST} function s.filter(c,e,tp) return c:IsSetCard(SET_RITUAL_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no cards (Quick Effect): You can discard this card; apply these effects this turn. ● Each time your opponent Special Summons a monster(s) from any GY(s) or banishment, immediately draw 1 card. ● Once, during this End Phase, if the number of cards in your hand is more than the number of cards your opponent controls +6, you must randomly shuffle cards from your hand into the Deck so the number in your hand equals the number your opponent controls +6. You can only activate 1 other "Mulcharmy" monster effect, the turn you activate this effect.
--マルチャミー・ニャルス --Mulcharmy Meowls local s,id=GetID() function s.initial_effect(c) --Apply effects for the rest of the turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCondition(function(e,tp) return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 end) e1:SetCost(s.effcost) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) --Keep track of the activations of a "Mulcharmy" monster's effect Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,function(re) return not (re:GetHandler():IsSetCard(SET_MULCHARMY) and re:IsMonsterEffect()) end) end s.listed_series={SET_MULCHARMY} function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() and Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)<2 end Duel.SendtoGrave(c,REASON_COST|REASON_DISCARD) --You can only activate 1 other "Mulcharmy" monster effect, the turn you activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetCondition(function(e) return Duel.GetCustomActivityCount(id,e:GetHandlerPlayer(),ACTIVITY_CHAIN)>=2 end) e1:SetValue(function(e,re,tp) return re:GetHandler():IsSetCard(SET_MULCHARMY) and re:IsMonsterEffect() end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Draw 1 card each time your opponent Special Summons a monster(s) from the GY and/or banishment local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.drcon) e1:SetOperation(s.drop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Shuffle random cards from your hand to the Deck during the End Phase local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetOperation(s.tdop) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.drconfilter(c,tp) return c:IsSummonPlayer(1-tp) and c:IsSummonLocation(LOCATION_GRAVE|LOCATION_REMOVED) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.drconfilter,1,nil,tp) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsChainSolving() then Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,1,REASON_EFFECT) else local eff=e:GetLabelObject() if eff and not eff:IsDeleted() then eff:SetLabel(eff:GetLabel()+1) else local c=e:GetHandler() --Draw cards when the current Chain Link finishes resolving local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetOperation(s.chainsolvedop) e1:SetLabel(1) e1:SetLabelObject(e) e1:SetReset(RESET_CHAIN) Duel.RegisterEffect(e1,tp) e:SetLabelObject(e1) --Reset "e1" and the label object of "e" at the end of the Chain Link local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetOperation(function() e:SetLabelObject(nil) e1:Reset() end) e2:SetReset(RESET_CHAIN) Duel.RegisterEffect(e2,tp) end end end function s.chainsolvedop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,e:GetLabel(),REASON_EFFECT) e:Reset() e:GetLabelObject():SetLabelObject(nil) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local dif=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)-(Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)+6) if dif>0 then local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0):Match(Card.IsAbleToDeck,nil):RandomSelect(tp,dif) if #g==0 then return end Duel.Hint(HINT_CARD,1-tp,id) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you draw a Fairy monster(s) (except during the Damage Step): You can reveal 1 of those monsters; draw 1 card. This card must be face-up on the field to activate and to resolve this effect.
--光神テテュス --Tethys, Goddess of Light local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DRAW) e1:SetCost(s.drcost) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) end function s.filter(c) return c:IsRace(RACE_FAIRY) and not c:IsPublic() end function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return ep==tp and eg:IsExists(s.filter,1,nil) end local g=eg:Filter(s.filter,nil) if #g==1 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sg=g:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) end end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsFacedown() or 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:
When your opponent Normal or Special Summons a monster(s) (except during the Damage Step): You can Special Summon this card from your hand to the opponent's field in Defense Position. This card's controller cannot Fusion, Synchro, Xyz, or Link Summon unless they use this card as material.
--Contacting "C" --Contact "C" 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_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) -- local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_MUST_BE_MATERIAL) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetValue(REASON_FUSION+REASON_SYNCHRO+REASON_XYZ+REASON_LINK) c:RegisterEffect(e3) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,1-tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 then Duel.SpecialSummon(c,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Ancient Gear" monsters Unaffected by other cards' effects. During your Main Phase: You can inflict 1000 damage to your opponent. You can only use this effect of "Ancient Gear Howitzer" once per turn. If this card is destroyed by battle and sent to the Graveyard: You can Special Summon 1 "Ancient Gear" monster from your Deck, ignoring its Summoning conditions.
--古代の機械魔神 --Ancient Gear Howitzer local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_ANCIENT_GEAR),2) --immune local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.econ) e1:SetValue(s.efilter) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYED) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_ANCIENT_GEAR} s.material_setcode=SET_ANCIENT_GEAR function s.econ(e) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) end function s.efilter(e,te) return te:GetOwner()~=e:GetOwner() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function s.filter(c,e,tp) return c:IsSetCard(SET_ANCIENT_GEAR) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Gains 500 ATK/DEF for each card in your hand. You can only use each of the following effects of "Ravenous Crocodragon Archethys" once per turn. ● If this card is Synchro Summoned: You can draw cards equal to the number of non-Tuners used for its Synchro Summon. ● (Quick Effect): You can discard 2 cards, then target 1 card on the field; destroy it.
--飢鰐竜アーケティス --Ravenous Crocodragon Archethys --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Draw when Synchro Summoned local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e1:SetCountLimit(1,id) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --ATK/DEF increase local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.adval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --Destroy 1 card on the field local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetHintTiming(TIMING_ATTACK,TIMINGS_CHECK_MONSTER_E|TIMING_ATTACK) e4:SetCountLimit(1,{id,1}) e4:SetCost(s.descost) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=(e:GetHandler():GetMaterialCount())-1 if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ct) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.adval(e,c) return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_HAND,0)*500 end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,2,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,2,2,REASON_COST|REASON_DISCARD) 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(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.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 send this card from your hand or field to the GY; send 1 Level 3 or lower Beast, Beast-Warrior, or Winged Beast monster from your Deck to the GY. You can banish any number of Beast, Beast-Warrior, and/or Winged Beast monsters in your GY; Special Summon 1 Beast, Beast-Warrior, or Winged Beast Link Monster from your Extra Deck, with Link Rating equal to the number banished, also you can only use Beast, Beast-Warrior, and Winged Beast monsters as Link Material for the rest of this turn. You can only use each effect of "Tri-Brigade Fraktall" once per turn.
--鉄獣戦線 フラクトール --Tri-Brigade Fraktall --Scripted by the Razgriz local s,id=GetID() function s.initial_effect(c) --Send 1 monster from Deck to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Special Summon a Link monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_TRI_BRIGADE} function s.tgfilter(c) return c:IsMonster() and c:IsLevelBelow(3) and c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.rmfilter(c) return c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true,false) end function s.spfilter(c,e,tp,ct,g) return c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsType(TYPE_LINK) and c:IsLink(ct) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and Duel.GetLocationCountFromEx(tp,tp,g,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local nums={} for i=1,#g do if Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,i,g) then table.insert(nums,i) end end if chk==0 then return #nums>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK) local ct=Duel.AnnounceNumber(tp,table.unpack(nums)) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rg=g:Select(tp,ct,ct,nil) Duel.Remove(rg,POS_FACEUP,REASON_COST) e:SetLabel(ct) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end --existence of card to summon checked in cost Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) --register material limitation local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetTarget(s.matlimit) e1:SetTargetRange(LOCATION_ALL,LOCATION_ALL) e1:SetValue(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --client hint aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) --special Summon local ct=e:GetLabel() if not ct then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,ct) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.matlimit(e,c) return not c:IsRace(RACES_BEAST_BWARRIOR_WINGB) end function s.sumlimit(e,c) if not c then return false end return c:IsControler(e:GetHandlerPlayer()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 face-up "Dark Magician"; Special Summon 1 "Dark Magician Knight" from your hand, Deck or Graveyard.
--騎士の称号 --Knight's Title local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_DARK_MAGICIAN,50725996} function s.costfilter(c,ft,tp) return c:IsFaceup() and c:IsCode(CARD_DARK_MAGICIAN) and (ft>0 or (c:GetSequence()<5 and c:IsControler(tp))) and (c:IsFaceup() or c:IsControler(tp)) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,ft,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,ft,tp) Duel.Release(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCode(50725996) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.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 tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP)>0 then tc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Beetrooper Token" (Insect/EARTH/Level 3/ATK 1000/DEF 1000), then if you control an Insect monster with 3000 or more ATK, you can destroy 1 other Spell/Trap on the field. You can only activate 1 "Beetrooper Descent" per turn.
--騎甲虫隊降下作戦 --Beetrooper Descent --Scripted by Zefile 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_TOKEN+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={64213018} --Beetrooper Token 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.IsPlayerCanSpecialSummonMonster(tp,64213018,SET_BEETROOPER,TYPES_TOKEN,1000,1000,3,RACE_INSECT,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.cfilter(c) return c:IsFaceup() and c:IsRace(RACE_INSECT) and c:IsAttackAbove(3000) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if not Duel.IsPlayerCanSpecialSummonMonster(tp,64213018,SET_BEETROOPER,TYPES_TOKEN,1000,1000,3,RACE_INSECT,ATTRIBUTE_EARTH) then return end local token=Duel.CreateToken(tp,64213018) if Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP)==0 then return end local dg=Duel.GetMatchingGroup(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) if #dg>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=dg:Select(tp,1,1,nil) if #sg==0 then return end Duel.BreakEffect() Duel.HintSelection(sg,true) Duel.Destroy(sg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: You can target 1 "Fluffal" or "Edge Imp" monster in your Graveyard; add it to your hand. If this card is sent to the Graveyard as a Fusion Material for a Fusion Summon of a "Frightfur" Fusion Monster: You can target up to 2 of your banished monsters; return them to the Graveyard. You can only use each effect of "Fluffal Octopus" once per turn.
--ファーニマル・オクト --Fluffal Octopus local s,id=GetID() function s.initial_effect(c) --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --tograve local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_BE_MATERIAL) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.tgcon) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) end s.listed_series={SET_FLUFFAL,SET_EDGE_IMP,SET_FRIGHTFUR} function s.thfilter(c) return c:IsSetCard({SET_FLUFFAL,SET_EDGE_IMP}) and c:IsMonster() and c:IsAbleToHand() 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.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.operation(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.tgcon(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.tgfilter(c) return c:IsFaceup() and c:IsMonster() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.tgfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_REMOVED,0,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=tg:Filter(Card.IsRelateToEffect,nil,e) if #sg>0 then Duel.SendtoGrave(sg,REASON_EFFECT|REASON_RETURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 other "Heraldic Beast" monster; Special Summon this card from your hand. Once per turn: You can discard 1 "Heraldic Beast" monster; this card gains 800 ATK until the end of this turn.
--紋章獣アンフィスバエナ --Heraldic Beast Amphisbaena 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:SetRange(LOCATION_HAND) e1:SetCost(s.cost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.cost) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_HERALDIC_BEAST} function s.cfilter(c) return c:IsSetCard(SET_HERALDIC_BEAST) and c:IsDiscardable() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST|REASON_DISCARD,e:GetHandler()) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) e1:SetValue(800) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, you can select 1 Level 3 or lower monster on your opponent's side of the field and equip it to this card. (Only 1 card at a time can be equipped due to this effect.) If this card would be destroyed by battle, the equipped monster is destroyed instead. During your Standby Phase, by sending this card to the Graveyard while it's equipped due to its effect, Special Summon 1 "Allure Queen LV5" from your hand or Deck.
--魅惑の女王 LV3 --Allure Queen LV3 local s,id=GetID() function s.initial_effect(c) --Equip 1 Level 3 or lower monster your opponent controls to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e1:SetCondition(s.eqconignition) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,s.eqconignition,s.eqval,s.equipop,e1) --Quick Effect version for when the effect of "Golden Allure Queen" is applied local e2=e1:Clone() e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(TIMING_STANDBY_PHASE,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(s.eqconquick) c:RegisterEffect(e2) aux.AddEREquipLimit(c,s.eqconquick,s.eqval,s.equipop,e2) --Special Summon 1 "Allure Queen LV5" from your hand or Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and e:GetHandler():GetEquipGroup():IsExists(Card.HasFlagEffect,1,nil,id) end) e3:SetCost(Cost.SelfToGrave) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) e3:SetLabelObject(e1) c:RegisterEffect(e3) end s.listed_names={23756165} --"Allure Queen LV5" s.LVnum=3 s.LVset=SET_ALLURE_QUEEN function s.eqconignition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not c:GetEquipGroup():IsExists(Card.HasFlagEffect,1,nil,id) and not (c:IsOriginalSetCard(SET_ALLURE_QUEEN) and Duel.IsPlayerAffectedByEffect(tp,EFFECT_GOLDEN_ALLURE_QUEEN)) end function s.eqconquick(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not c:GetEquipGroup():IsExists(Card.HasFlagEffect,1,nil,id) and c:IsOriginalSetCard(SET_ALLURE_QUEEN) and Duel.IsPlayerAffectedByEffect(tp,EFFECT_GOLDEN_ALLURE_QUEEN) end function s.eqfilter(c) return c:IsLevelBelow(3) and c:IsFaceup() and c:IsAbleToChangeControler() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.eqfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.eqfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then Duel.SendtoGrave(c,REASON_RULE,PLAYER_NONE,PLAYER_NONE) else s.equipop(c,e,tp,tc) end end function s.equipop(c,e,tp,tc) if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end --If this card would be destroyed by battle, the equipped monster is destroyed instead local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_DESTROY_SUBSTITUTE) e1:SetValue(function(e,re,r,rp) return r&REASON_BATTLE>0 end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end function s.eqval(ec,c,tp) return ec:IsControler(1-tp) and ec:IsLevelBelow(3) end function s.spfilter(c,e,tp) return c:IsCode(23756165) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner monsters If this card destroys an opponent's monster by battle and sends it to the Graveyard: Inflict 300 damage to your opponent for each card in your opponent's hand.
--ライトニング・ウォリアー --Lightning Warrior local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local t=Duel.GetAttackTarget() if ev==1 then t=Duel.GetAttacker() end if not c:IsRelateToBattle() or c:IsFacedown() then return false end return t:IsLocation(LOCATION_GRAVE) and t:IsMonster() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Damage(p,Duel.GetFieldGroupCount(p,LOCATION_HAND,0)*300,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, if a face-up "Crystal Beast" monster(s) you control is destroyed by battle or card effect: You can Special Summon 1 "Crystal Beast" monster from your Deck. You can send this face-up card from the field to the GY, then target 1 "Crystal Beast" card you control and 1 card on the field; return them to the hand. You cannot activate these effects in the same Chain.
--宝玉の集結 --Crystal Conclave local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Special summon 1 "Crystal Beast" monster from deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_SZONE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Return 1 "Crystal Beast" and 1 card on field to the hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetHintTiming(0,TIMING_MAIN_END|TIMING_END_PHASE) e3:SetCode(EVENT_FREE_CHAIN) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCost(s.thcost) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_CRYSTAL_BEAST} function s.cfilter(c,tp) return c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c,e,tp) return c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED) end Duel.SendtoGrave(c,REASON_COST) end function s.thfilter1(c,rc) return c:IsFaceup() and c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsAbleToHand() and Duel.IsExistingTarget(s.thfilter2,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c,rc) end function s.thfilter2(c,rc) return c~=rc and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return not e:GetHandler():IsStatus(STATUS_CHAINING) and Duel.IsExistingTarget(s.thfilter1,tp,LOCATION_ONFIELD,0,1,nil,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g1=Duel.SelectTarget(tp,s.thfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,e:GetHandler()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,s.thfilter2,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst(),e:GetHandler()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g1,2,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a monster: You can Special Summon this card from your hand, then destroy all other monsters you control, also you cannot Special Summon monsters, except DARK monsters, while this card is face-up in the Monster Zone. Once per Chain, during your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Link Summon 1 Dragon Link Monster using materials you control, including this card. You can only use each effect of "Outburst Dragon" once per turn.
--アウトバースト・ドラゴン --Outburst Dragon --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon and destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Link Summon during opponent's Main Phase 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(_,tp)return Duel.IsTurnPlayer(1-tp)end) e2:SetTarget(s.lktg) e2:SetOperation(s.lkop) c:RegisterEffect(e2) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0) if chk==0 then return #g>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,c) if #g>0 then Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end --Cannot Special Summon non-DARK monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetRange(LOCATION_MZONE) e1:SetAbsoluteRange(tp,1,0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetTarget(function(_,c)return not c:IsAttribute(ATTRIBUTE_DARK)end) c:RegisterEffect(e1) end end function s.lkfilter(c,mc) return c:IsRace(RACE_DRAGON) and c:IsLinkSummonable(mc) end function s.lktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.lkfilter,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.lkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsControler(1-tp) then return end local g=Duel.GetMatchingGroup(s.lkfilter,tp,LOCATION_EXTRA,0,nil,c) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=g:Select(tp,1,1,nil):GetFirst() if sc then Duel.LinkSummon(tp,sc,c) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute Summon this card by Tributing 1 Tribute Summoned monster. If this card is Tribute Summoned: Target 1 card on the field; banish it, and if you do, inflict 1000 damage to your opponent, then, if it is a DARK Monster Card, banish all cards with that name from the hand, Main Deck, Extra Deck, and GY of the player who controlled it. If this card was Tribute Summoned by Tributing a DARK monster, add this additional effect. ● You can target 2 cards, instead.
--怨邪帝ガイウス --Caius the Mega Monarch local s,id=GetID() function s.initial_effect(c) --summon with 1 tribute local e1=aux.AddNormalSummonProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0),s.otfilter) local e2=aux.AddNormalSetProcedure(c,true,true,1,1,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0),s.otfilter) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_REMOVE+CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_MATERIAL_CHECK) e4:SetValue(s.valcheck) e4:SetLabelObject(e3) c:RegisterEffect(e4) end local LOCATION_HAND_DECK_EXTRA_GRAVE=LOCATION_HAND|LOCATION_DECK|LOCATION_EXTRA|LOCATION_GRAVE function s.otfilter(c) return (c:GetSummonType()&SUMMON_TYPE_TRIBUTE)==SUMMON_TYPE_TRIBUTE end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_TRIBUTE end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return true end local ct=1 if e:GetLabel()==1 then e:SetLabel(0) ct=2 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,1,g:GetFirst():GetControler(),LOCATION_HAND_DECK_EXTRA_GRAVE) end function s.rmfilter(c,code) return c:IsCode(code) and (c:IsLocation(LOCATION_HAND|LOCATION_DECK|LOCATION_EXTRA) or aux.SpElimFilter(c,true)) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)~=0 then Duel.Damage(1-tp,1000,REASON_EFFECT) local og=Duel.GetOperatedGroup() local rg=Group.CreateGroup() local tc=og:GetFirst() for tc in aux.Next(og) do if tc:IsAttribute(ATTRIBUTE_DARK) then local sg=Duel.GetMatchingGroup(s.rmfilter,tc:GetControler(),LOCATION_HAND_DECK_EXTRA_GRAVE,0,nil,tc:GetCode()) rg:Merge(sg) end end if #rg>0 then Duel.BreakEffect() Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end end end function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_DARK) 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:
When this card is Normal or Special Summoned, you can add 1 "X-Saber" monster from your Graveyard to your hand.
--XX-セイバー レイジグラ --XX-Saber Ragigura local s,id=GetID() function s.initial_effect(c) --salvage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end s.listed_series={SET_X_SABER} function s.filter(c) return c:IsSetCard(SET_X_SABER) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.operation(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:
Your opponent cannot target face-up Plant monsters for attacks, except this one. If this card in your possession is sent to your GY by your opponent: You can Special Summon 1 Plant monster from your Deck, except "Chirubimé, Princess of Autumn Leaves". * The above text is unofficial and describes the card's functionality in the OCG.
--紅姫チルビメ --Chirubimé, Princess of Autumn Leaves local s,id=GetID() function s.initial_effect(c) --Cannot be battle target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(s.bttg) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.bttg(e,c) return c~=e:GetHandler() and c:IsFaceup() and c:IsRace(RACE_PLANT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.filter(c,e,tp) return c:IsRace(RACE_PLANT) 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.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an Effect Monster's effect activates: Shuffle 1 of your banished Fish, Sea Serpent, or Aqua-Type monsters into the Main Deck; negate the activation and destroy it.
--ギョッ! --Oh F!sh! local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end 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:IsRace(RACE_FISH|RACE_SEASERPENT|RACE_AQUA) 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_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be used as a Synchro Material Monster, except for the Synchro Summon of a Level 7 or higher Synchro Monster. Once per turn, that Synchro Monster cannot be destroyed by battle. Each time this effect is applied, that Synchro Monster loses 400 ATK and DEF at the end of the Damage Step.
--トラスト・ガーディアン --Trust Guardian local s,id=GetID() function s.initial_effect(c) --synchro local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetValue(s.synlimit) c:RegisterEffect(e1) --be material local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BE_MATERIAL) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCondition(s.ccon) e2:SetOperation(s.cop) c:RegisterEffect(e2) end function s.synlimit(e,c) if not c then return false end return c:IsLevelBelow(6) end function s.ccon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO end function s.cop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetCountLimit(1) e1:SetValue(s.valcon) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetCondition(s.adcon) e2:SetOperation(s.adop) e2:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e2) end function s.valcon(e,re,r,rp) if r&REASON_BATTLE~=0 then e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE,0,1) return true else return false end end function s.adcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.adop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(e:GetOwner()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-400) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a DARK monster: You can Special Summon this card from your hand, also you cannot Special Summon monsters for the rest of this turn, except DARK monsters. If you control an Xyz Monster with a DARK Xyz Monster as material: You can target 1 Level 4 or lower "Raidraptor" monster in your GY; Special Summon it, but its effects are negated. You can only use each effect of "Raidraptor - Strangle Lanius" once per turn.
--RR-ストラングル・レイニアス --Raidraptor - Strangle Lanius --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special summon 1 "Raidraptor" monster from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon2) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end s.listed_series={SET_RAIDRAPTOR} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_DARK),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 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) end function s.splimit(e,c) return not c:IsAttribute(ATTRIBUTE_DARK) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_RAIDRAPTOR) and c:HasLevel() and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.xyzdarkfilter(c) return c:IsType(TYPE_XYZ) and c:IsAttribute(ATTRIBUTE_DARK) end function s.xyzfilter(c) return c:IsFaceup() and c:GetOverlayCount()>0 and c:GetOverlayGroup():IsExists(s.xyzdarkfilter,1,nil) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 monsters You can detach 1 material from this card; Special Summon 1 "Salamangreat" monster from your Deck in Defense Position, also you cannot activate monster effects for the rest of this turn, except FIRE monsters. If this Xyz Summoned card is sent to the GY as material for the Link Summon of a "Salamangreat" monster: You can target 1 monster on the field; return it to the hand. You can only use each effect of "Salamangreat Miragestallio" once per turn.
--転生炎獣ミラージュスタリオ --Salamangreat Miragestallio --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure Xyz.AddProcedure(c,nil,3,2) --Special Summon 1 "Salamangreat" 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(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Return 1 monster on the field to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_SALAMANGREAT} function s.spfilter(c,e,tp) return c:IsSetCard(SET_SALAMANGREAT) 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_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end --Cannot activate non-FIRE monster effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(function(_,re) return re:IsMonsterEffect() and re:GetHandler():IsAttributeExcept(ATTRIBUTE_FIRE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsXyzSummoned() and c:IsLocation(LOCATION_GRAVE) and r&REASON_LINK>0 and c:GetReasonCard():IsSetCard(SET_SALAMANGREAT) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this face-up card on the field attacks or is attacked and it is destroyed as a result of battle, the player who destroyed it takes 1000 points of damage.
--原子ホタル --Atomic Firefly local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYED) 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) e:SetLabel(e:GetHandler():GetReasonPlayer()) return e:GetHandler():IsReason(REASON_BATTLE) and e:GetHandler():IsPreviousPosition(POS_FACEUP) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end Duel.SetTargetPlayer(e:GetLabel()) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,e:GetLabel(),1000) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The effect of "Revival Golem" can only be used once per turn. When this card is sent from your Deck to the Graveyard: Activate 1 of these effects. ● Special Summon this card from the Graveyard. ● Add this card from the Graveyard to your hand.
--リバイバルゴーレム --Revival Golem local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.condtion) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condtion(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local opt=0 local c=e:GetHandler() local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) local b2=c:IsAbleToHand() if b1 and b2 then opt=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 elseif b1 then opt=Duel.SelectOption(tp,aux.Stringid(id,1))+1 elseif b2 then opt=Duel.SelectOption(tp,aux.Stringid(id,2))+2 end e:SetLabel(opt) if opt==1 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) elseif opt==2 then e:SetCategory(CATEGORY_TOHAND) Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) else e:SetCategory(0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if e:GetLabel()==1 then if c:IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end elseif e:GetLabel()==2 then if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,c) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card destroys an opponent's monster by battle, inflict 2000 damage to your opponent.
--マスクド・チョッパー --Masked Chopper 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:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(2000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,2000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, you can send this card from your hand to the Graveyard to prevent a "Blackwing" monster you control from being destroyed by this battle.
--BF-蒼天のジェット --Blackwing - Jetstream the Blue Sky local s,id=GetID() function s.initial_effect(c) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetDescription(aux.Stringid(id,0)) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.condition) e2:SetCost(Cost.SelfToGrave) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_BLACKWING} function s.condition(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not d then return false end return (a:IsControler(tp) and a:IsSetCard(SET_BLACKWING)) or (d:IsControler(tp) and d:IsSetCard(SET_BLACKWING)) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local a=Duel.GetAttacker() if Duel.IsTurnPlayer(1-tp) then a=Duel.GetAttackTarget() end if not a:IsRelateToBattle() then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(1) a:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Abyss Actor" monster you control; this turn, every monster that battles it, but is not destroyed, returns to the hand at the end of the Damage Step. 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 target 1 card your opponent controls; place it on top of the Deck.
--魔界台本 「ファンタジー・マジック」 --Abyss Script - Fantasy Magic local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.tdcon) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end s.listed_series={SET_ABYSS_ACTOR} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_ABYSS_ACTOR) 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_TARGET) 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) then tc:RegisterFlagEffect(id,RESET_EVENT|RESET_PHASE|PHASE_END|RESETS_STANDARD&~(RESET_LEAVE|RESET_TODECK|RESET_TEMP_REMOVE|RESET_REMOVE|RESET_TOGRAVE),EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetLabelObject(tc) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabelObject():GetFlagEffect(id)~=0 end function s.retop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() local bc=tc:GetBattleTarget() if bc and not bc:IsStatus(STATUS_BATTLE_DESTROYED) and bc:IsRelateToBattle() then Duel.SendtoHand(bc,nil,REASON_EFFECT) end end function s.filter2(c) return c:IsSetCard(SET_ABYSS_ACTOR) and c:IsFaceup() and c:IsType(TYPE_PENDULUM) end function s.tdcon(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.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Chronomaly" monster, you can Special Summon this card (from your hand) in Defense Position.
--先史遺産モアイ --Chronomaly Moai 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_SPSUM_PARAM) e1:SetRange(LOCATION_HAND) e1:SetTargetRange(POS_FACEUP_DEFENSE,0) e1:SetCondition(s.hspcon) c:RegisterEffect(e1) end s.listed_series={SET_CHRONOMALY} function s.hspcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_CHRONOMALY),c:GetControler(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All Insect, Beast, Plant, and Beast-Warrior monsters on the field gain 200 ATK/DEF.
--森 --Forest local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_INSECT|RACE_BEAST|RACE_PLANT|RACE_BEASTWARRIOR)) e2:SetValue(200) c:RegisterEffect(e2) --Def local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner DARK monsters This card's name becomes "Red Dragon Archfiend" while on the field or in the GY. If this card is sent from the Monster Zone to the GY: You can Special Summon 1 "Red Dragon Archfiend" from your Extra Deck (this is treated as a Synchro Summon), then, if this card was sent to the GY as Synchro Material for a DARK Dragon Synchro Monster, you can destroy all Attack Position monsters your opponent controls. You can only use this effect of "Scarred Dragon Archfiend" once per turn.
--スカーレッド・デーモン --Scarred Dragon Archfiend local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_DARK),1,99) --Name becomes "Red Dragon Archfiend" while on the field on in the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e1:SetValue(CARD_RED_DRAGON_ARCHFIEND) c:RegisterEffect(e1) --Special Summon 1 "Red Dragon Archfiend" from your Extra Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Check if this card was used as Synchro Material for the successful Synchro Summon of a DARK Dragon Synchro Monster local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BE_MATERIAL) e3:SetOperation(s.matcheck) c:RegisterEffect(e3) end s.listed_names={CARD_RED_DRAGON_ARCHFIEND} function s.spfilter(c,e,tp) local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,c,nil,REASON_SYNCHRO) return #pg<=0 and c:IsCode(CARD_RED_DRAGON_ARCHFIEND) and c:IsType(TYPE_SYNCHRO) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,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) if e:GetHandler():HasFlagEffect(id) then e:SetLabel(1) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,1-tp,LOCATION_MZONE) else e:SetLabel(0) end end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if not tc then return end tc:SetMaterial(nil) if Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)==0 then return end tc:CompleteProcedure() if e:GetLabel()==0 then return end local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end end function s.matcheck(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() if (r&REASON_SYNCHRO)==REASON_SYNCHRO and rc:IsAttribute(ATTRIBUTE_DARK) and rc:IsRace(RACE_DRAGON) then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 4 non-Tuner monsters Once per turn, when your opponent activates a Spell/Trap Card (Quick Effect): You can negate the activation, and if you do, destroy that card. If a "Flower Cardian" monster you control battles an opponent's monster, that opponent's monster has its effects negated during the Battle Phase only. If this Synchro Summoned card is destroyed by battle, or leaves the field because of an opponent's card effect while its owner controls it: You can Special Summon 1 "Flower Cardian" Synchro Monster from your Extra Deck, except "Flower Cardian Lightflare". * The above text is unofficial and describes the card's functionality in the OCG.
--花札衛-五光- --Flower Cardian Lightflare local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),4,4) --Negate and destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.discon) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --Negate effects when it battles local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.discon2) e2:SetOperation(s.disop2) c:RegisterEffect(e2) --Special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.sccon) e3:SetTarget(s.sctg) e3:SetOperation(s.scop) c:RegisterEffect(e3) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.listed_series={SET_FLOWER_CARDIAN} s.listed_names={id} function s.discon(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end return rp~=tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.discon2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() local oc=tc:GetBattleTarget() if not oc then return false end if oc:IsControler(tp) then tc,oc=oc,tc end e:SetLabelObject(oc) return tc:IsSetCard(SET_FLOWER_CARDIAN) and tc:IsControler(tp) and oc:IsControler(1-tp) end function s.disop2(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if not tc then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e2) end function s.sccon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or (c:GetReasonPlayer()==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp))) and c:IsPreviousPosition(POS_FACEUP) and c:IsSynchroSummoned() end function s.filter(c,e,tp) return c:IsSetCard(SET_FLOWER_CARDIAN) 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.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.scop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: You can Special Summon this card from your hand. You can only use this effect of "Emissary from the House of Wax" once per turn. If this card battles a monster, neither can be destroyed by that battle. At the end of your opponent's Battle Phase: You can activate this effect; until the start of your opponent's next Battle Phase, all Attack Position monsters your opponent currently controls cannot change their battle positions, nor be used as material for a Fusion, Synchro, Xyz, or Link Summon, also their effects are negated.
--幻蝋館の使者 --Emissary from the House of Wax --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:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(function(e,tp) return Duel.GetAttacker():IsControler(1-tp) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Neither monster can be destroyed by battle local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.indestg) e2:SetValue(1) c:RegisterEffect(e2) --Apply effects at the end of the opponent's Battle Phase local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) e3:SetTarget(s.efftg) e3:SetOperation(s.effop) c:RegisterEffect(e3) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.indestg(e,c) local handler=e:GetHandler() return c==handler or c==handler:GetBattleTarget() end function s.filter(c) return c:IsAttackPos() and not c:HasFlagEffect(id) and not (c:IsHasEffect(EFFECT_CANNOT_CHANGE_POSITION) and c:IsHasEffect(EFFECT_CANNOT_BE_MATERIAL) and not c:IsNegatableMonster()) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DISABLE,nil,1,1-tp,LOCATION_MZONE) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil):Match(aux.NOT(Card.IsImmuneToEffect),nil,e) if #g==0 then return end local c=e:GetHandler() for tc in g:Iter() do tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) --Cannot change its battle position local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetCondition(function(_e) return _e:GetHandler():HasFlagEffect(id) end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) --Cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_MATERIAL) e2:SetValue(aux.cannotmatfilter(SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ,SUMMON_TYPE_LINK)) tc:RegisterEffect(e2) Duel.NegateRelatedChain(tc,RESET_TURN_SET) --Negate its effects local e3=e1:Clone() e3:SetCode(EFFECT_DISABLE) tc:RegisterEffect(e3) local e4=e1:Clone() e4:SetCode(EFFECT_DISABLE_EFFECT) e4:SetValue(RESET_TURN_SET) tc:RegisterEffect(e4) end --Reset the flags at the start of the opponent's next Battle Phase local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_PHASE|PHASE_BATTLE_START) e5:SetCondition(function() return Duel.IsTurnPlayer(1-tp) end) e5:SetCountLimit(1) e5:SetOperation(s.reset) e5:SetReset(RESET_PHASE|PHASE_BATTLE_START|RESET_OPPO_TURN) Duel.RegisterEffect(e5,tp) end function s.reset(e) local g=Duel.GetMatchingGroup(Card.HasFlagEffect,0,LOCATION_MZONE,LOCATION_MZONE,nil,id) if #g==0 then return end for tc in g:Iter() do tc:ResetFlagEffect(id) end e:Reset() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If you control no monsters, or only Pendulum Monsters, apply this effect, based on this card's Pendulum Zone. ● Left: Reduce its Pendulum Scale by 3. ● Right: Increase its Pendulum Scale by 4. During your opponent's Standby Phase: You can Special Summon this card. ---------------------------------------- [ Monster Effect ] If this card is Special Summoned to a zone that is not the center Main Monster Zone, destroy it. Cannot be destroyed by battle. Once per turn, during your opponent's End Phase: You can target 1 card in your Pendulum Zone; destroy it, and if you do, place this card in your Pendulum Zone.
--変導機咎 クロックアーク --Clock Arc --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Special Summon this card from the Pendulum Zone 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_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Change this card's Pendulum Scale local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_LSCALE) e2:SetRange(LOCATION_PZONE) e2:SetCondition(s.slcon) e2:SetValue(s.slval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_RSCALE) c:RegisterEffect(e3) --Destroy itself if Special Summoned to a zone that's not the center Main Monster Zone local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_SPSUMMON_SUCCESS) e4:SetCondition(function(e) return not e:GetHandler():IsSequence(2) end) e4:SetOperation(function(e) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end) c:RegisterEffect(e4) --Cannot be destroyed by battle local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e5:SetValue(1) c:RegisterEffect(e5) --Destroy 1 card in your Pendulum Zone and place this card in your Pendulum Zone local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,1)) e6:SetCategory(CATEGORY_DESTROY) e6:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e6:SetProperty(EFFECT_FLAG_CARD_TARGET) e6:SetCode(EVENT_PHASE+PHASE_END) e6:SetRange(LOCATION_MZONE) e6:SetCountLimit(1) e6:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e6:SetTarget(s.pentg) e6:SetOperation(s.penop) c:RegisterEffect(e6) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.slfilter(c) return c:IsFacedown() or not c:IsType(TYPE_PENDULUM) end function s.slcon(e) return not Duel.IsExistingMatchingCard(s.slfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.slval(e) return e:GetHandler()==Duel.GetFieldCard(e:GetHandlerPlayer(),LOCATION_PZONE,0) and -3 or 4 end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_PZONE) and chkc:IsControler(tp) end if chk==0 then return e:GetHandler():IsType(TYPE_PENDULUM) and Duel.IsExistingTarget(nil,tp,LOCATION_PZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_PZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.penop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and Duel.CheckPendulumZones(tp) 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:
Each time a Winged Beast-Type monster(s) on your side of the field is destroyed, this card gains 500 ATK.
--火炎鳥 --Firebird local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.atkcon) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and (c:GetPreviousRaceOnField()&RACE_WINGEDBEAST)~=0 end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(500) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Your opponent cannot target "Ultimate Crystal" monsters or "Crystal Beast" cards you control with card effects. ---------------------------------------- [ Monster Effect ] You can Tribute this card; add 1 "Ultimate Crystal" monster, "Crystal Beast" monster, or "Crystal" Spell/Trap from your Deck to your hand.
--宝玉の先導者 --Crystal Master local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --cannot be target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_PZONE) e2:SetTargetRange(LOCATION_ONFIELD,0) e2:SetTarget(s.tgtg) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_CRYSTAL_BEAST,SET_ULTIMATE_CRYSTAL,SET_CRYSTAL} function s.tgtg(e,c) return c:IsSetCard(SET_CRYSTAL_BEAST) or (c:IsLocation(LOCATION_MZONE) and c:IsSetCard(SET_ULTIMATE_CRYSTAL)) end function s.filter(c) return (((c:IsSetCard(SET_CRYSTAL_BEAST) or c:IsSetCard(SET_ULTIMATE_CRYSTAL)) and c:IsMonster()) or (c:IsSetCard(SET_CRYSTAL) and c:IsSpellTrap())) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If the equipped monster is a "Dogmatika" monster, it gains ATK equal to its Level x 100. If not, it loses 200 ATK for each "Dogmatika" monster you control. If this card is sent to the GY because the equipped monster is destroyed: You can send 1 monster from your Extra Deck to the GY. You can only use this effect of "Dogmatikacism" once per turn.
--教導神理 --Dogmatikacism --scripted by Naim local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Change ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.value) c:RegisterEffect(e1) --Send from Extra Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.tgcond) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_series={SET_DOGMATIKA} function s.value(e,c) local ec=e:GetHandler():GetEquipTarget() if ec:IsSetCard(SET_DOGMATIKA) then if c:HasLevel() then return 100*ec:GetLevel() end else local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_DOGMATIKA),e:GetHandler():GetControler(),LOCATION_MZONE,0,nil) return -200*ct end end function s.tgcond(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsReason(REASON_DESTROY) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is flipped face-up: You can Special Summon any number of "Ninja" monsters, except "Senior Silver Ninja", from your hand and/or Graveyard in face-down Defense Position. There can only be 1 face-up "Senior Silver Ninja" on the field.
--渋い忍者 --Senior Silver Ninja local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,1,id) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_FLIP) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_NINJA} s.listed_names={id} function s.filter(c,e,tp) return c:IsSetCard(SET_NINJA) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,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) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,ft,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate 1 of these effects. ● Your opponent cannot activate cards or effects in response to the activation of your "Crusadia" monster effects this turn. ● After damage calculation, if your "Crusadia" Link Monster destroys an opponent's monster by battle: Draw cards equal to your monster's Link Rating. You can only activate 1 "Crusadia Testament" per turn.
--テスタメント・パラディオン --Crusadia Testament --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --cannot activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetOperation(s.acop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW) e2:SetCode(EVENT_BATTLED) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end s.listed_series={SET_CRUSADIA} function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id)==0 end function s.acop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetFlagEffect(tp,id)~=0 then return end local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAINING) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetOperation(s.actop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end function s.actop(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if re:IsMonsterEffect() and rc:IsSetCard(SET_CRUSADIA) and ep==tp then Duel.SetChainLimit(s.chainlm) end end function s.chainlm(e,rp,tp) return tp==rp end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not d then return false end if a:IsStatus(STATUS_OPPO_BATTLE) and d:IsControler(tp) then a,d=d,a end if a:IsLinkMonster() and a:IsSetCard(SET_CRUSADIA) and d:IsStatus(STATUS_BATTLE_DESTROYED) then e:SetLabelObject(a) return true else return false end end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local ct=e:GetLabelObject():GetLink() Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ct) Duel.SetOperationInfo(0,CATEGORY_DRAW,0,0,tp,ct) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local rc=e:GetLabelObject() local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ct=rc:GetLink() if rc:IsFaceup() and rc:IsRelateToBattle() and rc:IsControler(tp) and ct>0 then Duel.Draw(p,ct,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can send this card from your hand or field to the GY; place 1 "Divine Domain Baatistina" from your Deck, face-up in your Field Zone. If a face-up "Tistina" Spell/Trap(s) you control is destroyed by an opponent's card effect, while this card is in your GY (except during the Damage Step): You can banish this card; Special Summon 1 LIGHT "Tistina" monster from your hand, Deck, or GY. You can only use each effect of "Fallen of the Tistina" once per turn.
--ティスティナの落とし仔 --Fallen of the Tistina --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Place 1 "Divine Domain Baatistina" face-up in the Field Zone local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.pltg) e1:SetOperation(s.plop) c:RegisterEffect(e1) --Special Summon 1 LIGHT "Tistina" monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={12397569} s.listed_series={SET_TISTINA} function s.plfilter(c) return c:IsFieldSpell() and c:IsCode(12397569) and not c:IsForbidden() end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil) end end function s.plop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if not tc then return end local fc=Duel.GetFieldCard(tp,LOCATION_FZONE,0) if fc then Duel.SendtoGrave(fc,REASON_RULE) Duel.BreakEffect() end Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) end function s.spconfilter(c,tp) return c:GetPreviousTypeOnField()&(TYPE_SPELL|TYPE_TRAP)>0 and c:IsPreviousSetCard(SET_TISTINA) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsSetCard(SET_TISTINA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND|LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|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_DECK|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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard this card to the GY, then target 1 Fiend or Zombie monster your opponent controls; take control of that target until the End Phase.
--傀儡虫 --Marionette Mite local s,id=GetID() function s.initial_effect(c) --control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end Duel.SendtoGrave(e:GetHandler(),REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_ZOMBIE|RACE_FIEND) and c:IsControlerCanBeChanged() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRace(RACE_ZOMBIE|RACE_FIEND) then Duel.GetControl(tc,tp,PHASE_END,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card destroys an opponent's face-up Attack Position monster by battle and sends it to their Graveyard: You can place that monster on top of their Deck.
--有翼賢者ファルコス --Winged Sage Falcos local s,id=GetID() function s.initial_effect(c) --Place destroyed monster on top of the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCondition(s.tdcon) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if not c:IsRelateToBattle() or c:IsFacedown() then return false end return bc:IsLocation(LOCATION_GRAVE) and bc:IsMonster() and bc:IsControler(1-tp) and bc:IsPreviousPosition(POS_FACEUP_ATTACK) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return bc:IsAbleToDeck() end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_TODECK,bc,1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 "Crashbug Z" from your Deck. You must control a face-up "Crashbug Y" to activate and to resolve this effect.
--バグマンX --Crashbug X 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_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={23915499,50319138} function s.cfilter(c) return c:IsFaceup() and c:IsCode(23915499) end function s.spfilter(c,e,tp) return c:IsCode(50319138) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) then return end local tc=Duel.GetFirstMatchingCard(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can activate 1 of these effects (but you can only use each effect of "Eternal Favorite" once per turn); ● Special Summon 1 of your "Yubel" monsters that is banished or in your GY. Neither player can activate cards or effects when that monster is Special Summoned. ● If you control "Yubel": Discard 1 card and send this face-up card to the GY; Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters from either field as material, including a "Yubel" monster.
--エターナル・フェイバリット --Eternal Favorite --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Activate 1 of these effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_names={CARD_YUBEL} s.listed_series={SET_YUBEL} function s.spfilter(c,e,tp) return c:IsSetCard(SET_YUBEL) and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.fcheck(tp,sg,fc) return sg:IsExists(Card.IsSetCard,1,nil,SET_YUBEL) end function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsFaceup),tp,0,LOCATION_ONFIELD,nil),s.fcheck end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local fustg=Fusion.SummonEffTG(nil,Fusion.OnFieldMat,s.fextra) --Special Summon 1 of your "Yubel" monsters that is banished or in your GY local b1=not Duel.HasFlagEffect(tp,id) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp) --Fusion Summon using monsters from either field as material, including a "Yubel" monster local b2=not Duel.HasFlagEffect(tp,id+1) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_YUBEL),tp,LOCATION_ONFIELD,0,1,nil) and c:IsAbleToGraveAsCost() and c:IsStatus(STATUS_EFFECT_ENABLED) and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) and fustg(e,tp,eg,ep,ev,re,r,rp,0) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) elseif op==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) Duel.SendtoGrave(c,REASON_COST) fustg(e,tp,eg,ep,ev,re,r,rp,1) Duel.RegisterFlagEffect(tp,id+1,RESET_PHASE|PHASE_END,0,1) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Special Summon 1 of your "Yubel" monsters that is banished or in your GY if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then sc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) --Neither player can activate cards or effects when that monster is Special Summoned local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_END) e1:SetLabelObject(sc) e1:SetOperation(s.limop) Duel.RegisterEffect(e1,tp) end Duel.SpecialSummonComplete() elseif op==2 then --Fusion Summon using monsters from either field as material, including a "Yubel" monster Fusion.SummonEffOP(nil,Fusion.OnFieldMat,s.fextra)(e,tp,eg,ep,ev,re,r,rp) end end function s.limop(e,tp,eg,ep,ev,re,r,rp) local sc=e:GetLabelObject() local ex,sg=Duel.CheckEvent(EVENT_SPSUMMON_SUCCESS,true) if ex and #sg==1 and sg:GetFirst()==sc and sc:HasFlagEffect(id) then Duel.SetChainLimitTillChainEnd(aux.FALSE) end e:Reset() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card on the field is destroyed and sent to the Graveyard: You can target 1 "Superheavy Samurai" monster in your Graveyard, except "Superheavy Samurai Drum"; Special Summon it. You can only use this effect of "Superheavy Samurai Drum" once per turn.
--超重武者ツヅ-3 --Superheavy Samurai Drum local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_SUPERHEAVY_SAMURAI} s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsReason(REASON_DESTROY) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SUPERHEAVY_SAMURAI) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Reveal all face-down cards on the field (Flip Effects are not activated), then return them to their original positions.
--厳格な老魔術師 --The Stern Mystic local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) 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.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_ONFIELD,nil) if #g>0 then Duel.ConfirmCards(tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can either: Target 1 face-up monster you control; equip this card to that target, OR: Unequip this card and Special Summon it in face-up Attack Position. While equipped by this effect, the equipped monster cannot be targeted or destroyed by your opponent's monster effects. (A monster can only be equipped with 1 Union Monster at a time. If the equipped monster would be destroyed by battle, destroy this card instead.)
--メタル化寄生生物-ソルタイト --Metallizing Parasite - Soltite local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,nil,true) --Equip effect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCondition(aux.IsUnionState) e1:SetValue(s.efilter1) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetCondition(aux.IsUnionState) e2:SetValue(s.efilter2) c:RegisterEffect(e2) end function s.efilter1(e,re,rp) return rp==1-e:GetHandlerPlayer() and re:IsMonsterEffect() end function s.efilter2(e,te) return te:GetHandlerPlayer()~=e:GetHandlerPlayer() and te:IsMonsterEffect() end