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:
Once per turn, you can either: Target 1 face-up "Vylon" 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, if the equipped monster destroys an opponent's monster by battle: You can target 1 card your opponent controls; destroy that target. (A monster can only be equipped with 1 Union Monster at a time. If the equipped monster would be destroyed, destroy this card instead.)
--ヴァイロン・ペンタクロ --Vylon Pentachloro local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,SET_VYLON),true,false) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BATTLE_DESTROYING) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_SZONE) e4:SetCondition(s.descon) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_series={SET_VYLON} function s.descon(e,tp,eg,ep,ev,re,r,rp) return aux.IsUnionState(e) and e:GetHandler():GetEquipTarget()==eg:GetFirst() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During each of your Standby Phases: Inflict damage to both players. This damage begins at 200 and is doubled during each of your following Standby Phases.
--黒蛇病 --Dark Snake Syndrome 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) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local dam=c:GetFlagEffectLabel(id) if dam==nil then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0,200) dam=200 else dam=dam*2 c:SetFlagEffectLabel(id,dam) end Duel.Damage(tp,dam,REASON_EFFECT,true) Duel.Damage(1-tp,dam,REASON_EFFECT,true) Duel.RDComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent adds a card(s) from the Graveyard to their hand: They must shuffle 1 of those cards into their Deck.
--差し戻し --Return local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_TODECK) e1:SetCode(EVENT_TO_HAND) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsPreviousLocation(LOCATION_GRAVE) and c:IsControler(tp) and (not e or c:IsRelateToEffect(e)) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil,nil,1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_TODECK,eg,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.filter,nil,e,1-tp) if #g==0 then return end Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TODECK) local rg=g:Select(1-tp,1,1,nil) Duel.ConfirmCards(tp,rg) Duel.SendtoDeck(rg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Stardust" monster is on the field: Target 1 card on the field; destroy that target.
--シューティング・スター --Shooting Star local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_ATTACK,TIMINGS_CHECK_MONSTER_E|TIMING_ATTACK) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_STARDUST} function s.cfilter(c) return c:IsSetCard(SET_STARDUST) and c:IsFaceup() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc 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:
Equip only to "Elemental HERO Neos". It gains 800 ATK. When it destroys a monster by battle and sends it to the Graveyard: Inflict damage to your opponent equal to the original ATK of the destroyed monster in the Graveyard. During the End Phase: Shuffle this card into the Deck.
--ネオス・フォース --Neos Force local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsCode,CARD_NEOS)) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(800) c:RegisterEffect(e2) --damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_BATTLE_DESTROYING) e4:SetRange(LOCATION_SZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCondition(s.damcon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) --return local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetCategory(CATEGORY_TODECK) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetCode(EVENT_PHASE+PHASE_END) e5:SetRange(LOCATION_SZONE) e5:SetCountLimit(1) e5:SetTarget(s.rettg) e5:SetOperation(s.retop) c:RegisterEffect(e5) end s.listed_names={CARD_NEOS} function s.damcon(e,tp,eg,ep,ev,re,r,rp) local ec=eg:GetFirst() local bc=ec:GetBattleTarget() return ec==e:GetHandler():GetEquipTarget() and bc:IsLocation(LOCATION_GRAVE) and bc:IsReason(REASON_BATTLE) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local ec=eg:GetFirst() local bc=ec:GetBattleTarget() local dam=bc:GetAttack() Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) 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 function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.retop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a card with an effect that requires a die roll: You can Tribute 1 monster; Special Summon 1 monster with a monster effect that requires a die roll from your hand or Deck. * The above text is unofficial and describes the card's functionality in the OCG.
--ディメンジョン・ダイス --Dimension Dice --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Tribute 1 monster and Special Summon 1 monster from the hand or deck with a die roll effect local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.dicefilter(c) return c.roll_dice and c:IsFaceup() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.dicefilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.spcfilter(c,tp) return Duel.GetMZoneCount(tp,c)>0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.spcfilter,1,false,nil,nil,tp) end local sg=Duel.SelectReleaseGroupCost(tp,s.spcfilter,1,1,false,nil,nil,tp) Duel.Release(sg,REASON_COST) end function s.spfilter(c,e,tp) return c.roll_dice and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsType(TYPE_EFFECT) --pending rulings, cannot SS Normal Pendulums with a die roll Pendulum Effect end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.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:
Select 1 face-up Machine-Type Fusion Monster you control and remove it from play until the End Phase of this turn. When that monster is returned to the field, double its ATK. During your next Standby Phase, destroy it.
--サイバネティック・ゾーン --Cybernetic Zone local s,id=GetID() function s.initial_effect(c) --Banish 1 Machine Fusion Monster you control until the End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION) and c:IsAbleToRemove() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,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 Duel.Remove(tc,0,REASON_EFFECT|REASON_TEMPORARY)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetLabelObject(tc) e1:SetCountLimit(1) e1:SetOperation(s.retop) Duel.RegisterEffect(e1,tp) end end function s.retop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if Duel.ReturnToField(e:GetLabelObject()) then --Its ATK is doubled local e1=Effect.CreateEffect(e:GetOwner()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetAttack()*2) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetOwner()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) e2:SetOperation(s.desop) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN) tc:RegisterEffect(e2) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and e:GetHandler():IsRace(RACE_MACHINE) 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:
Cannot be Special Summoned. While face-up on the field, this card is also DARK-Attribute. Once per Chain, when a Spell/Trap Card, or monster effect, is activated (Quick Effect): If this card has 500 or more ATK and DEF, negate that activation, and if you do, this card loses exactly 500 ATK/DEF. If this card is destroyed and sent to the GY: Target 1 monster in your GY (if possible); destroy all cards you control, also, after that, Special Summon that monster (if any). * The above text is unofficial and describes the card's functionality in the OCG.
--光と闇の竜 --Light and Darkness Dragon local s,id=GetID() function s.initial_effect(c) c:AddCannotBeSpecialSummoned() --While face-up on the field, this card is also DARK-Attribute local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_ADD_ATTRIBUTE) e1:SetRange(LOCATION_MZONE) e1:SetValue(ATTRIBUTE_DARK) c:RegisterEffect(e1) --Negate the activation of a Spell/Trap Card or monster effect, and if you do, this card loses exactly 500 ATK/DEF local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_QUICK_F) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsMonsterEffect() end) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Destroy all cards you control and Special Summon 1 monster from your GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(function(e) return e:GetHandler():IsReason(REASON_DESTROY) end) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --"Double Snare" validity aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:HasFlagEffect(id) end if c:IsHasEffect(EFFECT_REVERSE_UPDATE) then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) and c:IsAttackAbove(500) and c:IsDefenseAbove(500) and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.GetCurrentChain()==ev+1 and Duel.NegateActivation(ev) then --This card loses exactly 500 ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-500) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end 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 chkc:IsCanBeSpecialSummoned(e,0,tp,false,false) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,Card.IsCanBeSpecialSummoned,tp,LOCATION_GRAVE,0,1,1,nil,e,0,tp,false,false) local dg=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.BreakEffect() 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 Level 6 or lower Dinosaur monster from your Deck to your hand.
--化石調査 --Fossil Dig local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsLevelBelow(6) and c:IsRace(RACE_DINOSAUR) 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:
If you control "King's Sarcophagus", you can Special Summon this card (from your GY). You can only Special Summon "Hapi, Guidance of Horus" once per turn this way. If another card(s) you control leaves the field by an opponent's card effect, while this card is in your Monster Zone (except during the Damage Step): You can target 2 cards that are banished and/or in the GYs; either add both to the hand or shuffle both into the Deck. You can only use this effect of "Hapi, Guidance of Horus" once per turn.
--ホルスの先導-ハーピ --Hapi, Guidance of Horus --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the GY if you control "King's Sarcophagus" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Add to the hand or shuffle into the Deck 2 cards that are banished or in the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thtdcon) e2:SetTarget(s.thtdtg) e2:SetOperation(s.thtdop) c:RegisterEffect(e2) end s.listed_names={CARD_KING_SARCOPHAGUS} function s.spcon(e,c) if c==nil then return true end local eff={c:GetCardEffect(EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then return false end end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_KING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp end function s.thtdcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.tgfilter(c,e) return c:IsCanBeEffectTarget(e) and (c:IsAbleToHand() or c:IsAbleToDeck()) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsAbleToHand,nil)==#sg or sg:FilterCount(Card.IsAbleToDeck,nil)==#sg end function s.thtdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,LOCATION_GRAVE|LOCATION_REMOVED,nil,e) if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TARGET) Duel.SetTargetCard(sg) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,sg,2,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,sg,2,tp,0) local rg=sg:Filter(Card.IsLocation,nil,LOCATION_GRAVE) if #rg>0 then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,rg,#rg,0,0) end end function s.thtdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g~=2 then return end local b1=g:FilterCount(Card.IsAbleToHand,nil)==2 local b2=g:FilterCount(Card.IsAbleToDeck,nil)==2 if not (b1 or b2) then return end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, --"Add both to the hand" {b2,aux.Stringid(id,3)}) --"Shuffle both into the Deck" if op==1 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) else Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be used as material for a Fusion, Synchro, Xyz, or Link Summon. If this card is Normal or Flip Summoned: Change it to Defense Position. Once per turn: You can target 1 monster in your opponent's Main Monster Zone; give your opponent control of this Defense Position card by moving it to their zone adjacent to the target, then if your opponent controls exactly 2 "Centerfrog" in the Main Monster Zone, gain control of all monsters in between those 2 cards.
--寝ガエル --Centerfrog local s,id=GetID() function s.initial_effect(c) --Cannot be 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_MATERIAL) e1:SetValue(aux.cannotmatfilter(SUMMON_TYPE_FUSION,SUMMON_TYPE_SYNCHRO,SUMMON_TYPE_XYZ,SUMMON_TYPE_LINK)) c:RegisterEffect(e1) --Change battle position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --Change control local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_CONTROL) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.cttg) e4:SetOperation(s.ctop) c:RegisterEffect(e4) end s.listed_names={id} function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsAttackPos() and c:IsRelateToEffect(e) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function s.ctfilter1(c,tp) local seq=c:GetSequence() if seq>4 then return false end return (seq>0 and Duel.CheckLocation(tp,LOCATION_MZONE,seq-1)) or (seq<4 and Duel.CheckLocation(tp,LOCATION_MZONE,seq+1)) end function s.cttg(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.ctfilter1(chkc,1-tp) end if chk==0 then return Duel.IsExistingTarget(s.ctfilter1,tp,0,LOCATION_MZONE,1,nil,1-tp) and e:GetHandler():IsControlerCanBeChanged() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.ctfilter1,tp,0,LOCATION_MZONE,1,1,nil,1-tp) Duel.SetOperationInfo(0,CATEGORY_CONTROL,e:GetHandler(),1,0,0) end function s.ctfilter2(c) return c:GetSequence()<5 and c:IsFaceup() and c:IsCode(id) end function s.ctfilter3(c,seq1,seq2) local seq=c:GetSequence() return seq>seq1 and seq<seq2 and c:IsControlerCanBeChanged() end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsControler(1-tp) or not c:IsPosition(POS_FACEUP_DEFENSE) then return end local tc=Duel.GetFirstTarget() if not tc or not tc:IsRelateToEffect(e) or tc:IsControler(tp) then return end local seq=tc:GetSequence() if seq>4 then return end local zone=0 if seq>0 then zone=bit.replace(zone,0x1,seq-1) end if seq<4 then zone=bit.replace(zone,0x1,seq+1) end if Duel.GetControl(c,1-tp,0,0,zone)==0 then return end local g1=Duel.GetMatchingGroup(s.ctfilter2,tp,0,LOCATION_MZONE,nil) if #g1==2 then local seq1=g1:GetFirst():GetSequence() local seq2=g1:GetNext():GetSequence() if seq2<seq1 then seq1,seq2=seq2,seq1 end local g2=Duel.GetMatchingGroup(s.ctfilter3,tp,0,LOCATION_MZONE,nil,seq1,seq2) if #g2>0 then Duel.BreakEffect() Duel.GetControl(g2,tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned or flipped face-up, you can Special Summon 1 "Batteryman AAA" from your hand or Graveyard.
--電池メン-単四型 --Batteryman AAA local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sumtg) e1:SetOperation(s.sumop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP) c:RegisterEffect(e2) end s.listed_names={id} function s.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 "Magician" Pendulum Monsters Must first be Xyz Summoned with the above Xyz Materials. Once per turn: You can detach 1 Xyz Material from this card; add to your hand, 1 DARK Spellcaster-Type monster from your Deck, Graveyard, or face-up from your Extra Deck. Once per turn, if a Pendulum Monster Card(s) in your Monster Zone or Pendulum Zone would be destroyed by battle or card effect, you can send 1 Spellcaster-Type monster from your Deck to the Graveyard instead.
--星刻の魔術師 --Timestar Magician local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,s.matfilter,4,2,nil,nil,nil,nil,true) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --Search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --destroy replace local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EFFECT_DESTROY_REPLACE) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.reptg) e3:SetValue(s.repval) c:RegisterEffect(e3) end function s.matfilter(c,xyz,sumtype,tp) return c:IsSetCard(SET_MAGICIAN,xyz,sumtype,tp) and c:IsType(TYPE_PENDULUM,xyz,sumtype,tp) end function s.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or ((st&SUMMON_TYPE_XYZ)==SUMMON_TYPE_XYZ and not se) end function s.thfilter(c) return c:IsRace(RACE_SPELLCASTER) and c:IsAttribute(ATTRIBUTE_DARK) and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA)) 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|LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA) 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|LOCATION_EXTRA,0,1,1,nil) local tc=g:GetFirst() if not tc then return end Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end function s.repfilter(c,tp) return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE|LOCATION_PZONE) and c:IsType(TYPE_PENDULUM) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.tgfilter(c) return c:IsRace(RACE_SPELLCASTER) and c:IsAbleToGrave() end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.Hint(HINT_CARD,0,id) Duel.SendtoGrave(sg,REASON_EFFECT) return true else return false end end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can attack your opponent directly. At the end of the Battle Phase, if this card attacked directly: Banish this card until your next Standby Phase.
--スカイオニヒトクイエイ --Skystarray local s,id=GetID() function s.initial_effect(c) --reg local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetOperation(s.regop) c:RegisterEffect(e1) --pierce local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e2) --remove local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_REMOVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_PHASE|PHASE_BATTLE) e3:SetCountLimit(1) e3:SetCondition(s.rmcon) e3:SetTarget(s.rmtg) e3:SetOperation(s.rmop) c:RegisterEffect(e3) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetAttackTarget() then return end c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE,0,1) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,e:GetHandler(),1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then if Duel.Remove(c,0,REASON_EFFECT|REASON_TEMPORARY)==0 then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetLabelObject(c) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) e1:SetReset(RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN) Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetLabelObject()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "Gravekeeper's" monsters gain 500 ATK/DEF. Cards in the GY cannot be banished. Negate any card effect that would move a card in the GY to a different place. Negate any card effect that changes Types or Attributes in the GY.
--王家の眠る谷-ネクロバレー --Necrovalley 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) --Increase ATK/DEF local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_GRAVEKEEPERS)) e2:SetValue(500) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --Cannot banish local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_REMOVE) e4:SetRange(LOCATION_FZONE) e4:SetTargetRange(LOCATION_GRAVE,0) e4:SetCondition(s.contp) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetTargetRange(0,LOCATION_GRAVE) e5:SetCondition(s.conntp) c:RegisterEffect(e5) --"Necrovalley" effect local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_FIELD) e6:SetCode(EFFECT_NECRO_VALLEY) e6:SetRange(LOCATION_FZONE) e6:SetTargetRange(LOCATION_GRAVE,0) e6:SetCondition(s.contp) c:RegisterEffect(e6) local e7=e6:Clone() e7:SetTargetRange(0,LOCATION_GRAVE) e7:SetCondition(s.conntp) c:RegisterEffect(e7) local e8=Effect.CreateEffect(c) e8:SetType(EFFECT_TYPE_FIELD) e8:SetCode(EFFECT_NECRO_VALLEY) e8:SetRange(LOCATION_FZONE) e8:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e8:SetTargetRange(1,0) e8:SetCondition(s.contp) c:RegisterEffect(e8) local e9=e8:Clone() e9:SetTargetRange(0,1) e9:SetCondition(s.conntp) c:RegisterEffect(e9) --Negate an effect when it resolves if it would move a card in the GY local e10=Effect.CreateEffect(c) e10:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e10:SetCode(EVENT_CHAIN_SOLVING) e10:SetRange(LOCATION_FZONE) e10:SetOperation(s.disop) c:RegisterEffect(e10) --Prevent non-activated effects from Special Summoning from the GY (e.g. unclassified summoning effects or delayed effects) local e11=Effect.CreateEffect(c) e11:SetType(EFFECT_TYPE_FIELD) e11:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e11:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e11:SetRange(LOCATION_FZONE) e11:SetTargetRange(1,1) e11:SetTarget(s.cannotsptg) c:RegisterEffect(e11) end s.listed_series={SET_GRAVEKEEPERS} function s.contp(e) return not Duel.IsPlayerAffectedByEffect(e:GetHandler():GetControler(),EFFECT_NECRO_VALLEY_IM) end function s.conntp(e) return not Duel.IsPlayerAffectedByEffect(1-e:GetHandler():GetControler(),EFFECT_NECRO_VALLEY_IM) end function s.disfilter(c,not_im0,not_im1,re) if c:IsControler(0) then return not_im0 and c:IsHasEffect(EFFECT_NECRO_VALLEY) and c:IsRelateToEffect(re) else return not_im1 and c:IsHasEffect(EFFECT_NECRO_VALLEY) and c:IsRelateToEffect(re) end end function s.discheck(ev,category,re,not_im0,not_im1) local ex,tg,ct,p,v=Duel.GetOperationInfo(ev,category) if not ex then return false end if (category==CATEGORY_LEAVE_GRAVE or v==LOCATION_GRAVE) and ct>0 and not tg then if p==0 then return not_im0 elseif p==1 then return not_im1 elseif p==PLAYER_ALL then return not_im0 or not_im1 elseif p==PLAYER_EITHER then return not_im0 and not_im1 end end if tg and #tg>0 then return tg:IsExists(s.disfilter,1,nil,not_im0,not_im1,re) end return false end function s.disop(e,tp,eg,ep,ev,re,r,rp) local tc=re:GetHandler() if not Duel.IsChainDisablable(ev) or tc:IsHasEffect(EFFECT_NECRO_VALLEY_IM) then return end local res=false local not_im0=not Duel.IsPlayerAffectedByEffect(0,EFFECT_NECRO_VALLEY_IM) local not_im1=not Duel.IsPlayerAffectedByEffect(1,EFFECT_NECRO_VALLEY_IM) if not res and s.discheck(ev,CATEGORY_SPECIAL_SUMMON,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_REMOVE,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_TOHAND,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_TODECK,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_TOEXTRA,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_EQUIP,re,not_im0,not_im1) then res=true end if not res and s.discheck(ev,CATEGORY_LEAVE_GRAVE,re,not_im0,not_im1) then res=true end if res then Duel.NegateEffect(ev) end end function s.cannotsptg(e,c,sp,sumtype,sumpos,target_p,sumeff) return c:IsLocation(LOCATION_GRAVE) and sumeff and not sumeff:IsActivated() and not sumeff:IsHasProperty(EFFECT_FLAG_CANNOT_DISABLE) and not Duel.IsPlayerAffectedByEffect(c:GetControler(),EFFECT_NECRO_VALLEY_IM) and not c:IsHasEffect(EFFECT_NECRO_VALLEY_IM) and not sumeff:GetHandler():IsHasEffect(EFFECT_NECRO_VALLEY_IM) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect is activated: Tribute 1 "Hieratic" monster; negate the activation, and if you do, destroy it.
--反射の聖刻印 --Hieratic Seal of Reflection local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_HIERATIC} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsChainNegatable(ev) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) end function s.cfilter(c) return c:IsSetCard(SET_HIERATIC) and not c:IsStatus(STATUS_BATTLE_DESTROYED) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil) Duel.Release(g,REASON_COST) end function s.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:
2 monsters, including a "Scrap" monster You can target 1 "Scrap" monster in your GY; Special Summon it, then destroy 1 card you control. If another face-up "Scrap" monster is destroyed by card effect, while you control this monster (except during the Damage Step): You can Special Summon 1 "Scrap" monster from your Deck, then destroy 1 card on the field. You can only use each effect of "Scrap Wyvern" once per turn.
--スクラップ・ワイバーン --Scrap Wyvern --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 2 monsters, including a "Scrap" monster Link.AddProcedure(c,nil,2,2,s.matcheck) --Special Summon 1 "Scrap" monster from your GY, then destroy 1 card you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.gysptg) e1:SetOperation(s.gyspop) c:RegisterEffect(e1) --Special Summon 1 "Scrap" monster from your Deck, then destroy 1 card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.deckspcon) e2:SetTarget(s.decksptg) e2:SetOperation(s.deckspop) c:RegisterEffect(e2) end s.listed_series={SET_SCRAP} function s.matcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsSetCard,1,nil,SET_SCRAP,lc,sumtype,tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SCRAP) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.gysptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end local dg=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,0) if chk==0 then return #dg>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,1,tp,0) end function s.gyspop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,0,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end end end function s.deckspconfilter(c,tp) return c:IsPreviousSetCard(SET_SCRAP) and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) end function s.deckspcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.deckspconfilter,1,nil,tp) end function s.decksptg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) if chk==0 then return #g>0 and 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) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.deckspop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #dg>0 then Duel.HintSelection(dg) Duel.BreakEffect() Duel.Destroy(dg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 "Heraldic Beast" monsters Once per turn: You can target 1 face-up Xyz Monster your opponent controls; this card's name and original ATK become that monster's name and current ATK, and replace this effect with that monster's original effects, then that monster's ATK becomes 0, also its effects are negated. These changes last until the End Phase.
--No.8 紋章王ゲノム・ヘリター --Number 8: Heraldic King Genom-Heritage local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_HERALDIC_BEAST),4,2) c:EnableReviveLimit() --attack up local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_HERALDIC_BEAST} s.xyz_number=8 function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsFaceup() and tc:IsRelateToEffect(e) then local code=tc:GetOriginalCode() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(code) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_ATTACK) e2:SetValue(tc:GetAttack()) c:RegisterEffect(e2) c:CopyEffect(code,RESETS_STANDARD_PHASE_END,1) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SET_ATTACK_FINAL) e3:SetValue(0) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_DISABLE) e4:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_DISABLE_EFFECT) e5:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e5) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 Dragon monster, then target 2 cards on the field; destroy them. You can only activate 1 "Guardragon Cataclysm" per turn.
--崩界の守護竜 --Guardragon Cataclysm --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.spcheck(sg,tp,exg,dg) local a=0 for c in aux.Next(sg) do if dg:IsContains(c) then a=a+1 end for tc in aux.Next(c:GetEquipGroup()) do if dg:IsContains(tc) then a=a+1 end end end return #dg-a>=2 end function s.cfilter(c) return c:IsRace(RACE_DRAGON) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler(),e) if chk==0 then if e:GetLabel()==1 then e:SetLabel(0) return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,s.spcheck,nil,dg) else return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end end if e:GetLabel()==1 then e:SetLabel(0) local sg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,s.spcheck,nil,dg) Duel.Release(sg,REASON_COST) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,2,2,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Destroy(sg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Fabled" Tuner + 1+ non-Tuner monsters When this card is Synchro Summoned: You can draw until you have 2 cards in your hand.
--魔轟神レイジオン --Fabled Ragin local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_FABLED),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.con) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end s.listed_series={SET_FABLED} function s.con(e,tp,eg,ep,ev,re,r,rp,chk) return e:GetHandler():IsSynchroSummoned() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local h=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) return h<2 and Duel.IsPlayerCanDraw(tp,2-h) end local h=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2-h) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2-h) end function s.op(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local h=Duel.GetFieldGroupCount(p,LOCATION_HAND,0) if h>=2 then return end Duel.Draw(p,2-h,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters, including a Fiend monster During the Main Phase (Quick Effect): You can target 1 face-up card you control; destroy it, then you can apply 1 of these effects. ● Place 1 "Abyss Playhouse - Fantastic Theater" from your Deck, face-up in your Field Zone. ● Place 1 "Abyss Actor" Pendulum Monster from your Deck in your Pendulum Zone. You can only use this effect of "Abyss Actor - Super Producer" once per turn.
--魔界劇団-スーパー・プロデューサー --Abyss Actor - Super Producer --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,nil,2,2,s.lcheck) --Destroy 1 face-up card 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.listed_names={77297908} s.listed_series={SET_ABYSS_ACTOR} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsRace,1,nil,RACE_FIEND,lc,sumtype,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.fldfilter(c) return c:IsCode(77297908) and c:IsFieldSpell() and not c:IsForbidden() end function s.pendfilter(c) return c:IsSetCard(SET_ABYSS_ACTOR) and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or Duel.Destroy(tc,REASON_EFFECT)==0 then return end local g1=Duel.GetMatchingGroup(s.fldfilter,tp,LOCATION_DECK,0,nil) local g2=Duel.GetMatchingGroup(s.pendfilter,tp,LOCATION_DECK,0,nil) local b1=#g1>0 local b2=#g2>0 and Duel.CheckPendulumZones(tp) if not ((b1 or b2) and Duel.SelectYesNo(tp,aux.Stringid(id,1))) then return end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) if op==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.fldfilter,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) end Duel.BreakEffect() Duel.MoveToField(tc,tp,tp,LOCATION_FZONE,POS_FACEUP,true) elseif op==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.pendfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if not tc then return end Duel.BreakEffect() Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a "Crystal Beast" monster(s) is placed in either player's Spell & Trap Zone, place 1 Crystal Counter on this card. You can send this card to the GY; take a number of "Crystal Beast" monsters from your Deck equal to the number of Crystal Counters that were on this card, and place them face-up in your Spell & Trap Zone as Continuous Spells.
--宝玉の樹 --Crystal Tree local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x6) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Place 1 Crystal Counter on this card local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_MOVE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.ctcon1) e2:SetOperation(s.ctop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetCondition(s.ctcon2) c:RegisterEffect(e3) --Place "Crystal Beast" monsters to your Spell/Trap Zone local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_SZONE) e4:SetCost(s.plcost) e4:SetTarget(s.pltg) e4:SetOperation(s.plop) c:RegisterEffect(e4) end s.listed_series={SET_CRYSTAL_BEAST} s.counter_place_list={0x6} function s.ctfilter(c) return c:IsLocation(LOCATION_SZONE) and not c:IsPreviousLocation(LOCATION_SZONE) and c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsFaceup() and c:IsOriginalType(TYPE_MONSTER) end function s.ctcon1(e,tp,eg,ep,ev,re,r,rp) if not eg:IsExists(s.ctfilter,1,nil) then return end if Duel.GetCurrentChain()>0 then e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_CHAIN,0,1) return false end return true end function s.ctcon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetFlagEffect(id)>0 then c:ResetFlagEffect(id) return true else return false end end function s.ctop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():AddCounter(0x6,1) end function s.plcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() end e:SetLabel(c:GetCounter(0x6)) Duel.SendtoGrave(c,REASON_COST) end function s.plfilter(c) return c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsMonster() and not c:IsForbidden() end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetHandler():GetCounter(0x6) if chk==0 then return ct>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>=ct-1 and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,ct,nil) end end function s.plop(e,tp,eg,ep,ev,re,r,rp) local ct=e:GetLabel() if Duel.GetLocationCount(tp,LOCATION_SZONE)<ct then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,ct,ct,nil) if #g==0 then return end local c=e:GetHandler() for tc in g:Iter() do Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) --Treat it as a Continuous Spell local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET) e1:SetValue(TYPE_SPELL+TYPE_CONTINUOUS) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, if you control this card on the field, you can equip it to your "Dark Blade" as an Equip Spell Card, OR unequip the Union equipment and Special Summon this card in face-up Attack Position. While equipped to a monster by this card's effect, increase the ATK/DEF of the equipped monster by 400 points. When it attacks with an ATK that is higher than the DEF of a Defense Position monster, inflict the difference as Battle Damage to your opponent's Life Points. (1 monster can only be equipped with 1 Union Monster at a time. If the equipped monster is destroyed as a result of battle, destroy this card instead.)
--漆黒の闘龍 --Pitch-Dark Dragon local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsCode,11321183),true) --atk/def local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(400) e3:SetCondition(aux.IsUnionState) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e4) --pierce local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_EQUIP) e5:SetCode(EFFECT_PIERCE) e5:SetCondition(aux.IsUnionState) c:RegisterEffect(e5) end s.listed_names={11321183}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Genex Controller" + 1 or more non-Tuner WATER monsters When this card destroys an opponent's monster by battle and sends it to the Graveyard, gain Life Points equal to the ATK of the destroyed monster.
--ハイドロ・ジェネクス --Hydro Genex local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterSummonCode(68505803),1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_WATER),1,99) c:EnableReviveLimit() --recover local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCondition(s.reccon) e1:SetTarget(s.rectg) e1:SetOperation(s.recop) c:RegisterEffect(e1) end s.material={68505803} s.listed_names={68505803} function s.reccon(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 e:SetLabel(t:GetAttack()) return t:IsLocation(LOCATION_GRAVE) and t:IsMonster() 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(e:GetLabel()) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,e:GetLabel()) 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:
During damage calculation, if this card is attacked by your opponent's monster: You can activate this effect; this card cannot be destroyed by this battle, also you take no battle damage from it. After damage calculation, your opponent gains LP equal to the attacking monster's ATK, also return this card to your hand. * The above text is unofficial and describes the card's functionality in the OCG.
--クリボン --Kuribon local s,id=GetID() function s.initial_effect(c) --be target local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCountLimit(1) e1:SetCondition(s.con) e1:SetTarget(s.target) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.con(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttackTarget()==e:GetHandler() and Duel.GetBattleDamage(tp)>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local val=Duel.GetAttacker():GetAttack() Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(val) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,val) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) Duel.SendtoHand(c,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is used to Ritual Summon "Vennu, Bright Bird of Divinity". You must also Tribute monsters from your hand or field whose total Levels equal 8 or more. During your End Phase: You can banish this card from your Graveyard, then target 1 Ritual Monster in your Graveyard that was sent there from the field this turn; Special Summon it.
--原初の叫喚 --Primal Cry local s,id=GetID() function s.initial_effect(c) Ritual.AddProcGreaterCode(c,8,nil,10441498) --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_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1) e1:SetCondition(s.spcon) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.spfilter(c,e,tp,turn) return c:IsType(TYPE_RITUAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:GetTurnID()==turn end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local turn=Duel.GetTurnCount() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp,turn) 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,turn) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,turn) 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:
Each time a "Six Samurai" monster(s) is Normal or Special Summoned, place 1 Bushido Counter on this card. You can send this card to the GY; Special Summon 1 "Six Samurai" or "Shien" Effect Monster from your Main Deck, whose Level is less than or equal to the number of Bushido Counters on this card.
--紫炎の道場 --Shien's Dojo local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(COUNTER_BUSHIDO) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --add counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetOperation(s.ctop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_SZONE) e4:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_SIX_SAMURAI,SET_SHIEN} s.counter_place_list={COUNTER_BUSHIDO} function s.ctfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SIX_SAMURAI) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) if eg:IsExists(s.ctfilter,1,nil) then e:GetHandler():AddCounter(COUNTER_BUSHIDO,1) end end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end local ct=e:GetHandler():GetCounter(COUNTER_BUSHIDO) e:SetLabel(ct) Duel.SendtoGrave(e:GetHandler(),REASON_COST) end function s.filter(c,ct,e,tp) return c:IsLevelBelow(ct) and (c:IsSetCard(SET_SIX_SAMURAI) or c:IsSetCard(SET_SHIEN)) and c:IsType(TYPE_EFFECT) 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:GetHandler():GetCounter(COUNTER_BUSHIDO),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 local ct=e:GetLabel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,ct,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a face-up card(s) on the field and/or in the GY is added to your opponent's hand by an effect: Look at their hand, also banish the added card(s) and all cards with the same name, if any.
--無情なはたき落とし --Heartless Drop Off -- local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_HANDES) e1:SetCode(EVENT_TO_HAND) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsControler(tp) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_ONFIELD|LOCATION_GRAVE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1) end function s.filter(c,e,tp) return c:IsRelateToEffect(e) and s.cfilter(c,tp) end function s.rmfilter(c,g) return c:IsAbleToRemove() and g:IsExists(Card.IsCode,1,nil,c:GetCode()) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter,nil,e,1-tp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g>0 then Duel.ConfirmCards(tp,g) local tg=g:Filter(s.rmfilter,nil,dg) if #tg>0 then Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end Duel.ShuffleHand(1-tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 card, then target 1 monster on the field; place that target on the top of the Deck.
--振り出し --Back to Square One local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.activate(e) 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:
Target any number of your banished "Invoked" monsters with different names; Special Summon them in Defense Position.
--魔法名-「大いなる獣」 --Omega Summon local s,id=GetID() function s.initial_effect(c) --Special Summon in Defense Position any number of banished "Invoked" monsters with different names 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_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_INVOKED} function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_INVOKED) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_REMOVED,0,nil,e,tp):Filter(Card.IsCanBeEffectTarget,nil,e) local tg=aux.SelectUnselectGroup(g,e,tp,1,math.min(ft,#g),aux.dncheck,1,tp,HINTMSG_SPSUMMON) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,#tg,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetTargetCards(e) if ft<=0 or #g==0 or (#g>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end if #g<=ft then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,ft,ft,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE) g:Sub(sg) Duel.SendtoGrave(g,REASON_RULE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is face-up on the field, you can Normal Summon it to have it be treated as an Effect Monster with this effect: ● This card is treated as a Tuner.
--チューンド・マジシャン --Tuned Magician local s,id=GetID() function s.initial_effect(c) Gemini.AddProcedure(c) --Treated as Tuner local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(Gemini.EffectStatusCondition) e1:SetValue(TYPE_TUNER) c:RegisterEffect(e1) 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; it loses 1000 ATK for each monster your opponent controls.
--魔筒覗ベイオネーター --Bayonater, the Baneful Barrel --scripted by Logical Nonsense --Substitute ID 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:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end --Activation legality function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() 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 --Targeted monster loses 1000 ATK for each monster opponent controls function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local atk=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)*1000 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares a direct attack: Shuffle all your opponent's Attack Position monsters into the Deck.
--波紋のバリア -ウェーブ・フォース- --Drowning Mirror Force local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) 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 eg and eg:GetFirst():IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.filter(c) return c:IsAttackPos() and c:IsAbleToDeck() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Gains 100 ATK for each "Amazoness" monster you control.
--アマゾネスの聖戦士 --Amazoness Paladin local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.val) c:RegisterEffect(e1) end s.listed_series={SET_AMAZONESS} function s.val(e,c) return Duel.GetMatchingGroupCount(s.filter,c:GetControler(),LOCATION_MZONE,0,nil)*100 end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_AMAZONESS) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, if you control no monsters: You can target 1 "Ancient Gear" monster in your Graveyard; Special Summon it, and if you do, it gains 200 ATK (even if this card leaves the field). You can only control 1 "Ancient Gear Reborn".
--古代の機械蘇生 --Ancient Gear Reborn local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ANCIENT_GEAR} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ANCIENT_GEAR) 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) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(200) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your EARTH Warrior monster battles an opponent's monster, during damage calculation (Quick Effect): You can pay 800 LP; your battling monster gains 800 ATK, until the end of this turn. If this card is sent from your Monster Zone to your GY by an opponent's card effect: You can Special Summon 1 Level 5 or higher "War Rock" monster from your hand or Deck. You can only use each effect of "War Rock Wento" once per turn.
--ウォークライ・ウェント --War Rock Wento --scripted by XyleN local s,id=GetID() function s.initial_effect(c) --Gains 800 ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.atkcon) e1:SetCost(Cost.PayLP(800)) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Special Summon 1 "War Rock" from hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_WAR_ROCK} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local bc0,bc1=Duel.GetBattleMonster(tp) return bc0 and bc1 and bc0:IsAttribute(ATTRIBUTE_EARTH) and bc0:IsRace(RACE_WARRIOR) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetBattleMonster(tp) if tc:IsRelateToBattle() and tc:IsFaceup() and tc:IsControler(tp) then --Increase ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(800) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_WAR_ROCK) and c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp) if #sg==0 then return end Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 monsters When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can detach 1 Xyz Material from this card; inflict 1000 damage to your opponent.
--グレンザウルス --Grenosaurus local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,3,2) c:EnableReviveLimit() --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_O) e1:SetCondition(s.damcon) e1:SetCost(Cost.DetachFromSelf(1)) 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 bc=c:GetBattleTarget() return c:IsRelateToBattle() and bc:IsLocation(LOCATION_GRAVE) and bc: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.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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
At the start of the Damage Step, if this card attacked a face-down Defense Position monster: Destroy that monster. During the End Phase, if this card destroyed a monster by battle this turn: You can send this face-up card to the Graveyard; Special Summon 1 "Mystic Swordsman LV4" from your hand or Deck.
--ミスティック・ソードマン LV2 --Mystic Swordsman LV2 local s,id=GetID() function s.initial_effect(c) --battle destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetOperation(s.bdop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLE_START) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCondition(s.spcon) e3:SetCost(Cost.SelfToGrave) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={74591968} s.LVnum=2 s.LVset=SET_MYSTIC_SWORDSMAN function s.bdop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return e:GetHandler()==Duel.GetAttacker() and d and d:IsFacedown() and d:IsDefensePos() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttackTarget(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() if d:IsRelateToBattle() then Duel.Destroy(d,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.spfilter(c,e,tp) return c:IsCode(74591968) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_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 tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,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:
The equipped monster cannot be destroyed by battle.
--ミスト・ボディ --Mist Body local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) c:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can target 1 monster on the field; change it to face-up Attack Position if it is in Defense Position, also change its ATK to 0. You can only use this effect of "Subterror Behemoth Speleogeist" once per turn. When a face-up monster you control is flipped face-down, if you control no face-up monsters: You can Special Summon this card from your hand in Defense Position. Once per turn: You can change this card to face-down Defense Position.
--サブテラーマリス・エルガウスト --Subterror Behemoth Speleogeist local s,id=GetID() function s.initial_effect(c) --Change 1 face-up monster on the field to face-up Attack Position if it is in Defense Position, also change its ATK to 0. local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special Summon this card from your hand in Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetRange(LOCATION_HAND) e2:SetCode(EVENT_CHANGE_POS) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Change this card to face-down Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetTarget(s.postg) e3:SetOperation(s.posop) c:RegisterEffect(e3) end function s.filter(c) return c:IsDefensePos() or c:GetAttack()>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end if tc:IsDefensePos() then Duel.ChangePosition(tc,POS_FACEUP_ATTACK) end if tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.cfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsFacedown() and c:IsControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn: You can roll a six-sided die. Until the end of this turn, reduce this card's Pendulum Scale by that number (min. 1). ---------------------------------------- [ Flavor Text ] The taste of victory will bowl you over.
--マイルド・ターキー --Mild Turkey local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --scale change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DICE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetTarget(s.sctg) e1:SetOperation(s.scop) c:RegisterEffect(e1) end s.roll_dice=true function s.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLeftScale()>1 end Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function s.scop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:GetLeftScale()<=1 then return end local dc=Duel.TossDice(tp,1) local sch=math.min(c:GetLeftScale()-1,dc) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LSCALE) e1:SetValue(-sch) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_RSCALE) c:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 LIGHT monsters Once per turn: You can detach 1 Xyz Material from this card; change all monsters your opponent controls to face-up Defense Position.
--セイクリッド・ヒアデス --Constellar Hyades local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),3,2) c:EnableReviveLimit() --pos change local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return not c:IsPosition(POS_FACEUP_DEFENSE) and c:IsCanChangePosition() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE,POS_FACEUP_DEFENSE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control 3 or more monsters with the same name, except Tokens: Target 3 cards your opponent controls; destroy those targets.
--スリーカード --Three of a Kind local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsFaceup() and not c:IsType(TYPE_TOKEN) and Duel.IsExistingMatchingCard(s.cfilter2,tp,LOCATION_MZONE,0,2,c,c:GetCode()) end function s.cfilter2(c,code) return c:IsFaceup() and c:IsCode(code) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,3,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Neither player can Special Summon monsters with the same Level as those they control. Neither player can Special Summon monsters with the same Rank as those they control.
--召喚制限-ディスコードセクター --And the Band Played On local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Cannot Special Summon monsters with the same Level/Rank 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_SZONE) e2:SetTargetRange(1,1) e2:SetTarget(s.splimit) c:RegisterEffect(e2) end function s.splimit(e,c,sump,sumtype,sumpos,targetp) if c:HasLevel() then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsLevel,c:GetLevel()),sump,LOCATION_MZONE,0,1,nil) elseif c:IsRankAbove(0) then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRank,c:GetRank()),sump,LOCATION_MZONE,0,1,nil) end return false end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, if you control this card: You can target 1 "Elemental HERO" monster in your GY that was destroyed by battle and sent there; Special Summon that target.
--摩天楼2-ヒーローシティ --Skyscraper 2 - Hero City 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) --spsummon 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_FZONE) e2:SetCountLimit(1) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ELEMENTAL_HERO} function s.filter(c,e,tp) return c:IsSetCard(SET_ELEMENTAL_HERO) and (c:GetReason()&REASON_BATTLE)~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) 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) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All monsters on the field, except "Amorphage" monsters, lose 100 ATK and DEF for each "Amorphage" card on the field. If a card(s) in your Pendulum Zone is destroyed (except during the Damage Step): You can place 1 "Amorphage" Pendulum Monster from your Deck in your Pendulum Zone. You can only use this effect of "Amorphage Lysis" once per turn.
--アモルファージ・ライシス --Amorphage Lysis local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) c:RegisterEffect(e1) --place a card in the pendulum zone local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.setcon) e2:SetTarget(s.settg2) e2:SetOperation(s.setop) c:RegisterEffect(e2) --atk/def down local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetTarget(s.atktg) e3:SetValue(s.atkval) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e4) end s.listed_series={SET_AMORPHAGE} function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_PZONE) and c:IsPreviousControler(tp) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c) return c:IsSetCard(SET_AMORPHAGE) and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() end function s.settg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if not Duel.CheckPendulumZones(tp) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end function s.atktg(e,c) return not c:IsSetCard(SET_AMORPHAGE) end function s.atkval(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_AMORPHAGE),0,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)*-100 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 EARTH monster from your GY. If this card is destroyed by battle and sent to the GY: Destroy all Spells and Traps on the field.
--ギガンテス --Gigantes local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.spfilter(c,tp) return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or (c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5)) end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return ft>-1 and #rg>0 and aux.SelectUnselectGroup(rg,e,tp,1,1,nil,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,nil,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return c:IsSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Gem-Knight Lapis" + 1 "Gem-Knight" monster Must first be Fusion Summoned with the above Fusion Materials. You can only Special Summon "Gem-Knight Lady Lapis Lazuli(s)" once per turn. Once per turn: You can send 1 "Gem-Knight" monster from your Main Deck or Extra Deck to the Graveyard, and if you do, inflict 500 damage to your opponent for each Special Summoned monster on the field.
--ジェムナイトレディ・ラピスラズリ --Gem-Knight Lady Lapis Lazuli local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,false,false,99645428,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GEM_KNIGHT)) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DAMAGE+CATEGORY_DECKDES) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_series={SET_GEM_KNIGHT} s.material_setcode={SET_GEM,SET_GEM_KNIGHT} function s.splimit(e,se,sp,st) return not e:GetHandler():IsLocation(LOCATION_EXTRA) or (st&SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end function s.filter(c) return c:IsSetCard(SET_GEM_KNIGHT) and c:IsMonster() and c:IsAbleToGrave() end function s.ctfilter(c) return c:IsSpecialSummoned() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil) and Duel.IsExistingMatchingCard(s.ctfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ct*500) end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) local ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_GRAVE) if ct>0 then local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Damage(p,ct*500,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish any number of "Laval" monsters from your Graveyard; Special Summon an equal number of "Laval Tokens" (Pyro-Type/FIRE/Level 1/ATK 0/DEF 0) in Defense Position.
--紅蓮の炎壁 --Searing Fire Wall 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_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={47658965} s.listed_series={SET_LAVAL} function s.cfilter(c) return c:IsSetCard(SET_LAVAL) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g if Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,5,nil) else g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,Duel.GetLocationCount(tp,LOCATION_MZONE),nil) end e:SetLabel(#g) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION)) and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,SET_LAVAL,TYPES_TOKEN,0,0,1,RACE_PYRO,ATTRIBUTE_FIRE) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,e:GetLabel(),0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,e:GetLabel(),tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<e:GetLabel() or not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,SET_LAVAL,TYPES_TOKEN,0,0,1,RACE_PYRO,ATTRIBUTE_FIRE) then return end for i=1,e:GetLabel() do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up Xyz Monster you control; Special Summon from your Extra Deck, 1 "Number C" or "CXyz" monster with the same Type as that monster you control but 1 Rank higher, by using it as the Xyz Material. (This Special Summon is treated as an Xyz Summon. Xyz Materials attached to it also become Xyz Materials on the Summoned monster.) Then, if possible, detach 1 Xyz Material from a monster your opponent controls and attach it to the Summoned monster as an Xyz Material.
--RUM-バリアンズ・フォース --Rank-Up-Magic Barian's Force local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_NUMBER_C,SET_CXYZ} function s.filter1(c,e,tp) local rk=c:GetRank() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and c:IsFaceup() and (rk>0 or c:IsStatus(STATUS_NO_LEVEL)) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+1,c:GetRace(),pg) end function s.filter2(c,e,tp,mc,rk,rc,pg) if c.rum_limit and not c.rum_limit(mc,e) then return false end return mc:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsRank(rk) and c:IsRace(rc) and (c:IsSetCard({SET_NUMBER_C,SET_CXYZ})) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and mc:IsCanBeXyzMaterial(c,tp) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,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_MZONE) and s.filter1(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(tc),tp,nil,nil,REASON_XYZ) if not tc or tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) or #pg>1 or (#pg==1 and not pg:IsContains(tc)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1,tc:GetRace(),pg) local sc=g:GetFirst() if sc then sc:SetMaterial(tc) Duel.Overlay(sc,tc) Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP) sc:CompleteProcedure() local g1=Duel.GetOverlayGroup(tp,0,1) if #g1>0 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local mg2=g1:Select(tp,1,1,nil) local oc=mg2:GetFirst():GetOverlayTarget() Duel.Overlay(sc,mg2) Duel.RaiseSingleEvent(oc,EVENT_DETACH_MATERIAL,e,0,0,0,0) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned from the Graveyard, it gains this effect. ● If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent.
--堕天使エデ・アーラエ --Darklord Edeh Arae local s,id=GetID() function s.initial_effect(c) --spsum success local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetOperation(s.gete) c:RegisterEffect(e1) end function s.gete(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():GetPreviousLocation()~=LOCATION_GRAVE then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PIERCE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e:GetHandler():RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters During your Main Phase: You can excavate the top 5 cards of your Deck, and if you do, you can add 1 excavated "Adamancipator" card to your hand, also place the rest on the bottom of your Deck in any order. During your opponent's turn, if a FIRE monster is in your GY (Quick Effect): You can target 1 Rock monster in your GY; Special Summon it. You can only use each effect of "Adamancipator Risen - Leonite" once per turn.
--魔救の奇跡-レオナイト --Adamancipator Risen - Leonite local s,id=GetID() function s.initial_effect(c) --Synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --Excavate and add 1 exacavated "Adamancipator" card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special summon 1 Rock monster from the GY 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ADAMANCIPATOR} function s.thfilter(c) return c:IsSetCard(SET_ADAMANCIPATOR) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=5 end Duel.SetTargetPlayer(tp) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ac=5 Duel.ConfirmDecktop(p,ac) local g=Duel.GetDecktopGroup(p,ac) if #g>0 and g:IsExists(s.thfilter,1,nil) and Duel.SelectYesNo(p,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_ATOHAND) local sg=g:FilterSelect(p,s.thfilter,1,1,nil) Duel.DisableShuffleCheck() Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-p,sg) Duel.ShuffleHand(p) ac=ac-1 end if ac>0 then Duel.MoveToDeckBottom(ac,tp) Duel.SortDeckbottom(tp,tp,ac) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.IsExistingMatchingCard(Card.IsAttribute,tp,LOCATION_GRAVE,0,1,nil,ATTRIBUTE_FIRE) end function s.spfilter(c,e,tp) return c:IsRace(RACE_ROCK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) 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,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 "Aleister the Invoker" from your Deck to your hand. The activation of your cards and effects that include an effect that Fusion Summons a Fusion Monster cannot be negated, also your opponent's cards and effects cannot activate when a monster is Fusion Summoned this way. You can only activate 1 "Magical Meltdown" per turn.
--暴走魔法陣 --Magical Meltdown 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:SetOperation(s.activate) c:RegisterEffect(e1) --inactivatable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_INACTIVATE) e2:SetRange(LOCATION_FZONE) e2:SetValue(s.efilter) c:RegisterEffect(e2) --act limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_FZONE) e3:SetCondition(s.limcon) e3:SetOperation(s.limop) c:RegisterEffect(e3) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e5:SetRange(LOCATION_FZONE) e5:SetCode(EVENT_CHAIN_END) e5:SetOperation(s.limop2) c:RegisterEffect(e5) end s.listed_names={86120751} function s.thfilter(c) return c:IsCode(86120751) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.efilter(e,ct) local p=e:GetHandlerPlayer() local te,tp=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER) return p==tp and te:IsHasCategory(CATEGORY_FUSION_SUMMON) end function s.limfilter(c,tp) return c:IsSummonPlayer(tp) and c:IsFusionSummoned() end function s.limcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.limfilter,1,nil,tp) end function s.limop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetCurrentChain()==0 then Duel.SetChainLimitTillChainEnd(s.chainlm) elseif Duel.GetCurrentChain()==1 then e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAINING) e1:SetOperation(s.resetop) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EVENT_BREAK_EFFECT) e2:SetReset(RESET_CHAIN) Duel.RegisterEffect(e2,tp) end end function s.resetop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():ResetFlagEffect(id) e:Reset() end function s.limop2(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():GetFlagEffect(id)~=0 then Duel.SetChainLimitTillChainEnd(s.chainlm) end e:GetHandler():ResetFlagEffect(id) end function s.chainlm(e,rp,tp) return tp==rp 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 4 EARTH Machine-Type monster from your Deck to your hand, except "Geargiauger", also you cannot declare attacks, nor Special Summon monsters except Machine-Type monsters, for the rest of this turn.
--ギアギアングラー --Geargiauger local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={id} function s.filter(c) return c:GetLevel()==4 and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) 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.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 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetTargetRange(1,0) e2:SetTarget(s.splimit) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.splimit(e,c) return c:GetRace()~=RACE_MACHINE end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can either: Target 1 "Decayed Commander" you control; equip this card to that target, OR: Unequip this card and Special Summon it in Attack Position. While equipped by this effect, the equipped monster gains 500 ATK/DEF. If the equipped monster destroys an opponent's monster by battle: Discard 1 random card from their hand. (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.)
--ゾンビタイガー --Zombie Tiger local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsCode,10209545),true) --Atk up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(500) e3:SetCondition(aux.IsUnionState) c:RegisterEffect(e3) --Def up local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_EQUIP) e4:SetCode(EFFECT_UPDATE_DEFENSE) e4:SetValue(500) e4:SetCondition(aux.IsUnionState) c:RegisterEffect(e4) --handes local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_HANDES) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetRange(LOCATION_SZONE) e5:SetCode(EVENT_BATTLE_DESTROYING) e5:SetCondition(s.hdcon) e5:SetTarget(s.hdtg) e5:SetOperation(s.hdop) c:RegisterEffect(e5) end s.listed_names={10209545} function s.hdcon(e,tp,eg,ep,ev,re,r,rp) return aux.IsUnionState(e) and eg:GetFirst()==e:GetHandler():GetEquipTarget() end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoGrave(sg,REASON_DISCARD|REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can activate 1 of the following effects; ● Send 1 "Synchron" monster from your hand or face-up field to the GY; Special Summon 1 monster from your hand. ● Target 1 other card you control; destroy it, and if you do, Special Summon 1 "Synchron" monster with a different original name from your hand or GY. You can only use this effect of "Synchro Dilemma" once per turn.
--ンクロ・ディレンマ --Synchro Dilemma --scripted by Rundas 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) --To GY + Firewall Lite local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCost(s.tgcost) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Pop + Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SYNCHRON} --To GY + Firewall Lite function s.cfilter(c,e,tp,ft) if not (c:IsSetCard(SET_SYNCHRON) and c:IsMonster() and c:IsAbleToGraveAsCost()) then return false end if not c:IsLocation(LOCATION_MZONE) then return ft>0 and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,c,e,0,tp,false,false) else return c:IsFaceup() and ft>-1 and Duel.IsExistingMatchingCard(Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,c,e,0,tp,false,false) end end function s.tgcost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,e,tp,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil,e,tp,ft) Duel.SendtoGrave(g,REASON_COST) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,Card.IsCanBeSpecialSummoned,tp,LOCATION_HAND,0,1,1,nil,e,0,tp,false,false) if #tc>0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end --Pop + Special Summon function s.filter(c,e,tp,ft) if not c:IsLocation(LOCATION_MZONE) then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,c:GetCode(),e,tp) else return ft>-1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,c:GetCode(),e,tp) end end function s.spfilter(c,code,e,tp) return c:IsSetCard(SET_SYNCHRON) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsOriginalCode(code) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c,ft=e:GetHandler(),Duel.GetLocationCount(tp,LOCATION_MZONE) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,c,e,tp,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local tc=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,c,e,tp,ft) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,tp,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,tc:GetCode(),e,tp) if #sc>0 then Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] You cannot Pendulum Summon monsters, except "Lunalight" monsters. This effect cannot be negated. Once per turn: You can Fusion Summon 1 "Lunalight" Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from your field or Graveyard. ---------------------------------------- [ Monster Effect ] If a "Lunalight" monster you control attacks a Defense Position monster, inflict piercing battle damage to your opponent.
--月光狼 --Lunalight Wolf local s,id=GetID() function s.initial_effect(c) --Pendulum summon Pendulum.AddProcedure(c) --Prevent pendulum summon of non-"Lunalight" monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_PZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) c:RegisterEffect(e1) --Fusion summon local params = {fusfilter=aux.FilterBoolFunction(Card.IsSetCard,SET_LUNALIGHT),matfilter=Fusion.OnFieldMat(Card.IsAbleToRemove), extrafil=s.fextra,extraop=Fusion.BanishMaterial,extratg=s.extratarget} local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1) e2:SetTarget(Fusion.SummonEffTG(params)) e2:SetOperation(Fusion.SummonEffOP(params)) c:RegisterEffect(e2) --Piercing damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_PIERCE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(s.ptg) c:RegisterEffect(e3) end s.listed_series={SET_LUNALIGHT} function s.splimit(e,c,sump,sumtype,sumpos,targetp) return not (c:IsSetCard(SET_LUNALIGHT) and c:IsMonster()) and (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end function s.fextra(e,tp,mg) if not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToRemove),tp,LOCATION_GRAVE,0,nil) end return nil end function s.extratarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_MZONE|LOCATION_GRAVE) end function s.ptg(e,c) return c:IsSetCard(SET_LUNALIGHT) and c:IsMonster() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner Wyrm monsters If you Synchro Summon another Wyrm monster, while this monster is on the field: You can draw 1 card. If your opponent Special Summons a monster(s) (except during the Damage Step): You can banish 1 of those monster(s), and if you do, inflict 1200 damage to your opponent. When your opponent activates a Spell/Trap Card or effect (Quick Effect): You can banish that card, and if you do, inflict 1200 damage to your opponent. You can only use each effect of "Swordsoul Sinister Sovereign - Qixing Longyuan" once per turn.
--相剣大邪-七星龍淵 --Swordsoul Sinister Sovereign - Qixing Longyuan local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_WYRM),1,99) --Draw 1 card when a Wyrm monster is Synchro Summoned local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --Banish 1 monster and inflict 1200 Damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CUSTOM+id) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function() return Duel.GetCurrentPhase()~=PHASE_DAMAGE and Duel.GetCurrentPhase()~=PHASE_DAMAGE_CAL end) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --Register summons local e2a=Effect.CreateEffect(c) e2a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2a:SetCode(EVENT_SPSUMMON_SUCCESS) e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2a:SetRange(LOCATION_MZONE) e2a:SetLabelObject(e2) e2a:SetOperation(s.regop) c:RegisterEffect(e2a) --Banish Spell/Trap and inflict 1200 Damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_REMOVE+CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.rmcon2) e3:SetTarget(s.rmtg2) e3:SetOperation(s.rmop2) c:RegisterEffect(e3) end function s.cfilter(c,e,tp) return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsSynchroSummoned() and c:IsRace(RACE_WYRM) and c:IsSummonPlayer(tp) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,e:GetHandler(),e,tp) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.filter(c,tp,e) return c:IsSummonPlayer(1-tp) and c:IsLocation(LOCATION_MZONE) and c:IsAbleToRemove() and (not e or c:IsRelateToEffect(e)) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=e:GetLabelObject():Filter(s.filter,nil,tp,nil) if chk==0 then return #g>0 end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1200) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=e:GetLabelObject() if #g==0 then return end local bg=g:FilterSelect(tp,s.filter,1,1,nil,tp,e) if #bg>0 and Duel.Remove(bg,POS_FACEUP,REASON_EFFECT)>0 then Duel.Damage(1-tp,1200,REASON_EFFECT) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)>0 then return end local c=e:GetHandler() local tg=eg:Filter(s.filter,nil,tp) if #tg>0 then for tc in tg:Iter() do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end function s.rmcon2(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsSpellTrapEffect() and re:GetHandler():IsRelateToEffect(re) end function s.rmtg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return re:GetHandler():IsAbleToRemove() end Duel.SetOperationInfo(0,CATEGORY_REMOVE,re:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1200) end function s.rmop2(e,tp,eg,ep,ev,re,r,rp) if not re:GetHandler():IsRelateToEffect(re) then return end if Duel.Remove(eg,POS_FACEUP,REASON_EFFECT)>0 then Duel.Damage(1-tp,1200,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a monster that is not a "Burning Abyss" monster, destroy this card. You can only use 1 of these effects of "Alich, Malebranche of the Burning Abyss" per turn, and only once that turn. ● If you control no Spell/Trap Cards: You can Special Summon this card from your hand. ● If this card is sent to the Graveyard: You can target 1 face-up monster on the field; negate its effects until the end of this turn.
--彼岸の悪鬼 アリキーノ --Alich, Malebranche of the Burning Abyss local s,id=GetID() function s.initial_effect(c) --self destruction local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SELF_DESTROY) e1:SetCondition(s.sdcon) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.sscon) e2:SetTarget(s.sstg) e2:SetOperation(s.ssop) c:RegisterEffect(e2) --negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DISABLE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,id) e3:SetTarget(s.distg) e3:SetOperation(s.disop) c:RegisterEffect(e3) end s.listed_series={SET_BURNING_ABYSS} function s.sdfilter(c) return not c:IsFaceup() or not c:IsSetCard(SET_BURNING_ABYSS) end function s.sdcon(e) return Duel.IsExistingMatchingCard(s.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.sscon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_ONFIELD,0,1,nil) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.ssop(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.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsFaceup() and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsDisabled() then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card, then target 1 face-up Continuous Spell/Trap on the field; destroy that target.
--結界術師 メイコウ --Mei-Kou, Master of Barriers local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsContinuousSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,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.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters All monsters your opponent controls lose 500 ATK/DEF. You can only use each of the following effects of "Crystron Eleskeletus" once per turn. If this card is Synchro Summoned: You can add 1 "Crystron" card from your GY or banishment to your hand. If this Synchro Summoned card is destroyed by battle or card effect: You can Special Summon 1 "Crystron" monster from your GY or banishment.
--水晶機巧-エレスケルタス --Crystron Eleskeletus --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Monsters your opponent controls lose 500 ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(-500) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --Add 1 "Crystron" card from your GY or banishment to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,id) e3:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --Special Summon 1 "Crystron" monster from your GY or banishment local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_CRYSTRON} s.listed_names={id} function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_CRYSTRON) 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_GRAVE|LOCATION_REMOVED,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) 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_GRAVE|LOCATION_REMOVED,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsSynchroSummoned() and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_CRYSTRON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Clayman" + "Elemental HERO Burstinatrix" Must be Fusion Summoned. This card can attack directly while in Defense Position. If it does, apply its ATK for damage calculation, and its ATK is halved during damage calculation only.
--E・HERO ランパートガンナー --Elemental HERO Rampart Blaster local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,58932615,84327329) --spsummon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.fuslimit) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DIRECT_ATTACK) e2:SetCondition(s.dacon) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DEFENSE_ATTACK) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e4:SetCondition(s.dacon) e4:SetValue(1) c:RegisterEffect(e4) --atkdown local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_SET_ATTACK_FINAL) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e5:SetRange(LOCATION_MZONE) e5:SetCondition(s.atkcon) e5:SetValue(s.atkval) c:RegisterEffect(e5) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} function s.dacon(e) return e:GetHandler():IsDefensePos() end function s.atkcon(e) if Duel.GetCurrentPhase()~=PHASE_DAMAGE_CAL then return false end local c=e:GetHandler() return c:IsDefensePos() and c==Duel.GetAttacker() and Duel.GetAttackTarget()==nil and c:GetEffectCount(EFFECT_DIRECT_ATTACK)==1 end function s.atkval(e,c) return c:GetAttack()/2 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent from the field or the hand to the Graveyard: You can excavate the top card of your Deck, and if it is a Plant-Type monster, send it to the Graveyard. Otherwise, place it on the bottom of your Deck. If this card is excavated from the Deck and sent to the Graveyard by a card effect: You can excavate the top card of your Deck, and if it is a Plant-Type monster, send it to the Graveyard. Otherwise, place it on the bottom of your Deck.
--森羅の隠蜜 スナッフ --Sylvan Snapdrassinagon local s,id=GetID() function s.initial_effect(c) --Excavate the top card of your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCondition(s.condition2) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_HAND|LOCATION_ONFIELD) end function s.condition2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_DECK) and c:IsReason(REASON_EXCAVATE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanDiscardDeck(tp,1) then return end Duel.ConfirmDecktop(tp,1) local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() if tc:IsRace(RACE_PLANT) then Duel.DisableShuffleCheck() Duel.SendtoGrave(g,REASON_EFFECT|REASON_EXCAVATE) else Duel.MoveSequence(tc,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during the End Phase, if this card attacked this turn: Destroy this card. When this card on the field is destroyed and sent to the GY: You can Tribute 1 monster; Special Summon this card from the GY.
--ヘル・ドラゴン --Infernal Dragon local s,id=GetID() function s.initial_effect(c) --destroy itself local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackAnnouncedCount()~=0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.cfilter(c,ft,tp) return ft>0 or (c:IsControler(tp) or c:GetSequence()<5) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,ft,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,ft,tp) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return 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) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Effect Monsters When a monster this card points to activates its effect (except during the Damage Step) (Quick Effect): You can target 1 Effect Monster your opponent controls; until the end of this turn, change its ATK to 0, also negate its effects. During the End Phase, if this card is in the GY because it was destroyed by battle or card effect and sent there this turn: You can Special Summon this card. You can only use each effect of "Pitknight Earlie" once per turn.
--ピットナイト・アーリィ --Pitknight Earlie --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,2) --Change ATK to 0 and negate effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.negcon) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Register when sent to GY 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:SetOperation(s.regop) c:RegisterEffect(e2) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local loc,seq,p=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SEQUENCE,CHAININFO_TRIGGERING_CONTROLER) if p==1-tp then seq=seq+16 end return re:IsMonsterEffect() and (loc&LOCATION_MZONE)~=0 and bit.extract(c:GetLinkedZone(),seq)~=0 end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) and not (c:GetAttack()==0 and c:IsDisabled()) end function s.negtg(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_NEGATE) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local c=e:GetHandler() --Negate the target's effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) --Change ATK to 0 local e3=Effect.CreateEffect(c) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_SET_ATTACK_FINAL) e3:SetReset(RESETS_STANDARD_PHASE_END) e3:SetValue(0) tc:RegisterEffect(e3) end end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE|REASON_EFFECT) then local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,{id,1}) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_GRAVE) 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:
Target 1 face-up card in the Spell & Trap Zone; destroy that face-up card, then, its controller can Set 1 Spell/Trap from their hand. If this Set card is destroyed and sent to the GY: Target 1 face-up card on the field; destroy that target.
--荒野の大竜巻 --Wild Tornado local s,id=GetID() function s.initial_effect(c) --Destroy 1 face-up card in the Spell/Trap Zone local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Destroy 1 face-up card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_STZONE) and chkc:IsFaceup() and chkc~=c end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_STZONE,LOCATION_STZONE,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_STZONE,LOCATION_STZONE,1,1,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then local dp=tc:GetControler() local g=Duel.GetMatchingGroup(Card.IsSSetable,dp,LOCATION_HAND,0,nil,false,dp) if #g>0 and Duel.SelectYesNo(dp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=g:Select(dp,1,1,nil) Duel.BreakEffect() Duel.SSet(dp,sg,dp,false) end end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (r&REASON_DESTROY)>0 and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() 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:
Discard 1 card. Special Summon 1 Level 4 or lower monster from your opponent's Graveyard to your side of the field, and your opponent Special Summons 1 Level 4 or lower monster from your Graveyard to your opponent's side of the field. Those monsters are destroyed during the End Phase of the next turn.
--ボーン・テンプル・ブロック --Bone Temple Block local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsLevelBelow(4) 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 false end if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)~=0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_GRAVE,1,nil,e,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,1-tp,0,LOCATION_GRAVE,1,nil,e,1-tp) and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local og=Duel.SelectTarget(1-tp,s.filter,1-tp,0,LOCATION_GRAVE,1,1,nil,e,1-tp) local sc=sg:GetFirst() local oc=og:GetFirst() local g=Group.FromCards(sc,oc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,PLAYER_ALL,1-g:GetFirst():GetOwner()) e:SetLabelObject(sc) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_EFFECT|REASON_DISCARD)==0 then return end local sc=e:GetLabelObject() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local oc=g:GetFirst() if oc==sc then oc=g:GetNext() end if sc:IsRelateToEffect(e) then Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESETS_STANDARD_PHASE_END,2) e1:SetCountLimit(1) e1:SetLabel(Duel.GetTurnCount()) sc:RegisterEffect(e1,true) end if oc:IsRelateToEffect(e) then Duel.SpecialSummonStep(oc,0,1-tp,1-tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESETS_STANDARD_PHASE_END,2) e1:SetCountLimit(1) e1:SetLabel(Duel.GetTurnCount()) oc:RegisterEffect(e1,true) end Duel.SpecialSummonComplete() end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnCount()~=e:GetLabel() 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:
During your turn, if the effect of a "Naturia" monster was activated on your field, you can Special Summon this card (from your hand).
--ナチュル・ハイドランジー --Naturia Hydrangea local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) end s.listed_series={SET_NATURIA} function s.chainfilter(re,tp,cid) return not (re:GetHandler():IsSetCard(SET_NATURIA) and re:IsMonsterEffect() and Duel.GetChainInfo(cid,CHAININFO_TRIGGERING_LOCATION)==LOCATION_MZONE) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 monsters Once per turn: You can detach 1 Xyz Material from this card; all face-up monsters you currently control gain 300 ATK.
--No.20 蟻岩土ブリリアント --Number 20: Giga-Brilliant local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,3,2) c:EnableReviveLimit() --attack up local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.xyz_number=20 function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(300) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Magical Musket - Crooked Crown". During the Main Phase: You can Special Summon 1 "Magical Musket" monster from your hand, and if you do, if your opponent's Main Monster Zone in that monster's current column is unused, that zone cannot be used until the end of this turn (even if this card leaves the field). You can only use this effect of "Magical Musket - Crooked Crown" once per turn.
--魔弾-ブラッディ・クラウン --Magical Musket - Crooked Crown --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.spcon) e2:SetCountLimit(1,id) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_MAGICAL_MUSKET} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MAGICAL_MUSKET) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) then local seq=tc:GetSequence() local nseq=4-seq if Duel.CheckLocation(1-tp,LOCATION_MZONE,nseq) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE_FIELD) e1:SetRange(LOCATION_SZONE) e1:SetLabel(nseq+16) e1:SetOperation(s.disop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end end function s.disop(e,tp) return 0x1<<e:GetLabel() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Super Quant" Xyz Monster you control; equip this card to it. It gains ATK equal to its Rank x 100, also if it attacks a Defense Position monster, inflict piercing battle damage to your opponent. During your Battle Phase: You can send this Equip Card to the Graveyard; the monster that was equipped with this card can make 3 attacks during each Battle Phase this turn.
--超量機神剣-マグナスレイヤー --Super Quantal Mech Sword - Magnaslayer local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(aux.RemainFieldCost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(s.atkval) c:RegisterEffect(e2) --pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) --multi attack local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_SZONE) e4:SetCondition(s.mtcon) e4:SetCost(s.mtcost) e4:SetTarget(s.mttg) e4:SetOperation(s.mtop) c:RegisterEffect(e4) end s.listed_series={SET_SUPER_QUANT} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_SUPER_QUANT) and c:IsType(TYPE_XYZ) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsLocation(LOCATION_SZONE) or not c:IsRelateToEffect(e) or c:IsStatus(STATUS_LEAVE_CONFIRMED) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:GetControler()==c:GetControler() then Duel.Equip(tp,c,tc) --Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(s.eqlimit) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) else c:CancelToGrave(false) end end function s.eqlimit(e,c) return c:GetControler()==e:GetOwnerPlayer() and c:IsSetCard(SET_SUPER_QUANT) and c:IsType(TYPE_XYZ) end function s.atkval(e,c) return c:GetRank()*100 end function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsType(TYPE_EQUIP) and Duel.IsTurnPlayer(tp) and Duel.IsBattlePhase() end function s.mtcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() end Duel.SetTargetCard(c:GetEquipTarget()) Duel.SendtoGrave(c,REASON_COST) end function s.mttg(e,tp,eg,ep,ev,re,r,rp,chk) local ec=e:GetHandler():GetEquipTarget() if chk==0 then return ec and not ec:IsHasEffect(EFFECT_EXTRA_ATTACK) end end function s.mtop(e,tp,eg,ep,ev,re,r,rp) local ec=Duel.GetFirstTarget() if ec and ec:IsLocation(LOCATION_MZONE) and ec:IsFaceup() and ec:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(2) e1:SetReset(RESETS_STANDARD_PHASE_END) ec:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 3 Level 3 or lower WATER monsters; Special Summon this card from your hand or Graveyard. When you do: Return all Spell and Trap Cards on the field to the hand, and if you do, if 3 or more cards are returned to the hand by this effect, all monsters your opponent currently controls lose 300 ATK for each.
--海皇龍 ポセイドラ --Poseidra, the Atlantean Dragon 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|LOCATION_GRAVE) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --return local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_WATER) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,3,false,aux.ReleaseCheckMMZ,nil) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,3,3,false,aux.ReleaseCheckMMZ,nil) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1 end function s.thfilter(c) return c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_HAND) if ct>=3 then local mg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local tc=mg:GetFirst() for tc in aux.Next(mg) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-ct*300) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish up to 2 Spells from your GY, and if you do, this card gains 300 ATK for each card banished by this effect, until the end of your opponent's turn. * The above text is unofficial and describes the card's functionality in the OCG.
--カオスライダー グスタフ --Chaosrider Gustaph local s,id=GetID() function s.initial_effect(c) --Banish up to 2 Spells and increase ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) end function s.rmfilter(c) return c:IsSpell() and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_GRAVE) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_GRAVE,0,1,2,nil) if #g==0 then return end Duel.HintSelection(g,true) local ct=Duel.Remove(g,POS_FACEUP,REASON_EFFECT) local c=e:GetHandler() if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*300) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END|RESET_OPPO_TURN) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned from the GY: This card's Level becomes 4. You can only use each of the following effects of "Left-Hand Shark" once per turn. If you control "Right-Hand Shark", and this card is in your hand or GY: You can Special Summon this card, but banish it when it leaves the field. An Xyz Monster that was Summoned using only WATER monsters as material, including this card on the field, gains this effect. ● This card cannot be destroyed by card effects.
--レフトハンド・シャーク --Left-Hand Shark --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand or GY while you control "Right Hand Shark" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --If special summoned from GY, it becomes level 4 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.lvcon) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) --Xyz used this and only WATER monsters for material, cannot be destroyed by card effect local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BE_MATERIAL) e3:SetProperty(EFFECT_FLAG_EVENT_PLAYER) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.efcon) e3:SetOperation(s.efop) c:RegisterEffect(e3) end --Specifically lists "Right Hand Shark" s.listed_names={11845050} --Check for "Right Hand Shark" function s.spfilter(c) return c:IsFaceup() and c:IsCode(11845050) end --If you control "Right Hand Shark" function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(e:GetHandler():GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,e:GetHandler():GetControler(),LOCATION_ONFIELD,0,1,nil) end --Activation legality 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 --Special summon itself from hand, banish it if it leaves the field function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1,true) end end --Check if previous location was GY function s.lvcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_GRAVE) end --Activation legality function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsLevel(4) end end --Make this card's level become 4 function s.lvop(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(4) c:RegisterEffect(e1) end end --No non-WATER monsters as material function s.ffilter(c) return not c:IsAttribute(ATTRIBUTE_WATER) end function s.efcon(e,tp,eg,ep,ev,re,r,rp) local ec=e:GetHandler():GetReasonCard() return not ec:GetMaterial():IsExists(s.ffilter,1,nil) and r==REASON_XYZ end --A Xyz monster using this card cannot be destroyed by card effects function s.efop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(rc) e1:SetDescription(3001) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1,true) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Increase your Life Points by 800 points.
--天使の生き血 --Soul of the Pure local s,id=GetID() function s.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_RECOVER) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(800) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,800) end function s.op(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:
You can Set this card from your hand to your Spell & Trap Zone as a Spell Card. During your opponent's turn, if this Set card in the Spell & Trap Zone is destroyed and sent to your Graveyard: Special Summon it. When an "Artifact" card(s) is destroyed and sent to your Graveyard (except during the Damage Step): You can Special Summon this card from your hand.
--アーティファクト-ラブリュス --Artifact Labrys local s,id=GetID() function s.initial_effect(c) --set local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MONSTER_SSET) e1:SetValue(TYPE_SPELL) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --spsummon 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_TO_GRAVE) e3:SetRange(LOCATION_HAND) e3:SetCondition(s.spcon2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_ARTIFACT} function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEDOWN) and c:IsReason(REASON_DESTROY) and Duel.GetTurnPlayer()~=tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_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.cfilter(c,tp) return c:IsControler(tp) and c:IsSetCard(SET_ARTIFACT) and c:IsReason(REASON_DESTROY) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) 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 e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: Each player can banish up to 5 Spells from their own GY, face-down. If an attack is declared: activate this effect; the attacked player chooses whether to apply this effect. ● You (the attacked player) can randomly add 1 of your cards banished by this card's effect to your hand, then you can discard it and negate that attack, but if you do not discard that added card, any battle damage you take this turn is doubled (even if this card leaves the field). * The above text is unofficial and describes the card's functionality in the OCG.
--スマイル・アクション --Smile Action --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Negate attack local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_HANDES) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_FZONE) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_GRAVE) end function s.rmfilter(c) return c:IsSpell() and c:IsAbleToRemove(POS_FACEDOWN) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local rg=Group.CreateGroup() local turn_p=Duel.GetTurnPlayer() local step=turn_p==0 and 1 or -1 for p=turn_p,1-turn_p,step do if Duel.IsExistingMatchingCard(s.rmfilter,p,LOCATION_GRAVE,0,1,nil) and Duel.SelectYesNo(p,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,p,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(p,s.rmfilter,p,LOCATION_GRAVE,0,1,5,nil) rg:Merge(g) end end if #rg==0 then return end Duel.HintSelection(rg,true) if Duel.Remove(rg,POS_FACEDOWN,REASON_EFFECT)>0 then local og=Duel.GetOperatedGroup() for tc in og:Iter() do tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end end end function s.thfilter(c) return c:GetFlagEffect(id)~=0 and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local at=Duel.GetAttacker() local p=1-at:GetControler() Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,p,LOCATION_REMOVED) Duel.SetPossibleOperationInfo(0,CATEGORY_HANDES,nil,1,p,LOCATION_HAND) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() local p=1-at:GetControler() if Duel.IsExistingMatchingCard(s.thfilter,p,LOCATION_REMOVED,0,1,nil) and Duel.SelectYesNo(p,aux.Stringid(id,2)) then local g=Duel.GetMatchingGroup(s.thfilter,p,LOCATION_REMOVED,0,nil) local tg=g:RandomSelect(p,1) Duel.SendtoHand(tg,nil,REASON_EFFECT) local tc=tg:GetFirst() if tc:IsDiscardable(REASON_EFFECT) and Duel.SelectYesNo(p,aux.Stringid(id,3)) then Duel.BreakEffect() Duel.SendtoGrave(tc,REASON_EFFECT|REASON_DISCARD) Duel.NegateAttack() else --double damage local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetValue(DOUBLE_DAMAGE) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,p) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target Rock monsters you control with 0 original ATK, with card effects. Once per battle, when an opponent's monster declares an attack: You can negate that attack, and if you do, place 1 counter on this card. If this card has 3 counters, send it to the GY. If you have 3 or more Rock monsters in your GY with 0 ATK and different names from each other: You can banish this card from your GY; any effect damage your opponent takes this turn is doubled.
--トーテムポール --Totem Pole --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE) c:EnableCounterPermit(0x20f) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Opponent cannot target monsters with 0 original ATK with card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(s.filter)) e1:SetValue(aux.tgoval) c:RegisterEffect(e1) --Negate attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_COUNTER) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetCost(s.btcost) e2:SetOperation(s.btop) c:RegisterEffect(e2) --Send this card to the GY local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_SELF_TOGRAVE) e3:SetRange(LOCATION_SZONE) e3:SetCondition(function(e) return e:GetHandler():GetCounter(0x20f)==3 end) c:RegisterEffect(e3) --Double any effect damage the opponent takes this turn local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_GRAVE) e4:SetCondition(s.damcon) e4:SetCost(Cost.SelfBanish) e4:SetOperation(s.damop) c:RegisterEffect(e4) end function s.filter(c) return c:IsRace(RACE_ROCK) and c:GetBaseAttack()==0 end function s.btcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:HasFlagEffect(id) and c:IsCanAddCounter(0x20f,1) end c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE,0,1) end function s.btop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.NegateAttack() and c:IsRelateToEffect(e) and c:IsCanAddCounter(0x20f,1) then Duel.BreakEffect() c:AddCounter(0x20f,1) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.HasFlagEffect(tp,id) and Duel.GetMatchingGroup(s.filter,tp,LOCATION_GRAVE,0,nil):GetClassCount(Card.GetCode)>=3 end function s.damop(e,tp,eg,ep,ev,re,r,rp) if Duel.HasFlagEffect(tp,id) then return end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) --Double effect damage 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_CHANGE_DAMAGE) e1:SetTargetRange(0,1) e1:SetValue(function(_,_,val,r) return r&REASON_EFFECT>0 and val*2 or val end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's Main Phase: Target 1 "Cipher" Xyz Monster you control; Special Summon from your Extra Deck, 1 "Cipher" Xyz Monster that is 1 Rank higher than that target, by using that target as the Xyz Material. (This Special Summon is treated as an Xyz Summon. Xyz Materials attached to that target also become Xyz Materials on the Summoned monster.) It gains this effect. ● This card gains 500 ATK for each Level 4 or higher monster you control.
--RUM-光波昇華 --Rank-Up-Magic Cipher Ascension local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_CIPHER} function s.filter1(c,e,tp) local rk=c:GetRank() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and rk>0 and c:IsFaceup() and c:IsSetCard(SET_CIPHER) and (rk>0 or c:IsStatus(STATUS_NO_LEVEL)) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+1,pg) end function s.filter2(c,e,tp,mc,rk,pg) if c.rum_limit and not c.rum_limit(mc,e) then return false end return c:IsType(TYPE_XYZ) and mc:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsRank(rk) and c:IsSetCard(SET_CIPHER) and mc:IsCanBeXyzMaterial(c,tp) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,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_MZONE) and s.filter1(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(tc),tp,nil,nil,REASON_XYZ) if not tc or tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) or #pg>1 or (#pg==1 and not pg:IsContains(tc)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1,pg) local sc=g:GetFirst() if sc then sc:SetMaterial(tc) Duel.Overlay(sc,tc) Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1,true) if not sc:IsType(TYPE_EFFECT) then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e2,true) end sc:CompleteProcedure() sc:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) end end function s.atkfilter(c) return c:IsFaceup() and c:IsLevelAbove(4) end function s.atkval(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsLevelAbove,4),c:GetControler(),LOCATION_MZONE,0,nil)*500 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You must control a "War Rock" monster to activate either of these effects. ● When a monster your opponent controls activates its effect: Negate that effect. ● During the Battle Phase, when your opponent activates a Spell/Trap Card, or monster effect: Negate that effect. You can only activate 1 "War Rock Dignity" per turn.
--ウォークライ・ディグニティ --War Rock Dignity --Scripted by Rundas local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(function(e,tp,eg,ep,ev) Duel.NegateEffect(ev) end) c:RegisterEffect(e1) end s.listed_series={SET_WAR_ROCK} function s.condition(e,tp,eg,ep,ev,re,r,rp) if not (Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_WAR_ROCK),tp,LOCATION_MZONE,0,1,nil) and Duel.IsChainDisablable(ev)) then return false end local trig_loc,trig_contr=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CONTROLER) return (re:IsMonsterEffect() and trig_loc==LOCATION_MZONE and trig_contr==1-tp) or (Duel.IsBattlePhase() and rp==1-tp and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE))) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,tp,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned by the effect of an "Adamancipator" card: You can place 1 "Adamancipator" card from your hand or GY on top of the Deck. If this card is in your GY: You can target 1 FIRE Synchro Monster you control or in your GY; return it to the Extra Deck, and if you do, place this card on top of the Deck. You can only use each effect of "Adamancipator Crystal - Leonite" once per turn.
--魔救の奇石-レオナイト --Adamancipator Crystal - Leonite local s,id=GetID() function s.initial_effect(c) --decktop other local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(s.dtcon) e1:SetTarget(s.dttg) e1:SetOperation(s.dtop) c:RegisterEffect(e1) --to extra local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end s.listed_series={SET_ADAMANCIPATOR} function s.dtcon(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsSetCard(SET_ADAMANCIPATOR) end function s.dtfilter(c) return c:IsSetCard(SET_ADAMANCIPATOR) and c:IsAbleToDeck() end function s.dttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.dtfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.dtop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.dtfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil):GetFirst() if tc then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) if not tc:IsLocation(LOCATION_EXTRA) then Duel.ConfirmDecktop(tp,1) end end end function s.tdfilter(c) return (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsType(TYPE_SYNCHRO) and c:IsAbleToExtra() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) and c:IsAbleToDeck() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local tc=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil):GetFirst() Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,tp,LOCATION_GRAVE) if tc:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tc,1,tp,0) end end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_EXTRA) and c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT)~=0 then Duel.ConfirmDecktop(tp,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ WATER monsters Once per turn, during each Standby Phase: You can banish 1 WATER monster from your GY or face-up field; draw 1 card. Each time a monster(s) is banished face-up: This card gains 600 ATK for each, until the end of this turn. You can send 1 WATER monster from your hand to the GY; Special Summon 1 of your banished "Marincess" monsters. You can only use this effect of "Marincess Great Bubble Reef" once per turn.
--海晶乙女グレート・バブルリーフ --Marincess Great Bubble Reef --Scripted by Eerie Code, anime version by Larry126 local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 2+ WATER monsters Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_WATER),2) --Draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_PHASE+PHASE_STANDBY) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.drcost) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --This card gains 600 ATK for each monster that was banished face-up local e2a=Effect.CreateEffect(c) e2a:SetDescription(aux.Stringid(id,1)) e2a:SetCategory(CATEGORY_ATKCHANGE) e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2a:SetCode(EVENT_CUSTOM+id) e2a:SetRange(LOCATION_MZONE) e2a:SetOperation(s.atkop) c:RegisterEffect(e2a) --Keep track of the number of banished monsters and raise the custom event using that number as the event value local e2b=Effect.CreateEffect(c) e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2b:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2b:SetCode(EVENT_REMOVE) e2b:SetRange(LOCATION_MZONE) e2b:SetOperation(s.regop) c:RegisterEffect(e2b) --Special Summon 1 of your banished "Marincess" monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCost(s.spcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_MARINCESS} function s.drcostfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsFaceup() and c:IsAbleToRemoveAsCost() end function s.drcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.drcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.drcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --This card gains 600 ATK for each, until the end of this turn c:UpdateAttack(ev*600,RESETS_STANDARD_DISABLE_PHASE_END) end end function s.atkconfilter(c) return c:IsMonster() and c:IsFaceup() and (c:IsPreviousLocation(LOCATION_MZONE) or not c:IsPreviousLocation(LOCATION_ONFIELD)) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local ct=eg:FilterCount(s.atkconfilter,nil) if ct>0 then Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,re,r,rp,ep,ct) end end function s.spcostfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToGraveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MARINCESS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsFaceup() 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_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp,chk) 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_REMOVED,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 Normal Summon 1 "Battlin' Boxer" monster in addition to your Normal Summon/Set. (You can only gain this effect once per turn.) When an opponent's monster declares an attack, while you control a Warrior or FIRE monster: You can Special Summon this card from your hand, and if you do, negate that attack, then banish 1 monster on the field until the End Phase. You can only use this effect of "Battlin' Boxer Chief Second" once per turn.
--BK チーフセコンド --Battlin' Boxer Chief Second --Scripted by Satella local s,id=GetID() function s.initial_effect(c) --Special Summon itself from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Extra Normal Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_BATTLIN_BOXER)) c:RegisterEffect(e2) end s.listed_series={SET_BATTLIN_BOXER} function s.cfilter(c) return (c:IsAttribute(ATTRIBUTE_FIRE) or c:IsRace(RACE_WARRIOR)) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsPlayerCanRemove(tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,PLAYER_ALL,LOCATION_MZONE) 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 and Duel.NegateAttack() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) if #g==0 then return end Duel.HintSelection(g,true) Duel.BreakEffect() aux.RemoveUntil(g,nil,REASON_EFFECT,PHASE_END,id,e,tp,aux.DefaultFieldReturnOp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent to the Graveyard for the Synchro Summon of a Spellcaster-Type monster, you can select and add 1 Field Spell Card from your Graveyard to your hand.
--マジドッグ --Magidog local s,id=GetID() function s.initial_effect(c) --draw 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_BE_MATERIAL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO and e:GetHandler():GetReasonCard():IsRace(RACE_SPELLCASTER) end function s.filter(c) return c:IsType(TYPE_FIELD) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The ATK of this card becomes twice the original ATK of 1 monster that you Tributed for the Tribute Summon of this card.
--偉大魔獣 ガーゼット --Great Maju Garzett local s,id=GetID() function s.initial_effect(c) --tribute check local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MATERIAL_CHECK) e1:SetValue(s.valcheck) c:RegisterEffect(e1) --give atk effect only when summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SUMMON_COST) e2:SetOperation(s.facechk) e2:SetLabelObject(e1) c:RegisterEffect(e2) end function s.valcheck(e,c) local tc=c:GetMaterial():GetFirst() local atk=0 if tc then atk=tc:GetTextAttack()*2 end if atk<0 then atk=0 end if e:GetLabel()==1 then e:SetLabel(0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) c:RegisterEffect(e1) end end function s.facechk(e,tp,eg,ep,ev,re,r,rp) e:GetLabelObject():SetLabel(1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3+ "Gouki" monsters Cannot be destroyed by battle, and is unaffected by the activated effects of your opponent's monsters with ATK less than or equal to this card. When your opponent activates a card or effect that targets this card, and/or a monster(s) this card points to (Quick Effect): You can make this card lose exactly 500 ATK, and if you do, negate the activation. Once per turn, if this card's current ATK is different from its original ATK (Quick Effect): You can make this card gain 1000 ATK until the end of this turn.
--剛鬼ザ・ジャイアント・オーガ --Gouki The Giant Ogre local s,id=GetID() function s.initial_effect(c) --Link Summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GOUKI),3) c:EnableReviveLimit() --Prevent destruction by battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --Unaffected by activated effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.immval) c:RegisterEffect(e2) --Negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_NEGATE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.negcon) e3:SetTarget(s.negtg) e3:SetOperation(s.negop) c:RegisterEffect(e3) --Increase ATK local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_ATKCHANGE) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.atkcon) e4:SetOperation(s.atkop) c:RegisterEffect(e4) end s.listed_series={SET_GOUKI} function s.immval(e,te) return te:GetOwner()~=e:GetHandler() and te:IsMonsterEffect() and e:GetHandlerPlayer() ~= te:GetHandlerPlayer() and te:GetOwner():GetAttack()<=e:GetHandler():GetAttack() and te:IsActivated() end function s.negfilter(c,g) return g:IsContains(c) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end if rp==tp or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local lg=e:GetHandler():GetLinkedGroup() lg:AddCard(c) local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and lg:IsExists(s.negfilter,1,nil,tg) and Duel.IsChainNegatable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if not c:IsFaceup() or c:GetAttack()<500 or not c:IsRelateToEffect(e) or Duel.GetCurrentChain()~=ev+1 or c:IsStatus(STATUS_BATTLE_DESTROYED) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-500) c:RegisterEffect(e1) if not c:IsImmuneToEffect(e1) and not c:IsHasEffect(EFFECT_REVERSE_UPDATE) then if Duel.NegateActivation(ev) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetAttack()~=c:GetBaseAttack() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Choose 1 monster your opponent controls, and your opponent chooses 1 of these effects to apply. ● They must send the chosen monster to the GY. ● They must send all other monsters they control to the GY. Your opponent must control 3 or more monsters for you to activate and resolve this effect. * The above text is unofficial and describes the card's functionality in the OCG.
--転轍地点 --Switch Point --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Send monster(s) to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e1:SetCondition(s.tgcon) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>=3 end function s.tgfilter(c,p) return Duel.IsPlayerCanSendtoGrave(p,c) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,0,LOCATION_MZONE,1,nil,1-tp) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_MZONE) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) if #g<3 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT) local tc=g:Select(tp,1,1,nil):GetFirst() if not tc then return end Duel.HintSelection(tc,true) g:RemoveCard(tc) local b1=Duel.IsPlayerCanSendtoGrave(1-tp,tc) local b2=g:IsExists(s.tgfilter,1,nil,1-tp) local op=Duel.SelectEffect(1-tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) if op then Duel.SendtoGrave(op==1 and tc or g,REASON_RULE,PLAYER_NONE,1-tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Neither player can Special Summon monsters, except FIRE monsters.
--業火の結界像 --Barrier Statue of the Inferno local s,id=GetID() function s.initial_effect(c) --disable spsummon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,1) e1:SetTarget(s.sumlimit) c:RegisterEffect(e1) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp) return c:GetAttribute()~=ATTRIBUTE_FIRE end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Chaos Form". This card's name becomes "Dark Magician" while on the field or in the GY. Once per turn, when a Spell/Trap Card or effect is activated (Quick Effect): You can target 1 card on the field; destroy it. If this Ritual Summoned card is destroyed by battle or card effect: You can Special Summon 1 "Chaos" or "Black Luster Soldier" Ritual Monster from your hand, except "Magician of Chaos", ignoring its Summoning conditions.
--マジシャン・オブ・カオス --Magician of Chaos --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --change name local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e1:SetValue(CARD_DARK_MAGICIAN) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_DESTROYED) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_CHAOS} s.listed_names={21082832,CARD_DARK_MAGICIAN} function s.descon(e,tp,eg,ep,ev,re,r,rp) return re:IsSpellTrapEffect() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRitualSummoned() and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_CHAOS) and c:IsRitualMonster() and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Select 1 "Morphtronic" Spell or Trap Card in your Graveyard and add it to your hand.
--ガジェット・アームズ --Gadget Arms local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_MORPHTRONIC} function s.filter(c) return c:IsSetCard(SET_MORPHTRONIC) and c:IsSpellTrap() 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.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 Warrior monsters Once per turn, when a Level 4 or lower monster(s) is Special Summoned to your opponent's field (except during the Damage Step): You can detach 1 material from this card; destroy that Special Summoned monster(s).
--H-C ガーンデーヴァ --Heroic Champion - Gandiva local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_WARRIOR),4,2) c:EnableReviveLimit() --destroy 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:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsFaceup() and c:IsControler(1-tp) and c:IsLevelBelow(4) 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) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,#eg,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.filter,nil,e,tp) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a monster(s) is Special Summoned, place 1 Summon Counter on this card (max. 6). This card with 6 Summon Counters cannot be destroyed by card effects. At the start of each Main Phase 1, if this card has 6 Summon Counters: The turn player can activate this effect; they send this card to the GY, and if they do, they send all Special Summoned monsters their opponent controls to the GY.
--サモンオーバー --Summon Over --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x148) c:SetCounterLimit(0x148,6) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --add counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(LOCATION_FZONE) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetOperation(s.ctop) c:RegisterEffect(e2) --indes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_FZONE) e3:SetCondition(s.incon) e3:SetValue(1) c:RegisterEffect(e3) --check local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EVENT_PHASE_START|PHASE_MAIN1) e4:SetRange(LOCATION_FZONE) e4:SetOperation(s.chkop) c:RegisterEffect(e4) --to gy local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_TOGRAVE) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetProperty(EFFECT_FLAG_BOTH_SIDE) e5:SetRange(LOCATION_FZONE) e5:SetCondition(s.gycon) e5:SetTarget(s.gytg) e5:SetOperation(s.gyop) c:RegisterEffect(e5) end s.counter_place_list={0x148} function s.ctop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():AddCounter(0x148,1) end function s.incon(e) return e:GetHandler():GetCounter(0x148)==6 end function s.chkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetCounter(0x148)==6 then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1,0,aux.Stringid(id,0)) end end function s.gycon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)~=0 end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsSummonType,tp,0,LOCATION_MZONE,nil,SUMMON_TYPE_SPECIAL) local c=e:GetHandler() if chk==0 then return c:IsAbleToGrave() and #g>0 end g:AddCard(c) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,#g,0,0) end function s.gyop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(Card.IsSummonType,tp,0,LOCATION_MZONE,nil,SUMMON_TYPE_SPECIAL) if c:IsRelateToEffect(e) and #g>0 and Duel.SendtoGrave(c,REASON_EFFECT)>0 and c:IsLocation(LOCATION_GRAVE) then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Link Monster is on the field or in either GY, you can Special Summon this card (from your hand). You can only Special Summon "EM:P Meowmine" once per turn this way. If a Link-2 monster you control is sent to the GY or banished face-up (except during the Damage Step): You can banish this card from your GY (if it was there when the monster was sent or banished) or hand (even if not), then target 1 card your opponent controls; return it to the hand. You can only use this effect of "EM:P Meowmine" once per turn.
--EM:Pグレニャード --EM:P Meowmine --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Return an opponent's card to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_GRAVE|LOCATION_HAND) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.rthcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.rthtg) e2:SetOperation(s.rthop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_REMOVE) c:RegisterEffect(e3) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(Card.IsLinkMonster,0,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end function s.cfilter(c,tp) return c:IsLinkMonster() and c:IsLink(2) and c:IsFaceup() and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) end function s.rthcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) and ((c:IsLocation(LOCATION_GRAVE) and not eg:IsContains(c)) or c:IsLocation(LOCATION_HAND)) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.rthop(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:
This card cannot be activated from your hand. Activate only when a face-up monster you control is selected as an attack target. Inflict 1000 damage to your opponent.
--蜃気楼の筒 --Mirage Tube local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsLocation(LOCATION_HAND) and eg:GetFirst():IsControler(tp) and eg:GetFirst():IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Standby Phase: You can have all "HERO" monsters you control gain 400 ATK (even if this card leaves the field). If a Level 8 or higher "Destiny HERO" monster(s) or a "Destiny End Dragoon" is Special Summoned to your field (except during the Damage Step): You can banish 1 card from your opponent's hand (random), field, or GY. If this card in the Spell & Trap Zone is destroyed by card effect: You can add 1 "Destiny HERO" monster from your Deck to your hand. You can only use each effect of "D - Tactics" once per turn.
--D-タクティクス --D - Tactics --Scripted by ahtelel 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) --Make all "HERO" monsters you control gain 400 ATK 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:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetHintTiming(TIMING_STANDBY_PHASE) e1:SetCondition(function() return Duel.IsPhase(PHASE_STANDBY) end) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Banish 1 card from your opponent's hand (random), field, or GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.rmcon) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --Add 1 "Destiny HERO" monster from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_HERO,SET_DESTINY_HERO} s.listed_names={76263644} --"Destiny End Dragoon" function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,0,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,400) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,0,nil) if #g==0 then return end local c=e:GetHandler() for sc in g:Iter() do --All "HERO" monsters you control gain 400 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(400) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) end end function s.rmconfilter(c,tp) return ((c:IsLevelAbove(8) and c:IsSetCard(SET_DESTINY_HERO)) or c:IsCode(76263644)) and c:IsControler(tp) and c:IsFaceup() end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.rmconfilter,1,nil,tp) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,1,nil) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_STZONE) end function s.thfilter(c) return c:IsSetCard(SET_DESTINY_HERO) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can discard 1 card; add 1 "Polymerization" Normal Spell or "Fusion" Normal Spell from your Deck to your hand. You can reveal 1 Fusion Monster in your Extra Deck; Special Summon 1 of the Fusion Materials mentioned on that monster from your GY, in face-down Defense Position. You can only use each effect of "Keeper of Dragon Magic" once per turn. You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate either of this card's effects.
--竜魔導の守護者 --Keeper of Dragon Magic --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Add 1 "Polymerization" Normal Spell or "Fusion" Normal Spell from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCost(Cost.AND(Cost.Discard(),s.cost)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon from your GY 1 of the Fusion Materials mentioned on a monster in the Extra Deck, in face-down Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCost(Cost.AND(s.spcost,s.cost)) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,function(c) return not (c:IsSummonLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)) end) end s.listed_series={SET_FUSION} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end --You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate either of this card's 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_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:IsSetCard(SET_FUSION) and c:IsNormalSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spcostfilter(c,e,tp) return c:IsType(TYPE_FUSION) and not c:IsPublic() and c.material and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,table.unpack(c.material)) end function s.spfilter(c,e,tp,...) return c:IsCode(...) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() Duel.ConfirmCards(1-tp,sc) Duel.ShuffleExtra(tp) e:SetLabel(table.unpack(sc.material)) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,e:GetLabel()) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard this card; add 2 Level 4 LIGHT Thunder-Type monsters of the same name with 1600 or less ATK from your Deck to your hand. You can only use the effect of "Thunder Sea Horse" once per turn. You cannot Special Summon during the turn you activate this effect.
--サンダー・シーホース --Thunder Sea Horse local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) 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) local c=e:GetHandler() if chk==0 then return Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 and c:IsDiscardable() end Duel.SendtoGrave(c,REASON_COST|REASON_DISCARD) --oath effects local e1=Effect.CreateEffect(c) 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) aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,1),nil) end function s.filter(c) return c:IsRace(RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsLevel(4) and c:IsAttackBelow(1600) and c:IsAbleToHand() end function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetCode)==1 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g<2 then return end local hg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_ATOHAND) if #hg==2 then Duel.SendtoHand(hg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,hg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Ritual Beast Tamer" monster + 1 "Spiritual Beast" monster Must be Special Summoned (from your Extra Deck) by banishing the above cards you control, and cannot be Special Summoned by other ways. (You do not use "Polymerization".) Once per turn: You can target 2 of your banished "Ritual Beast" cards; return them to the Graveyard, and if you do, add 1 "Ritual Beast" card from your Deck to your hand. During either player's turn: You can return this card you control to the Extra Deck, then target 2 of your banished monsters (1 "Ritual Beast Tamer" monster and 1 "Spiritual Beast" monster); Special Summon them in Defense Position.
--聖霊獣騎 カンナホーク --Ritual Beast Ulti-Cannahawk local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_RITUAL_BEAST_TAMER),aux.FilterBoolFunctionEx(Card.IsSetCard,SET_SPIRITUAL_BEAST)) Fusion.AddContactProc(c,s.contactfil,s.contactop,true) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetHintTiming(0,TIMING_END_PHASE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_RITUAL_BEAST,SET_RITUAL_BEAST_TAMER,SET_SPIRITUAL_BEAST} s.material_setcode={SET_RITUAL_BEAST,SET_RITUAL_BEAST_TAMER,SET_SPIRITUAL_BEAST} function s.contactfil(tp) return Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_MZONE,0,nil) end function s.contactop(g) Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_MATERIAL) end function s.tgfilter(c) return c:IsFaceup() and c:IsSetCard(SET_RITUAL_BEAST) end function s.thfilter(c) return c:IsSetCard(SET_RITUAL_BEAST) and c:IsAbleToHand() end function s.thtg(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,2,nil) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_REMOVED,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,2,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT|REASON_RETURN) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToExtraAsCost() end Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKTOP,REASON_COST) end function s.filter1(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_RITUAL_BEAST_TAMER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and Duel.IsExistingTarget(s.filter2,tp,LOCATION_REMOVED,0,1,c,e,tp) end function s.filter2(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_SPIRITUAL_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingTarget(s.filter1,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectTarget(tp,s.filter2,tp,LOCATION_REMOVED,0,1,1,g1:GetFirst(),e,tp) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g1,2,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=Duel.GetTargetCards(e) if #g==0 then return end if #g<=ft then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,ft,ft,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE) g:Sub(sg) Duel.SendtoGrave(g,REASON_RULE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 4 or lower Cyberse monster If this card is Special Summoned: For the rest of this turn, you cannot Link Summon Link-3 or higher Link Monsters. If this co-linked card is Tributed: You can Special Summon 2 "Link Tokens" (Cyberse/LIGHT/Level 1/ATK 0/DEF 0). You can only use this effect of "Link Devotee" once per turn.
--リンク・ディヴォーティー --Link Devotee --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --link summon c:EnableReviveLimit() Link.AddProcedure(c,s.matfilter,1,1) --splimit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetOperation(s.ls) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_RELEASE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_LEAVE_FIELD_P) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_IGNORE_IMMUNE) e3:SetLabelObject(e2) e3:SetOperation(s.chk) c:RegisterEffect(e3) end s.listed_names={TOKEN_LINK} function s.chk(e,tp,eg,ep,ev,re,r,rp) e:GetLabelObject():SetLabel(e:GetHandler():GetMutualLinkedGroupCount()) end function s.matfilter(c,lc,sumtype,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_CYBERSE,lc,sumtype,tp) end function s.ls(e,tp,eg,ep,ev,re,r,rp,c) --cannot link summon local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,tp,sumtp,sumpos) return c:IsLinkMonster() and c:GetLink()>=3 and (sumtp&SUMMON_TYPE_LINK)==SUMMON_TYPE_LINK end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabel()>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_LINK,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_LIGHT) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or not Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_LINK,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_LIGHT) then return end for i=1,2 do local token=Duel.CreateToken(tp,TOKEN_LINK) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Set this card from your hand to your Spell & Trap Zone as a Spell Card. During your opponent's turn, if this Set card in the Spell & Trap Zone is destroyed and sent to your Graveyard: Special Summon it. If this card is Special Summoned during your opponent's turn: You can target 1 "Artifact" monster in your Graveyard; Set that target in your Spell & Trap Zone as a Spell Card.
--アーティファクト-フェイルノート --Artifact Failnaught local s,id=GetID() function s.initial_effect(c) --set local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MONSTER_SSET) e1:SetValue(TYPE_SPELL) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --sset local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e3:SetCondition(s.setcon) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) end s.listed_series={SET_ARTIFACT} function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_SZONE) and c:IsPreviousPosition(POS_FACEDOWN) and c:IsReason(REASON_DESTROY) and Duel.GetTurnPlayer()~=tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) 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) end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.filter(c) return c:IsSetCard(SET_ARTIFACT) and c:IsMonster() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSSetable() then Duel.SSet(tp,tc) end end