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:
When this card is Normal Summoned: You can add 1 "Destruction Sword" card from your Deck to your hand, except "Buster Whelp of the Destruction Swordsman". You can only use 1 of the following effects of "Buster Whelp of the Destruction Swordsman" per turn, and only once that turn. ● You can Tribute this card; Special Summon 1 "Buster Blader" from your hand or Graveyard. ● If this card is in your Graveyard and you control "Buster Blader": You can discard 1 "Destruction Sword" card; Special Summon this card.
--破壊剣士の伴竜 --Buster Whelp of the Destruction Swordsman local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) 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) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) 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_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,id) e3:SetCondition(s.spcon2) e3:SetCost(Cost.SelfTribute2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end s.listed_series={SET_DESTRUCTION_SWORD} s.listed_names={CARD_BUSTER_BLADER} function s.filter(c) return c:IsSetCard(SET_DESTRUCTION_SWORD) 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 end function s.spfilter(c,e,tp) return c:IsCode(CARD_BUSTER_BLADER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.cfilter(c) return c:IsFaceup() and c:IsCode(CARD_BUSTER_BLADER) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.costfilter(c) return c:IsSetCard(SET_DESTRUCTION_SWORD) and c:IsAbleToGraveAsCost() end function Cost.SelfTribute2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.costfilter,1,1,REASON_COST) 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 function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can activate "Assault Mode Activate" the turn it is Set.
--黒翼の魔術師 --Night Wing Sorceress local s,id=GetID() function s.initial_effect(c) --Trap activate in set turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_SZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsCode,CARD_ASSAULT_MODE)) e1:SetDescription(aux.Stringid(id,0)) c:RegisterEffect(e1) end s.listed_names={CARD_ASSAULT_MODE}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when your opponent declares a direct attack while you control no monsters. Negate that attack and Special Summon 1 "Morphtronic" monster from your hand.
--D・スクランブル --Morphtronics, Scramble! local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_MORPHTRONIC} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.filter(c,e,tp) return c:IsSetCard(SET_MORPHTRONIC) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateAttack() and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) 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:
Each time an opponent's monster declares a direct attack: 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. During your Draw Phase, instead of conducting your normal draw: Excavate the top card of your Deck, and if it is a Plant-Type monster, send it to the Graveyard. Otherwise, add it to your hand.
--森羅の滝滑り --Sylvan Waterslide 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) --Excavate the top card of your Deck when the opponent attacks directly local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DECKDES) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.condition) e2:SetTarget(s.target2) e2:SetOperation(s.operation) e2:SetLabel(1) c:RegisterEffect(e2) --Replace your normal draw local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DECKDES+CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PREDRAW) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.cfcon) e3:SetTarget(s.cftg) e3:SetOperation(s.cfop) c:RegisterEffect(e3) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.target2(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 e:GetLabel()==0 or not e:GetHandler():IsRelateToEffect(e) then return end 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(tc,REASON_EFFECT+REASON_EXCAVATE) else Duel.MoveSequence(tc,1) end end function s.cfcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetDrawCount(tp)>0 end function s.cftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.cfop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)==0 then return end _replace_count=_replace_count+1 if _replace_count<=_replace_max then Duel.ConfirmDecktop(tp,1) local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() Duel.DisableShuffleCheck() if tc:IsRace(RACE_PLANT) then Duel.SendtoGrave(tc,REASON_EFFECT|REASON_EXCAVATE) else Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ShuffleHand(tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Cyberse monsters All Link Monsters you control gain 800 ATK. You can only control 1 "Flame Administrator".
--フレイム・アドミニスター --Flame Administrator --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:SetUniqueOnField(1,0,id) Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2,2) --atk up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_LINK)) e1:SetValue(800) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters, including a LIGHT Fiend monster During your Main Phase: You can Fusion Summon 1 Fiend Fusion Monster from your Extra Deck, by shuffling its materials from your GY into the Deck. You can target 1 LIGHT non-Link Fiend monster you control; equip this card from your field or GY to that monster you control as an Equip Spell with the following effect. ● Your opponent cannot target the equipped monster with card effects. You can only use each effect of "Fiendsmith's Sequence" once per turn.
--刻まれし魔の大聖棺 --Fiendsmith's Sequence --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,nil,2,2,s.lcheck) --Fusion Summon 1 Fiend Fusion Monster by shuffling its materials from your GY into the Deck local params={fusfilter=aux.FilterBoolFunction(Card.IsRace,RACE_FIEND), matfilter=aux.FALSE, extrafil=s.fextra, extratg=s.extratg, extraop=Fusion.ShuffleMaterial} local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(Fusion.SummonEffTG(params)) e1:SetOperation(Fusion.SummonEffOP(params)) c:RegisterEffect(e1) --Equip this card to 1 non-Link LIGHT Fiend monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) end function s.matfilter(c,lc,sumtype,tp) return c:IsAttribute(ATTRIBUTE_LIGHT,lc,sumtype,tp) and c:IsRace(RACE_FIEND,lc,sumtype,tp) end function s.lcheck(g,lc,sumtype,tp) return g:IsExists(s.matfilter,1,nil,lc,sumtype,tp) end function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(aux.NecroValleyFilter(Fusion.IsMonsterFilter(Card.IsAbleToDeck)),tp,LOCATION_GRAVE,0,nil) end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) end function s.eqfilter(c) return not c:IsLinkMonster() and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FIEND) and c:IsFaceup() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,tp,0) if c:IsLocation(LOCATION_GRAVE) then Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0) end end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsControler(tp) and Duel.Equip(tp,c,tc) then --Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetValue(function(e,c) return c==tc end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) --Your opponent cannot target the equipped monster with card effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetValue(aux.tgoval) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) elseif c:IsLocation(LOCATION_MZONE) then Duel.SendtoGrave(c,REASON_RULE,nil,PLAYER_NONE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Warrior Dai Grepher" + "Spirit Ryu" A Fusion Summon of this card can only be done with the above Fusion Materials. When a Normal Trap Card is activated (Quick Effect): You can pay 1000 LP; negate that effect. This card must be face-up on the field to activate and to resolve this effect. Negate the effects of any Spell Card that targets this card and destroy it.
--ドラゴン・ウォリアー --Ryu Senshi local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,false,false,75953262,67957315) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.discon) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --disable effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.disop2) c:RegisterEffect(e2) --disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e3:SetTarget(s.distg2) c:RegisterEffect(e3) --self destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_SELF_DESTROY) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e4:SetTarget(s.distg2) c:RegisterEffect(e4) aux.DoubleSnareValidity(c,LOCATION_MZONE) end function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_BATTLE_DESTROYED) then return false end return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetActiveType()==TYPE_TRAP and Duel.IsChainDisablable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp,chk) Duel.NegateEffect(ev) end function s.disop2(e,tp,eg,ep,ev,re,r,rp) if re:IsSpellEffect() and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if g and g:IsContains(e:GetHandler()) then if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end end end end function s.distg2(e,c) return c:GetCardTargetCount()>0 and c:IsSpell() and c:GetCardTarget():IsContains(e:GetHandler()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Special Summons a monster (except during the Damage Step): You can Special Summon this card from your hand. 2 of your Monster Card Zones cannot be used.
--ファントム・ドラゴン --Phantom Dragon local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_USE_EXTRA_MZONE) e2:SetValue(2) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 "Ritual Beast" card from your Deck, face-up. During your second Standby Phase after this effect's activation, add the card banished by this effect to your hand. You can only Special Summon "Spiritual Beast Cannahawk(s)" once per turn.
--精霊獣 カンナホーク --Spiritual Beast Cannahawk local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --tohand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_RITUAL_BEAST} function s.filter(c) return c:IsSetCard(SET_RITUAL_BEAST) and c:IsAbleToRemove() 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_REMOVE,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetRange(LOCATION_REMOVED) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,2) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetLabel(0) tc:RegisterEffect(e1) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local ct=e:GetLabel() e:GetHandler():SetTurnCounter(ct+1) if ct==1 then Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,e:GetHandler()) else e:SetLabel(1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 3 Fairy monsters from your hand and/or field; Set 1 Continuous Spell from your Deck, but send it to the GY during your opponent's End Phase. If this card is sent to the GY by card effect: You can Special Summon this card, but banish it when it leaves the field. You can only use each effect of "Hrimnir the Divine Follower" once per turn.
--久遠の神徒フリムニル --Hrimnir the Divine Follower --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Set 1 Continuous Spell from your Deck, but send it to the GY during your opponent's End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.setcost) e1:SetTarget(s.settg) e1:SetOperation(s.setop) c:RegisterEffect(e1) --Special Summon this card, but banish it when it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsReason(REASON_EFFECT) end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsRace,3,true,nil,nil,RACE_FAIRY) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsRace,3,3,true,nil,nil,RACE_FAIRY) Duel.Release(g,REASON_COST) end function s.setfilter(c) return c:IsContinuousSpell() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_STZONE) end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sc=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if sc and Duel.SSet(tp,sc)>0 then --Send it to the GY during your opponent's End Phase aux.DelayedOperation(sc,PHASE_END,id,e,tp, function(dg) Duel.SendtoGrave(dg,REASON_EFFECT) end, function() return Duel.IsTurnPlayer(1-tp) end, 0,1,aux.Stringid(id,2) ) 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,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it when it leaves the field 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a Counter Trap Card is activated, immediately after it resolves, gain 1000 LP, and if you do, if "The Sanctuary in the Sky" is on the field, destroy 1 card your opponent controls.
--天空聖者メルティウス --Meltiel, Sage of the Sky local s,id=GetID() function s.initial_effect(c) --recover&destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.drop) c:RegisterEffect(e1) end s.listed_names={CARD_SANCTUARY_SKY} function s.drop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsActiveType(TYPE_COUNTER) or not c:IsLocation(LOCATION_MZONE) or not c:IsFaceup() then return end Duel.Recover(tp,1000,REASON_EFFECT) if not Duel.IsEnvironment(CARD_SANCTUARY_SKY) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can add 1 "Symphonic Warrior" monster from your Deck to your hand, except "Symphonic Warrior Synthess". Once per turn: You can target 1 monster you control or in your Graveyard whose original name includes "Symphonic Warrior", except "Symphonic Warrior Synthess"; until the End Phase, this card's name becomes that monster's original name, and replace this effect with that monster's original effects. You can banish this card from your Graveyard, then target 1 of your banished "Symphonic Warrior" monsters, except "Symphonic Warrior Synthess"; Special Summon it.
--音響戦士サイザス --Symphonic Warrior Synthess local s,id=GetID() function s.initial_effect(c) --Search 1 "Symphonic Warrior" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Copy the name & effects of a "Symphonic Warrior" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.cptg) e2:SetOperation(s.cpop) c:RegisterEffect(e2) --Special Summon 1 banished "Symphonic Warrior" local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_GRAVE) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_SYMPHONIC_WARRIOR} s.listed_names={id} function s.thfilter(c) return c:IsSetCard(SET_SYMPHONIC_WARRIOR) and not c:IsCode(id) 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 function s.cpfilter(c) return c:IsFaceup() and c:IsMonster() and c:IsOriginalSetCard(SET_SYMPHONIC_WARRIOR) and not c:IsOriginalCode(id) end function s.cptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.cpfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.cpfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.cpfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) end function s.cpop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsFaceup() then local code=tc:GetOriginalCodeRule() --Copy original name & effects 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) c:CopyEffect(code,RESETS_STANDARD_PHASE_END,1) end end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_SYMPHONIC_WARRIOR) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,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:
When this card is Normal Summoned: You can make this card gain 100 ATK for each Monster Type currently in your GY, until the end of this turn. You can target 1 other face-up monster on the field; this card cannot attack for the rest of this turn, also that monster loses DEF equal to this card's ATK, then if its DEF becomes 0 by this effect, destroy it. You can only use this effect of "Leraje the God of Archery" once per turn.
--弓神レライエ --Leraje the God of Archery --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Increase ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Decrease DEF and destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(Card.IsMonster,tp,LOCATION_GRAVE,0,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup()) then return end local ct=Duel.GetMatchingGroup(Card.IsMonster,tp,LOCATION_GRAVE,0,nil):GetClassCount(Card.GetRace) if ct==0 then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(100*ct) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end function s.desfilter(c) return c:IsFaceup() and c:IsDefenseAbove(0) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.desfilter(chkc) and chkc~=c end if chk==0 then return c:GetAttack()>0 and Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Cannot attack for the rest of the turn local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local def=tc:GetDefense() --Decrease DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetValue(-c:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) if def~=0 and tc:IsDefense(0) then Duel.BreakEffect() Duel.Destroy(tc,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Level/Rank 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Pixies" once per turn this way. During damage calculation, if another Level/Rank/Link 2 monster you control battles an opponent's monster (Quick Effect): You can send this card from your hand or field to the GY; that monster you control gains ATK/DEF equal to the opponent's monster's ATK, until the end of this turn. You can only use this effect of "Spright Pixies" once per turn.
--スプライト・ピクシーズ --Spright Pixies --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Boost ATK/DEF of battling monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_HAND|LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.atkcon) e2:SetCost(Cost.SelfToGrave) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.spconfilter(c) return c:IsFaceup() and (c:IsLevel(2) or c:IsRank(2)) end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local a,d=Duel.GetBattleMonster(tp) return a and d and a:IsFaceup() and d:IsFaceup() and a~=e:GetHandler() and (a:IsLevel(2) or a:IsRank(2) or a:IsLink(2)) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local a,d=Duel.GetBattleMonster(tp) if a and d and a:IsRelateToBattle() and a:IsFaceup() and d:IsRelateToBattle() and d:IsFaceup() and d:IsControler(1-tp) then --Increase ATK/DEF local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(d:GetAttack()) e1:SetReset(RESETS_STANDARD_PHASE_END) a:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) a:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by discarding 1 WATER monster. You can only Special Summon "White Stingray" once per turn this way. If this card is Special Summoned from the GY: You can treat it as a Tuner this turn. You can only use this effect of "White Stingray" once per turn.
--白棘鱏 --White Stingray local s,id=GetID() function s.initial_effect(c) --Special Summon procedure 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) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Treat this card as a Tuner local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsSummonLocation(LOCATION_GRAVE) end) e2:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsType(TYPE_TUNER) end end) e2:SetOperation(s.tnop) c:RegisterEffect(e2) end s.self_tuner=true function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsDiscardable() end function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,c) 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.cfilter,tp,LOCATION_HAND,0,c) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,nil,1,tp,HINTMSG_DISCARD,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_DISCARD|REASON_COST) g:DeleteGroup() end function s.tnop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --Treated as a Tuner local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetValue(TYPE_TUNER) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as a "F.A." card.) Target 1 "U.A." or "F.A." monster you control or in your GY; add it to the hand, and if you do, you gain 500 LP, then you can apply this effect. ● Reveal any number of "U.A." and/or "F.A." monsters in your hand, shuffle them into the Deck, then draw cards equal to the number of shuffled cards. You can only activate 1 "U.A. Locker Room" per turn.
--U.A.ロッカールーム --U.A. Locker Room --scripted by Naim local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_RECOVER+CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_names={id} s.listed_series={SET_FA,SET_UA} function s.thfilter(c) return c:IsAbleToHand() and c:IsMonster() and (c:IsSetCard(SET_FA) or c:IsSetCard(SET_UA)) and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500) end function s.tdfilter(c) return c:IsAbleToDeck() and c:IsMonster() and not c:IsPublic() and c:IsSetCard({SET_FA,SET_UA}) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)==1 then if Duel.Recover(tp,500,REASON_EFFECT)==500 then if Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_HAND,0,1,nil) and Duel.IsPlayerCanDraw(tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_HAND,0,1,99,nil) if #g>0 then Duel.ConfirmCards(1-tp,g) local ct=Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) Duel.ShuffleDeck(tp) Duel.BreakEffect() Duel.Draw(tp,ct,REASON_EFFECT) end end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control 2 or more Spellcaster monsters: Change 1 Attack Position monster your opponent controls to Defense Position, then take control of it, and if you do, it cannot be destroyed by battle.
--奇跡のマジック・ゲート --Magic Gate of Miracles --Updated by Larry126 local s,id=GetID() function s.initial_effect(c) --Change 1 of opponent's attack positions to defense position, then take control of it local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_CONTROL+CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),tp,LOCATION_MZONE,0,2,nil) end function s.filter(c) return c:IsControlerCanBeChanged() and c:IsAttackPos() and c:IsCanChangePosition() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,1-tp,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_CONTROL,nil,1,1-tp,LOCATION_MZONE) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectMatchingCard(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) if #g>0 and Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE)>0 then Duel.BreakEffect() if Duel.GetControl(g,tp) then --Cannot be destroyed by battle local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3000) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) g:GetFirst():RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 face-up monster on the field; discard 1 card, and if you do, increase that target's Level by 1. You can target 1 face-up monster on the field; monsters you control cannot attack for the rest of this turn, except Zombie monsters, also send 1 Zombie monster from your Deck to the GY, and if you do, increase that target's Level by 1. You can only use each effect of "Uni-Zombie" once per turn.
--ユニゾンビ --Uni-Zombie local s,id=GetID() function s.initial_effect(c) --level local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id) e1:SetCost(s.lvcost) e1:SetTarget(s.lvtg1) e1:SetOperation(s.lvop1) c:RegisterEffect(e1) --level local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.lvcost) e2:SetTarget(s.lvtg2) e2:SetOperation(s.lvop2) c:RegisterEffect(e2) end function s.lvcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) end function s.filter(c) return c:IsFaceup() and c:HasLevel() and c:GetLevel()~=0 end function s.lvtg1(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.GetFieldGroupCount(tp,LOCATION_HAND,0)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) end function s.lvop1(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT|REASON_DISCARD)==0 then return end local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end function s.tgfilter(c) return c:IsRace(RACE_ZOMBIE) and c:IsAbleToGrave() end function s.lvtg2(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) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.lvop2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g==0 or Duel.SendtoGrave(g,REASON_EFFECT)==0 then return end local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and g:GetFirst():IsLocation(LOCATION_GRAVE) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_ATTACK) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.atktg) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) local e3=Effect.CreateEffect(e:GetHandler()) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e3:SetDescription(aux.Stringid(id,2)) e3:SetReset(RESET_PHASE|PHASE_END) e3:SetTargetRange(1,0) Duel.RegisterEffect(e3,tp) end function s.atktg(e,c) return not c:IsRace(RACE_ZOMBIE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(Quick Effect): You can target 1 face-up monster you control; send 1 other Plant monster you control to the GY, and if you do, the next time the targeted monster would be destroyed by battle or card effect this turn, it is not destroyed. If this card is sent to the GY by a card effect: You can send 1 Level 5 or lower Plant monster from your Deck or Extra Deck to the GY. You can only use each effect of "Staysailor Romarin" once per turn.
--ステイセイラ・ロマリン --Staysailor Romarin --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Prevent destruction local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Send 1 Plant monster from Deck/ED to GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.grcon) e2:SetTarget(s.grtg) e2:SetOperation(s.grop) c:RegisterEffect(e2) end function s.trgtfilter(c,tp) return c:IsFaceup() and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_MZONE,0,1,c) end function s.tgfilter(c) return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(s.trgtfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.trgtfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_MZONE) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,tc) if #g>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_GRAVE) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCountLimit(1) e1:SetValue(s.indval) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1,true) end end end function s.indval(e,re,r,rp) return (r&REASON_BATTLE+REASON_EFFECT)~=0 end function s.grcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end function s.grfilter(c) return c:IsLevelBelow(5) and c:HasLevel() and c:IsRace(RACE_PLANT) and c:IsAbleToGrave() end function s.grtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.grfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.grop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.grfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand: You can target 1 "Virtual World" card you control; send 1 "Virtual World" card of a different type (Monster, Spell, Trap) from your Deck to the GY, and if you do, Special Summon this card, then, you can send 1 "Virtual World" card of the third type from your Deck to the GY, except "Virtual World Kirin - Lili". For the rest of this turn, you can only Special Summon Level/Rank 3 or higher monsters. You can only use this effect of "Virtual World Kirin - Lili" once per turn.
--電脳堺麟-麟々 --Virtual World Kirin - Lili --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_VIRTUAL_WORLD} s.listed_names={id} local key=TYPE_MONSTER+TYPE_SPELL+TYPE_TRAP function s.tgtfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_VIRTUAL_WORLD) and Duel.IsExistingMatchingCard(s.tgvfilter,tp,LOCATION_DECK,0,1,nil,c:GetType()&key) end function s.tgvfilter(c,type1) return c:IsAbleToGrave() and c:IsSetCard(SET_VIRTUAL_WORLD) and not c:IsType(type1) end function s.tgvfilter2(c,type1,type2) return c:IsAbleToGrave() and c:IsSetCard(SET_VIRTUAL_WORLD) and not c:IsType(type1) and not c:IsType(type2) and not c:IsCode(id) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) and s.tgtfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.tgtfilter,tp,LOCATION_ONFIELD,0,1,nil,tp) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.tgtfilter,tp,LOCATION_ONFIELD,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,LOCATION_HAND) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Register Special Summon Limit local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e0:SetTargetRange(1,0) e0:SetTarget(s.splimit) e0:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e0,tp) aux.RegisterClientHint(c,EFFECT_FLAG_OATH,tp,1,0,aux.Stringid(id,1),nil) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tg=Duel.SelectMatchingCard(tp,s.tgvfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetType()&key) if #tg>0 and Duel.SendtoGrave(tg,REASON_EFFECT)>0 then local ogc=Duel.GetOperatedGroup():GetFirst() if ogc:IsLocation(LOCATION_GRAVE) and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local tg1=tg:GetFirst() if Duel.IsExistingMatchingCard(s.tgvfilter2,tp,LOCATION_DECK,0,1,nil,tc:GetType()&key,tg1:GetType()&key) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tg2=Duel.SelectMatchingCard(tp,s.tgvfilter2,tp,LOCATION_DECK,0,1,1,nil,tc:GetType()&key,tg1:GetType()&key) if #tg2>0 then Duel.BreakEffect() Duel.SendtoGrave(tg2,REASON_EFFECT) end end end end end end function s.splimit(e,c) return not (c:IsLevelAbove(3) or c:IsRankAbove(3)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares a direct attack: You can Special Summon 1 "Graydle" monster from your Deck in Attack Position, if you control no monsters. When a "Graydle" monster you control declares a direct attack: You can target 1 monster in your opponent's Graveyard; Special Summon that target to their side of the field, if they control no monsters. You can only use each effect of "Graydle Parasite" once per turn.
--グレイドル・パラサイト --Graydle Parasite local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_ATTACK) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon1) e2:SetTarget(s.sptg1) e2:SetOperation(s.spop1) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_SZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end s.listed_series={SET_GRAYDLE} function s.spcon1(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.spfilter1(c,e,tp) return c:IsSetCard(SET_GRAYDLE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)~=0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) local c=Duel.GetAttacker() return c:IsControler(tp) and c:IsSetCard(SET_GRAYDLE) and Duel.GetAttackTarget()==nil end function s.spfilter2(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter2(chkc,e,tp) end if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)==0 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter2,tp,0,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter2,tp,0,LOCATION_GRAVE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)~=0 then return end if Duel.GetLocationCount(1-tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only during the End Phase. Gain 1000 Life Points for each Psychic-Type monster sent to the Graveyard this turn.
--超能力治療 --Supernatural Regeneration 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:SetHintTiming(TIMING_END_PHASE) e1:SetCondition(s.reccon) e1:SetTarget(s.rectg) e1:SetOperation(s.recop) c:RegisterEffect(e1) aux.GlobalCheck(s,function() s[0]=0 local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_TO_GRAVE) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) aux.AddValuesReset(function() s[0]=0 end) end) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) s[0]=s[0]+eg:FilterCount(Card.IsRace,nil,RACE_PSYCHIC) end function s.reccon(e,tp,eg,ep,ev,re,r,rp,chk) return Duel.IsPhase(PHASE_END) end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s[0]~=0 end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(s[0]*1000) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,s[0]*1000) end function s.recop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Recover(p,s[0]*1000,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Look at the top 3 cards of your Deck and return those cards to the top of the Deck in any order.
--コザッキーの研究成果 --Fruits of Kozaky's Studies local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>2 end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.SortDecktop(tp,tp,3) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 other card you control; excavate the top 3 cards of your Deck, and if you do, you can add 1 excavated "Sky Striker" card to your hand, also shuffle the rest into the Deck, then, if you excavated a "Sky Striker" card, send the targeted card to the GY. If this card in the Field Zone is sent to the GY by a card effect: You can Special Summon 1 "Sky Striker Ace" monster from your Deck. You can only use each effect of "Sky Striker Airspace - Area Zero" once per turn.
--閃刀空域-エリアゼロ --Sky Striker Airspace - Area Zero --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --excavate local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) 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_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_SKY_STRIKER_ACE,SET_SKY_STRIKER} function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,0,1,c) and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=3 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() Duel.ConfirmDecktop(tp,3) local g=Duel.GetDecktopGroup(tp,3) if #g>0 then local g1=g:Filter(Card.IsSetCard,nil,SET_SKY_STRIKER) if g:IsExists(Card.IsSetCard,1,nil,SET_SKY_STRIKER) then if g1:IsExists(Card.IsAbleToHand,1,nil) then if Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g1:FilterSelect(tp,Card.IsAbleToHand,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) end end end Duel.ShuffleDeck(tp) if g:IsExists(Card.IsSetCard,1,nil,SET_SKY_STRIKER) and tc:IsRelateToEffect(e) then Duel.BreakEffect() Duel.SendtoGrave(tc,REASON_EFFECT) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_FZONE) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SKY_STRIKER_ACE) 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,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can send 1 "Ice Barrier" monster from your hand to the GY; draw 1 card.
--氷結界の軍師 --Strategist of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCategory(CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(aux.IceBarrierDiscardCost(s.cfilter,false)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_ICE_BARRIER} function s.cfilter(c) return c:IsSetCard(SET_ICE_BARRIER) and c:IsMonster() end function s.target(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.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the turn a monster(s) in your possession was destroyed by card effect (Quick Effect): You can Special Summon this card from your hand. If this card is Normal or Special Summoned: You can Fusion Summon 1 "Memento" Fusion Monster from your Extra Deck, using monsters from your hand or field. If this card is destroyed by battle or card effect: You can send 1 "Memento" card from your Deck to the GY, except "Mementotlan Shleepy". You can only use each effect of "Mementotlan Shleepy" once per turn.
--メメント・スリーピィ --Mementotlan Shleepy --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e1:SetCondition(function(e,tp) return Duel.HasFlagEffect(tp,id) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Fusion Summon 1 "Memento" Fusion Monster from your Extra Deck, using monsters from your hand or field as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function() return not Duel.IsPhase(PHASE_DAMAGE) end) e2:SetTarget(Fusion.SummonEffTG(aux.FilterBoolFunction(Card.IsSetCard,SET_MEMENTO))) e2:SetOperation(Fusion.SummonEffOP(aux.FilterBoolFunction(Card.IsSetCard,SET_MEMENTO))) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Send 1 "Memento" card from your Deck to the GY local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_TOGRAVE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCountLimit(1,{id,2}) e4:SetCondition(function(e) return e:GetHandler():IsReason(REASON_BATTLE|REASON_EFFECT) end) e4:SetTarget(s.tgtg) e4:SetOperation(s.tgop) c:RegisterEffect(e4) --Register destruction of monsters aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROY) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_names={id} s.listed_series={SET_MEMENTO} function s.checkfilter(c) return c:IsReason(REASON_EFFECT) and (c:IsPreviousLocation(LOCATION_MZONE) or (c:IsMonster() and not c:IsPreviousLocation(LOCATION_ONFIELD))) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.checkfilter,nil) if #g==0 then return end for p=0,1 do if g:IsExists(Card.IsPreviousControler,1,nil,p) and not Duel.HasFlagEffect(p,id) then Duel.RegisterFlagEffect(p,id,RESET_PHASE|PHASE_END,0,1) end 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,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.tgfilter(c) return c:IsSetCard(SET_MEMENTO) and not c:IsCode(id) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Change all face-up Dragon-Type monsters on the field to Defense Position, also they cannot change their battle positions.
--ドラゴン族・封印の壺 --Dragon Capture Jar 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) --Pos Change local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SET_POSITION) e2:SetRange(LOCATION_SZONE) e2:SetTarget(s.target) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetValue(POS_FACEUP_DEFENSE) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_CHANGE_POSITION) c:RegisterEffect(e3) end function s.target(e,c) return c:IsRace(RACE_DRAGON) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a card or effect while you control "Red Dragon Archfiend" or a Synchro Monster that mentions it: You can target 1 card on the field; destroy it. You can target 1 of your banished DARK Dragon Synchro Monsters; Special Summon it. You can only use each effect of "Red Zone" once per turn.
--スカーレッド・ゾーン --Red Zone --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,{id,0}) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Special Summon 1 of your banished DARK Dragon Synchro Monsters local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={CARD_RED_DRAGON_ARCHFIEND} function s.cfilter(c) return c:IsFaceup() and (c:IsCode(CARD_RED_DRAGON_ARCHFIEND) or (c:IsType(TYPE_SYNCHRO) and c:IsMonster() and c:ListsCode(CARD_RED_DRAGON_ARCHFIEND))) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,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:
1 Machine-Type Tuner + 1 or more non-Tuner Machine-Type monsters This card can attack while in face-up Defense Position. If it does, apply its DEF for damage calculation. If you have no Spell/Trap Cards in your Graveyard: You can halve this card's original DEF until the end of this turn, and if you do, this card can attack your opponent directly this turn. Once per turn, during the next Standby Phase after this card was destroyed by a card effect and sent to the Graveyard: You can Special Summon this card.
--超重忍者シノビ-A・C --Superheavy Samurai Stealth Ninja local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_MACHINE),1,1,Synchro.NonTunerEx(Card.IsRace,RACE_MACHINE),1,99) --defense attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DEFENSE_ATTACK) e1:SetValue(1) c:RegisterEffect(e1) --direct attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.dircon) e2:SetOperation(s.dirop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_TO_GRAVE) e3:SetOperation(s.spreg) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetRange(LOCATION_GRAVE) e4:SetCode(EVENT_PHASE|PHASE_STANDBY) e4:SetCountLimit(1) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) e4:SetLabelObject(e3) c:RegisterEffect(e4) end function s.dircon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_GRAVE,0,1,nil) and not e:GetHandler():IsHasEffect(EFFECT_DIRECT_ATTACK) end function s.dirop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_DEFENSE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(c:GetBaseDefense()/2) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DIRECT_ATTACK) e2:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e2) end end function s.spreg(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if (r&REASON_EFFECT+REASON_DESTROY)~=REASON_EFFECT+REASON_DESTROY then return end if Duel.IsPhase(PHASE_STANDBY) then e:SetLabel(Duel.GetTurnCount()) c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,2) else e:SetLabel(0) c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and e:GetHandler():GetFlagEffect(id)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) c:ResetFlagEffect(id) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control both Fish and Winged Beast-Type monsters, you can Special Summon this card (from your hand). When you do: You can declare a Level from 3 to 5; the Levels of all monsters you currently control become the declared Level. If you activate this effect, monsters you control cannot activate their effects for the rest of this turn, except WATER monsters.
--霊水鳥シレーヌ・オルカ --Sirenorca local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetValue(1) c:RegisterEffect(e1) --Change the Level of all monsters you currently control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL+1) end) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_FISH),tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_WINGEDBEAST),tp,LOCATION_MZONE,0,1,nil) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK) local lv=Duel.AnnounceLevel(tp,3,5) Duel.SetTargetParam(lv) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local lv=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,0,nil) for tc in g:Iter() do --Change Level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end --Your non-WATER monster effects cannot activate their effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_IGNORE_RANGE) e2:SetCode(EFFECT_CANNOT_TRIGGER) e2:SetTarget(s.actfilter) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.actfilter(e,c) return c:IsControler(e:GetHandlerPlayer()) and c:IsMonster() and c:IsAttributeExcept(ATTRIBUTE_WATER) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Destroy all Machine monsters on the field.
--電磁蚊 --Magnetic Mosquito local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_MACHINE),tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_MACHINE),tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a card or effect by declaring exactly 1 card name (Quick Effect): You can send this card from your hand to the GY; declare 1 other card name. The card name your opponent declared becomes the card name declared by this effect. Once per turn (Quick Effect): You can target 1 face-up card on the field; destroy it during the End Phase of the next turn.
--刻印の調停者 --Engraver of the Mark local s,id=GetID() function s.initial_effect(c) --Declare 1 other card name local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.declcon) e1:SetCost(Cost.SelfToGrave) e1:SetOperation(s.declop) c:RegisterEffect(e1) --Destroy 1 face-up card on the field during the End Phase of the next turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.declcon(e,tp,eg,ep,ev,re,r,rp) local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_ANNOUNCE) return rp==1-tp and ex and (cv&ANNOUNCE_CARD+ANNOUNCE_CARD_FILTER)~=0 end function s.declop(e,tp,eg,ep,ev,re,r,rp) local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_ANNOUNCE) local ac=0 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) if (cv&ANNOUNCE_CARD)~=0 then ac=Duel.AnnounceCard(tp,cv) else ac=Duel.AnnounceCard(tp,table.unpack(re:GetHandler().announce_filter)) end Duel.ChangeTargetParam(ev,ac) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then local turn_count=Duel.GetTurnCount() --Destroy it during the End Phase of the next turn aux.DelayedOperation(tc,PHASE_END,id,e,tp, function(ag) Duel.Hint(HINT_CARD,0,id) Duel.Destroy(ag,REASON_EFFECT) end, function() return Duel.GetTurnCount()==turn_count+1 end, nil,2,aux.Stringid(id,2) ) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 Effect Monster on the field; negate the effects of that face-up monster while it is on the field, also that face-up monster cannot attack. When it is destroyed, destroy this card.
--デモンズ・チェーン --Fiendish Chain local s,id=GetID() function s.initial_effect(c) aux.AddPersistentProcedure(c,nil,s.filter,CATEGORY_DISABLE,nil,nil,TIMINGS_CHECK_MONSTER,nil,nil,s.target) --disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(aux.PersistentTargetFilter) c:RegisterEffect(e3) --cannot attack local e4=e3:Clone() e4:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e4) --Destroy local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e5:SetRange(LOCATION_SZONE) e5:SetCode(EVENT_LEAVE_FIELD) e5:SetCondition(s.descon) e5:SetOperation(s.desop) c:RegisterEffect(e5) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_EFFECT) end function s.target(e,tp,eg,ep,ev,re,r,rp,tc,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,tc,1,0,0) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsStatus(STATUS_DESTROY_CONFIRMED) then return false end local tc=c:GetFirstCardTarget() return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY) 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:
If you control an "Ice Barrier" monster, you can Special Summon this card (from your hand). You cannot Special Summon any Level 5 or higher monsters the turn you Summon this way. You can Tribute this card, then target 1 "Ice Barrier" monster in your GY, except "Prior of the Ice Barrier"; Special Summon that target.
--氷結界の伝道師 --Prior of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetOperation(s.spop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_ICE_BARRIER} function s.counterfilter(c) return not c:IsLevelAbove(5) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ICE_BARRIER) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) Duel.RegisterEffect(e1,tp) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLevelAbove(5) end function s.filter(c,e,tp) return c:IsSetCard(SET_ICE_BARRIER) and c:GetCode()~=id and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 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.spop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 non-Tuner monster When this card is Synchro Summoned: You can draw 1 card. Once per Chain, during your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Synchro Summon using this card you control.
--フォーミュラ・シンクロン --Formula Synchron local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,1) c:EnableReviveLimit() --synchro summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.drcon) e1:SetTarget(s.drtarg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --synchro effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.sccon) e2:SetTarget(s.sctarg) e2:SetOperation(s.scop) c:RegisterEffect(e2) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.drtarg(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.sccon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and (Duel.IsMainPhase()) end function s.sctarg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(id)==0 and Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end c:RegisterFlagEffect(id,RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.scop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then return end local g=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,c) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SynchroSummon(tp,sg:GetFirst(),c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Change the Attack or Defense Position of 1 face-up monster on the field. The card must remain face-up.
--朱い靴 --Bite Shoes local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsCanChangePosition() 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 true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 5 or higher Insect monster + 1 Insect monster Cannot be destroyed by your opponent's card effects. If all face-up monsters you control are Insect monsters (Quick Effect): You can target 2 monsters on the field, including an Insect monster you control; banish them. You can only use this effect of "Heavy Cavalry of the Indestructible Insects" once per turn.
--Japanese name --Heavy Cavalry of the Indestructible Insects --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: 1 Level 5 or higher Insect monster + 1 Insect monster Fusion.AddProcMix(c,true,true,s.matfilter,aux.FilterBoolFunctionEx(Card.IsRace,RACE_INSECT)) --Cannot be destroyed by your opponent's card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetValue(aux.indoval) c:RegisterEffect(e1) --Banish 2 monsters on the field, including an Insect monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCondition(s.rmvcon) e2:SetTarget(s.rmvtg) e2:SetOperation(s.rmvop) c:RegisterEffect(e2) end function s.matfilter(c,fc,sumtype,tp) return c:IsLevelAbove(5) and c:IsRace(RACE_INSECT,fc,sumtype,tp) end function s.rmvcon(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) return #g==g:FilterCount(Card.IsRace,nil,RACE_INSECT) end function s.rmvfilter(c,e) return c:IsAbleToRemove() and c:IsCanBeEffectTarget(e) end function s.insectfilter(c,tp) return c:IsRace(RACE_INSECT) and c:IsControler(tp) and c:IsFaceup() end function s.rescon(sg,e,tp,mg) return sg:IsExists(s.insectfilter,1,nil,tp) end function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.rmvfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e) if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local g=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,2,tp,0) end function s.rmvop(e,tp,eg,ep,ev,re,r,rp,chk) local tg=Duel.GetTargetCards(e) if #tg>0 then Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Place 1 monster from your Deck in your Spell & Trap Zone as a face-up Continuous Spell. You can banish this card from your GY; place 1 monster from your Deck in your Spell & Trap Zone as a face-up Continuous Trap. You can only use 1 "Flock Together" effect per turn, and only once that turn. The total number of cards in the Monster Zones and face-up Monster Cards in the Spell & Trap Zones must be 10 or more to activate either of this card's effects.
--目白圧し --Flock Together --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Place 1 monster form your Deck in your Spell/Trap Zone as a Continuous Spell local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetCondition(s.plcon) e1:SetTarget(s.spellpltg) e1:SetOperation(s.spellplop) c:RegisterEffect(e1) --Place 1 monster form your Deck in your Spell/Trap Zone as a Continuous Trap local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.plcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.trappltg) e2:SetOperation(s.trapplop) c:RegisterEffect(e2) end function s.mnstrfilter(c) return c:IsLocation(LOCATION_MZONE) or (c:IsLocation(LOCATION_STZONE) and c:IsFaceup() and c:IsOriginalType(TYPE_MONSTER)) end function s.plcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.mnstrfilter,tp,LOCATION_MZONE|LOCATION_STZONE,LOCATION_MZONE|LOCATION_STZONE,10,nil) end function s.plfilter(c,tp) return c:IsMonster() and not c:IsForbidden() and c:CheckUniqueOnField(tp) end function s.spellpltg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if e:GetHandler():IsLocation(LOCATION_HAND) then ft=ft-1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil,tp) end end function s.spellplop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() if tc and Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then --Treated as a Continuous Spell local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_SPELL|TYPE_CONTINUOUS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)) tc:RegisterEffect(e1) end end function s.trappltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil,tp) end end function s.trapplop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() if tc and Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) then --Treated as a Continuous Trap local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_TRAP|TYPE_CONTINUOUS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Cycle of the World". This card's name becomes "Ruin, Queen of Oblivion" while in the hand or on the field. If this card is Ritual Summoned: It can make up to 2 attacks on monsters during each Battle Phase this turn. If this card is sent to the GY: You can target 1 Ritual Monster you control; while it is face-up on your field, your opponent cannot activate cards or effects when your Ritual Monsters declare an attack.
--破滅の天使ルイン --Ruin, Angel of Oblivion --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Change this card's name local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e0:SetCode(EFFECT_CHANGE_CODE) e0:SetRange(LOCATION_MZONE|LOCATION_HAND) e0:SetValue(46427957) c:RegisterEffect(e0) --Multiple attacks local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Opponent cannot activate cards/effects when your Ritual attacks local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetTarget(s.aclimtg) e2:SetOperation(s.aclimop) c:RegisterEffect(e2) end s.listed_names={32828635,46427957} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() and e:GetHandler():IsRitualSummoned() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then --Can make up to 2 attacks on monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EXTRA_ATTACK_MONSTER) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.aclimtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsType(TYPE_RITUAL) end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsType,TYPE_RITUAL),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsType,TYPE_RITUAL),tp,LOCATION_MZONE,0,1,1,nil) end function s.aclimop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Cannot activate cards/effects when your Ritual attacks local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.actcon) e1:SetOperation(s.actop) e1:SetLabelObject(tc) Duel.RegisterEffect(e1,tp) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_CONTROL,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) end end function s.actcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffect(id)==0 then e:Reset() return false end local ac=Duel.GetAttacker() return ac and ac:IsControler(tp) and ac:IsType(TYPE_RITUAL) and tc:GetFlagEffect(id)>0 end function s.actop(e,tp,eg,ep,ev,re,r,rp) --Cannot activate local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(0,1) e1:SetCondition(s.actlimitcon) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) end function s.actlimitcon(e,tp,eg,ep,ev,re,r,rp) return Duel.CheckEvent(EVENT_ATTACK_ANNOUNCE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, if this card was Special Summoned by the effect of "Allure Queen LV5", you can select 1 monster on your opponent's side of the field and equip it to this card. (Only 1 card at a time can be equipped due to this effect.) If this card would be destroyed by battle, the equipped monster is destroyed instead.
--魅惑の女王 LV7 --Allure Queen LV7 local s,id=GetID() function s.initial_effect(c) --Register that it was Special Summoned by the effect of "Allure Queen LV5" local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_SPSUMMON_SUCCESS) e0:SetCondition(s.regcon) e0:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~RESET_TEMP_REMOVE,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) end) c:RegisterEffect(e0) --Equip 1 monster your opponent controls to this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e1:SetCondition(s.eqconignition) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,s.eqconignition,s.eqval,s.equipop,e1) --Quick Effect version for when the effect of "Golden Allure Queen" is applied local e2=e1:Clone() e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(TIMING_STANDBY_PHASE,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(s.eqconquick) c:RegisterEffect(e2) aux.AddEREquipLimit(c,s.eqconquick,s.eqval,s.equipop,e2) end s.listed_names={23756165} --"Allure Queen LV5" s.LVnum=7 s.LVset=SET_ALLURE_QUEEN function s.regcon(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() local trig_loc,trig_code1,trig_code2=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) if not Duel.IsChainSolving() or (rc:IsRelateToEffect(re) and rc:IsFaceup() and rc:IsLocation(trig_loc)) then return rc:IsCode(23756165) end return trig_code1==23756165 or trig_code2==23756165 end function s.eqconignition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:HasFlagEffect(id) and not c:GetEquipGroup():IsExists(Card.HasFlagEffect,1,nil,id) and not (c:IsOriginalSetCard(SET_ALLURE_QUEEN) and Duel.IsPlayerAffectedByEffect(tp,EFFECT_GOLDEN_ALLURE_QUEEN)) end function s.eqconquick(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:HasFlagEffect(id) and not c:GetEquipGroup():IsExists(Card.HasFlagEffect,1,nil,id) and c:IsOriginalSetCard(SET_ALLURE_QUEEN) and Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),EFFECT_GOLDEN_ALLURE_QUEEN) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsAbleToChangeControler() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,Card.IsAbleToChangeControler,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then Duel.SendtoGrave(c,REASON_RULE,PLAYER_NONE,PLAYER_NONE) else s.equipop(c,e,tp,tc) end end function s.equipop(c,e,tp,tc) if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end --If this card would be destroyed by battle, the equipped monster is destroyed instead local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_DESTROY_SUBSTITUTE) e1:SetValue(function(e,re,r,rp) return r&REASON_BATTLE>0 end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end function s.eqval(ec,c,tp) return ec:IsControler(1-tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
A non Machine-Type monster equipped with this card cannot attack.
--しびれ薬 --Paralyzing Potion local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,s.filter) --atklimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e2) end function s.filter(c) return not c:IsRace(RACE_MACHINE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, this card cannot be destroyed by battle. When this card is Pendulum Summoned: You can add 1 Ritual Monster or 1 Ritual Spell Card from your Deck to your hand.
--スピリチューアル・ウィスパー --Spiritual Whisper local s,id=GetID() function s.initial_effect(c) --battle indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetCountLimit(1) e1:SetValue(s.valcon) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.valcon(e,re,r,rp) return (r&REASON_BATTLE)~=0 end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPendulumSummoned() end function s.filter(c) return c:IsType(TYPE_RITUAL) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Plant-Type Tuner monster is Normal Summoned to your side of the field: You can Special Summon this card from your Graveyard in Attack Position.
--ダーク・ヴァージャー --Dark Verger local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_GRAVE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() return tc:IsControler(tp) and tc:IsRace(RACE_PLANT) and tc:IsType(TYPE_TUNER) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Abyss Actor" monster you control; if it destroys your opponent's monster by battle this turn, your opponent banishes 3 monsters from their Extra Deck (their choice). If this Set card in its owner's control is destroyed by an opponent's card effect, and you have a face-up "Abyss Actor" Pendulum Monster in your Extra Deck: You can look at your opponent's Extra Deck, also banish 1 monster from their Extra Deck. You can only use this effect of "Abyss Script - Fire Dragon's Lair" once per turn.
--魔界台本「火竜の住処」 --Abyss Script - Fire Dragon's Lair local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroyed local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,id) e2:SetCondition(s.rmcon2) e2:SetTarget(s.rmtg2) e2:SetOperation(s.rmop2) c:RegisterEffect(e2) end s.listed_series={SET_ABYSS_ACTOR} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_ABYSS_ACTOR) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~(RESET_LEAVE|RESET_TODECK|RESET_TEMP_REMOVE|RESET_REMOVE|RESET_TOGRAVE)|RESET_PHASE|PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetLabelObject(tc) e1:SetCondition(s.rmcon1) e1:SetOperation(s.rmop1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.rmcon1(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() return eg:IsContains(tc) and tc:GetFlagEffect(id)~=0 end function s.rmop1(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_EXTRA,nil) if #g<3 then return end Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_REMOVE) local mg=g:Select(1-tp,3,3,nil) if #mg>0 then Duel.Remove(mg,POS_FACEUP,REASON_EFFECT) end end function s.rmcon2(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_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil) end function s.rmtg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_EXTRA,1,nil) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,0) end function s.rmop2(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_EXTRA) if #g==0 then return end Duel.ConfirmCards(tp,g) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local mg=g:FilterSelect(tp,Card.IsAbleToRemove,1,1,nil) if #mg>0 then Duel.Remove(mg,POS_FACEUP,REASON_EFFECT) end Duel.ShuffleExtra(1-tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Tributed: Draw 1 card. If your monster would be destroyed by battle, you can banish this card from your GY instead.
--サクリボー --Relinkuriboh local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_RELEASE) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.repfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 Dragon monster you control; it gains ATK/DEF equal to the total Link Rating of the Link Monsters currently on the field x 100, until the end of the opponent's turn. You can only use this effect of "Guardragon Shield" once per turn. Once per turn, if exactly 1 Dragon monster you control would be destroyed by battle or card effect, you can send 1 Normal Monster from your hand or Deck to the GY instead.
--守護竜の結界 --Guardragon Shield --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --boost local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) 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_FZONE) e3:SetCountLimit(1) e3:SetTarget(s.reptg) e3:SetValue(s.repval) c:RegisterEffect(e3) end function s.atkfilter(c) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and Duel.IsExistingMatchingCard(Card.IsType,0,LOCATION_MZONE,LOCATION_MZONE,1,nil,TYPE_LINK) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and tc:IsFaceup() then 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(RESETS_STANDARD_PHASE_END|RESET_OPPO_TURN) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end function s.atkval(e,c) local g=Duel.GetMatchingGroup(Card.IsType,0,LOCATION_MZONE,LOCATION_MZONE,nil,TYPE_LINK) return g:GetSum(Card.GetLink)*100 end function s.repfilter(c,tp) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.tgfilter(c) return c:IsType(TYPE_NORMAL) 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 #eg==1 and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|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_HAND|LOCATION_DECK,0,1,1,nil) Duel.Hint(HINT_CARD,0,id) Duel.SendtoGrave(sg,REASON_EFFECT|REASON_REPLACE) 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:
Target 3 monsters in your GY; your opponent chooses 1, you Special Summon it, and if you do, banish the rest. You can only activate 1 "Monster Reborn Reborn" per turn.
--取捨蘇生 --Monster Reborn Reborn local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsAbleToRemove() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,3,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,3,3,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,2,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g==0 or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local sg=g:FilterSelect(1-tp,s.filter,1,1,nil,e,tp) if #sg>0 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.Remove(g-sg,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Red Dragon Archfiend": Destroy all Spell and Trap Cards your opponent controls.
--クリムゾン・ヘル・セキュア --Scarlet Security 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:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_RED_DRAGON_ARCHFIEND} function s.cfilter(c) return c:IsFaceup() and c:IsCode(CARD_RED_DRAGON_ARCHFIEND) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c) return c:IsSpellTrap() 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_ONFIELD,1,nil) end local sg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,e:GetHandler()) Duel.Destroy(sg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Dark Magician" or "Dark Magician Girl" + 1 Spellcaster monster Once per turn, if a Spell/Trap Card or effect is activated (except during the Damage Step): You can draw 1 card, then if it was a Spell/Trap, you can Set it, and if it was a Trap or Quick-Play Spell, you can activate it this turn. If this card is destroyed: You can Special Summon both 1 "Dark Magician" and 1 "Dark Magician Girl" from your hand, Deck, and/or GY.
--超魔導師-ブラック・マジシャンズ --The Dark Magicians --scripted by CyberCatman local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,{CARD_DARK_MAGICIAN,CARD_DARK_MAGICIAN_GIRL},aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER)) --Draw 1 card and Set it if it is a Spell/Trap card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetCode(EVENT_CHAINING) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --Special Summon 1 "Dark Magician" and 1 "Dark Magician Girl" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.material={CARD_DARK_MAGICIAN,CARD_DARK_MAGICIAN_GIRL} s.material_setcode={SET_DARK_MAGICIAN,SET_MAGICIAN_GIRL,SET_DARK_MAGICIAN_GIRL} s.listed_names={CARD_DARK_MAGICIAN,CARD_DARK_MAGICIAN_GIRL} function s.drcon(e,tp,eg,ep,ev,re,r,rp) return re:IsSpellTrapEffect() 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) if Duel.Draw(p,d,REASON_EFFECT)~=0 then local tc=Duel.GetOperatedGroup():GetFirst() if tc:IsSpellTrap() and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.SSet(tp,tc,tp,false) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) if tc:IsQuickPlaySpell() then e1:SetCode(EFFECT_QP_ACT_IN_SET_TURN) elseif tc:IsTrap() then e1:SetCode(EFFECT_TRAP_ACT_IN_SET_TURN) end e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetDescription(aux.Stringid(id,3)) tc:RegisterEffect(e1) end end end function s.spfilter(c,e,tp,code) return c:IsCode(code) 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)>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp,CARD_DARK_MAGICIAN) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp,CARD_DARK_MAGICIAN_GIRL) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.rescon(sg) return sg:IsExists(Card.IsCode,1,nil,CARD_DARK_MAGICIAN) and sg:IsExists(Card.IsCode,1,nil,CARD_DARK_MAGICIAN_GIRL) 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 then return end local g1=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp,CARD_DARK_MAGICIAN) local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp,CARD_DARK_MAGICIAN_GIRL) if #g1>0 and #g2>0 then local sg=aux.SelectUnselectGroup(g1+g2,e,tp,2,2,s.rescon,1,tp,HINTMSG_SPSUMMON) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay 2000 Life Points, then target 1 monster in your Graveyard; Special Summon that target in face-down Defense Position.
--バースト・リバース --Burst Rebirth local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCost(Cost.PayLP(2000)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card in your hand, field, or GY can be used as a substitute for any 1 Fusion Material whose name is mentioned on the Fusion Monster Card, but the other materials must be correct. * The above text is unofficial and describes the card's functionality in the OCG.
--破壊神 ヴァサーゴ --Versago the Destroyer local s,id=GetID() function s.initial_effect(c) --fusion substitute local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_FUSION_SUBSTITUTE) e1:SetCondition(s.subcon) c:RegisterEffect(e1) end function s.subcon(e) return e:GetHandler():IsLocation(LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 "Chronomaly" monsters Once per turn, during either player's turn: You can detach 1 Xyz Material from this card, then target 1 face-up monster your opponent controls; change its ATK to 0 until the end of this turn. You can Tribute 1 "Chronomaly" monster, then target 1 monster your opponent controls, whose current ATK is different from its original ATK; destroy that target.
--No.36 先史遺産-超機関フォーク=ヒューク --Number 36: Chronomaly Chateau Huyuk local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_CHRONOMALY),4,2) c:EnableReviveLimit() --atkdown 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:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_CHRONOMALY} s.xyz_number=36 function s.filter(c) return c:IsFaceup() and c:GetAttack()>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()>0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.cfilter(c) return c:IsSetCard(SET_CHRONOMALY) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(s.filter2,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.filter2(c,e) return c:IsFaceup() and c:GetAttack()~=c:GetBaseAttack() and (not e or c:IsCanBeEffectTarget(e)) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter2(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter2,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter2,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()~=tc:GetBaseAttack() then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's original ATK and DEF are each equal to its Level x 300. This monster's Level is increased by the Level of monsters it destroys by battle.
--グリード・クエーサー --Greed Quasar local s,id=GetID() function s.initial_effect(c) --base attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) c:RegisterEffect(e2) --lvup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(s.condition) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.atkval(e,c) return c:GetLevel()*300 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsRelateToBattle() and e:GetHandler():IsFaceup() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() local lv=bc:GetLevel() if lv>0 then if c:GetFlagEffect(id)==0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(lv) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_DISABLE,0,0) e:SetLabelObject(e1) e:SetLabel(lv) else local pe=e:GetLabelObject() local ct=e:GetLabel()+lv e:SetLabel(ct) pe:SetValue(ct) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish 1 "Virtual World" card from your GY, then target 1 face-up monster on the field; negate its effects until the end of this turn (even if this card leaves the field). You can banish this card from your GY; add 1 "Virtual World" monster from your Deck to your hand, then send 1 card from your hand to the GY. You can only use each effect of "Virtual World Gate - Qinglong" once per turn.
--電脳堺門-青龍 --Virtual World Gate - Qinglong --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Target 1 monster to negate the effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DISABLE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCost(s.ngcost) e2:SetTarget(s.ngtg) e2:SetOperation(s.ngop) c:RegisterEffect(e2) --Add from deck then send to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_HANDES) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_VIRTUAL_WORLD} function s.costfilter(c) return c:IsSetCard(SET_VIRTUAL_WORLD) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.ngcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.ngtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsNegatableMonster() end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatableMonster,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local tg=Duel.SelectTarget(tp,Card.IsNegatableMonster,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,tg,1,0,0) end function s.ngop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc and tc:IsRelateToEffect(e) then 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 function s.thfilter(c) return c:IsSetCard(SET_VIRTUAL_WORLD) 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 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters with different names If a monster is Special Summoned to a zone this card points to: You can apply the following effects, in sequence, based on the card types of the monster(s) this card points to. ● Ritual: Draw 2 cards, then discard 2 cards. ● Fusion: Special Summon 1 Level 4 or lower monster from your GY. ● Synchro: All monsters you control gain 700 ATK. ● Xyz: All monsters your opponent controls lose 700 ATK. You can only use this effect of "Cross-Sheep" once per turn.
--クロシープ --Cross-Sheep --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,nil,2,2,s.lcheck) c:EnableReviveLimit() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCondition(aux.zptcon(nil)) e1:SetTarget(s.target) e1:SetOperation(s.operation) e1:SetCountLimit(1,id) c:RegisterEffect(e1) end function s.lcheck(g,lc,sumtype,tp) return g:CheckDifferentProperty(Card.GetCode,lc,sumtype,tp) end s.ritfilter=aux.FaceupFilter(Card.IsRitualMonster) function s.rittg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLinkedGroup():IsExists(s.ritfilter,1,nil) and Duel.IsPlayerCanDraw(tp,2) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,2) end s.fusfilter=aux.FaceupFilter(Card.IsType,TYPE_FUSION) function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.fustg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLinkedGroup():IsExists(s.fusfilter,1,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end s.synfilter=aux.FaceupFilter(Card.IsType,TYPE_SYNCHRO) function s.syntg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLinkedGroup():IsExists(s.synfilter,1,nil) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end end s.xyzfilter=aux.FaceupFilter(Card.IsType,TYPE_XYZ) function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetLinkedGroup():IsExists(s.xyzfilter,1,nil) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.rittg(e,tp,eg,ep,ev,re,r,rp,0) or s.fustg(e,tp,eg,ep,ev,re,r,rp,0) or s.syntg(e,tp,eg,ep,ev,re,r,rp,0) or s.xyztg(e,tp,eg,ep,ev,re,r,rp,0) end if s.rittg(e,tp,eg,ep,ev,re,r,rp,0) then s.rittg(e,tp,eg,ep,ev,re,r,rp,1) end if s.fustg(e,tp,eg,ep,ev,re,r,rp,0) then s.fustg(e,tp,eg,ep,ev,re,r,rp,1) end if s.syntg(e,tp,eg,ep,ev,re,r,rp,0) then s.syntg(e,tp,eg,ep,ev,re,r,rp,1) end if s.xyztg(e,tp,eg,ep,ev,re,r,rp,0) then s.xyztg(e,tp,eg,ep,ev,re,r,rp,1) end Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,2) Duel.SetPossibleOperationInfo(0,CATEGORY_HANDES,nil,1,tp,2) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.ritop(e,tp,eg,ep,ev,re,r,rp) if Duel.Draw(tp,2,REASON_EFFECT)==2 then Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.DiscardHand(tp,nil,2,2,REASON_EFFECT|REASON_DISCARD) end end function s.fusop(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,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.synop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil) for tc in aux.Next(g) do tc:UpdateAttack(700,nil,c) end end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) for tc in aux.Next(g) do tc:UpdateAttack(-700,nil,c) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if s.rittg(e,tp,eg,ep,ev,re,r,rp,0) then s.ritop(e,tp,eg,ep,ev,re,r,rp) end if s.fustg(e,tp,eg,ep,ev,re,r,rp,0) then Duel.BreakEffect() s.fusop(e,tp,eg,ep,ev,re,r,rp) end if s.syntg(e,tp,eg,ep,ev,re,r,rp,0) then Duel.BreakEffect() s.synop(e,tp,eg,ep,ev,re,r,rp) end if s.xyztg(e,tp,eg,ep,ev,re,r,rp,0) then Duel.BreakEffect() s.xyzop(e,tp,eg,ep,ev,re,r,rp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by declaring 1 Monster Type and 1 Attribute; Special Summon this card as a Normal Monster (Level 4/ATK 1800/DEF 1000) with that Type and Attribute. (This card is also still a Trap.)
--鏡像のスワンプマン --Swamp Mirrorer local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local rac=0 local crac=1 while RACE_ALL&crac~=0 do local catt=1 while ATTRIBUTE_ALL&catt~=0 do if Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER+TYPE_NORMAL,1800,1000,4,crac,catt) then rac=rac+crac break end catt=catt<<1 end crac=crac<<1 end e:SetLabel(rac) return rac~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RACE) local crac=Duel.AnnounceRace(tp,1,e:GetLabel()) local att=0 local catt=1 while ATTRIBUTE_ALL&catt~=0 do if Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER+TYPE_NORMAL,1800,1000,4,crac,catt) then att=att+catt end catt=catt<<1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) catt=Duel.AnnounceAttribute(tp,1,att) e:SetLabel(crac) Duel.SetTargetParam(catt) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local rac=e:GetLabel() local att=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER+TYPE_NORMAL,1800,1000,4,rac,att) then return end c:AddMonsterAttribute(TYPE_NORMAL+TYPE_TRAP,att,rac,0,0,0) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Scrap" Tuner + 1+ non-Tuner monsters Once per turn: You can target 1 card you control and 2 cards your opponent controls; destroy the one you control, and if you do, return the ones your opponent controls to the hand. If this card in your possession is destroyed by your opponent's card and sent to your GY: Target 1 non-Synchro "Scrap" monster in your GY; Special Summon it.
--スクラップ・ツイン・ドラゴン --Scrap Twin Dragon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_SCRAP),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --Destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SCRAP} function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,1,0,0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g2=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g2,2,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local ex,g1=Duel.GetOperationInfo(0,CATEGORY_DESTROY) local ex,g2=Duel.GetOperationInfo(0,CATEGORY_TOHAND) if g1:GetFirst():IsRelateToEffect(e) and Duel.Destroy(g1,REASON_EFFECT)~=0 then local hg=g2:Filter(Card.IsRelateToEffect,nil,e) Duel.SendtoHand(hg,nil,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local crp=c:GetReasonPlayer() return c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and tp~=crp and crp~=PLAYER_NONE end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SCRAP) and not c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute Summon this card face-up by Tributing 1 face-down monster your opponent controls. This card's Level becomes 10 if it was Normal Summoned/Set. If this card is sent to the GY, except from the field: You can target 1 "Tistina" monster you control; this turn, it can make a second attack during each Battle Phase, also you can only attack with 1 monster.
--ティスティナの瘴神 --Tainted of the Tistina --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Tribute Summon face-up by tributing 1 monster the opponent controls local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SUMMON_PROC) e0:SetCondition(s.sumcon) e0:SetTarget(s.sumtg) e0:SetOperation(s.sumop) e0:SetValue(SUMMON_TYPE_TRIBUTE) c:RegisterEffect(e0) --Becomes Level 10 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetRange(LOCATION_MZONE) e1:SetCondition(function(e) return e:GetHandler():IsNormalSummoned() end) e1:SetValue(10) c:RegisterEffect(e1) --"Tistina" monster can make a second attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(function(e) return Duel.IsAbleToEnterBP() and not e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_TISTINA} function s.sumcon(e,c,minc,zone,relzone,exeff) if c==nil then return true end local tp=c:GetControler() if minc>1 or c:IsLevelBelow(4) or Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return false end local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsReleasable),tp,0,LOCATION_MZONE,nil) local must_g=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_MZONE,LOCATION_MZONE,nil,EFFECT_EXTRA_RELEASE) return #g>0 and (#must_g==0 or #(g&must_g)>0) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk,c,minc,zone,relzone,exeff) local g=Duel.GetMatchingGroup(aux.AND(Card.IsFacedown,Card.IsReleasable),tp,0,LOCATION_MZONE,nil) local must_g=Duel.GetMatchingGroup(Card.IsHasEffect,tp,LOCATION_MZONE,LOCATION_MZONE,nil,EFFECT_EXTRA_RELEASE) if #must_g>0 then g=g&must_g end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local mc=g:Select(tp,1,1,nil):GetFirst() if not mc then return false end e:SetLabelObject(mc) return true end function s.sumop(e,tp,eg,ep,ev,re,r,rp,c,minc,zone,relzone,exeff) local mc=e:GetLabelObject() c:SetMaterial(mc) Duel.Release(mc,REASON_SUMMON|REASON_MATERIAL) end function s.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_TISTINA) and not c:IsHasEffect(EFFECT_EXTRA_ATTACK) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Can make a second attack local e1=Effect.CreateEffect(c) e1:SetDescription(3201) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end --Can only attack with 1 monster this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetCondition(function(e) return e:GetLabel()~=0 end) e1:SetTarget(function(e,c) return c:GetFieldID()~=e:GetLabel() end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetLabelObject(e1) e2:SetOperation(function(e,_,eg) e:GetLabelObject():SetLabel(eg:GetFirst():GetFieldID()) end) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,2)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Clayman" + "Elemental HERO Burstinatrix" Must be Special Summoned with "Dark Fusion". Cannot be destroyed by Spell effects. Once per turn, during your Standby Phase: Inflict 1000 damage to your opponent. This card must be in face-up Defense Position to activate and to resolve this effect.
--E-HERO ヘル・スナイパー --Evil HERO Infernal Sniper local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion material Fusion.AddProcMix(c,true,true,84327329,58932615) --lizard check local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(CARD_CLOCK_LIZARD) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCondition(s.lizcon) e0:SetValue(1) c:RegisterEffect(e0) --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.EvilHeroLimit) c:RegisterEffect(e1) --Inflict damage in the Standby Phase 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_MZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --Cannot be destroyed by Spell effects local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e3:SetValue(s.indesval) c:RegisterEffect(e3) end s.material_setcode={SET_HERO,SET_ELEMENTAL_HERO} s.dark_calling=true s.listed_names={CARD_DARK_FUSION,58932615,84327329} function s.lizcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return not Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),EFFECT_SUPREME_CASTLE) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPosition(POS_FACEUP_DEFENSE) and Duel.IsTurnPlayer(tp) 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,0,0,1-tp,1000) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) or e:GetHandler():IsFacedown() then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.indesval(e,re) return re:IsSpellEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent to the GY: You can target 1 face-up monster on the field; equip this card to that target. That monster loses 500 ATK while equipped with this card.
--暗黒魔族ギルファー・デーモン --Archfiend of Gilfer local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_TO_GRAVE) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function s.eqlimit(e,c) return e:GetOwner()==c end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Equip(tp,c,tc,true) --Add Equip limit local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(-500) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a face-up Psychic-Type monster: Target 1 monster your opponent controls; banish it. During the next Standby Phase, it returns to the opponent's side of the field in the same Battle Position.
--パスト・イメージ --Past Image local s,id=GetID() function s.initial_effect(c) --remove local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_PSYCHIC),tp,LOCATION_MZONE,0,1,nil) 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 chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) 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_STANDBY) e1:SetReset(RESET_PHASE|PHASE_STANDBY) 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) Duel.ReturnToField(e:GetLabelObject()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, you can Special Summon this card (from your hand) in Attack Position. Once per turn, during the End Phase, if this card was Tributed this turn to Tribute Summon a "HERO" monster: Draw 1 card.
--E-HERO ヘル・ブラット --Evil HERO Infernal Prodigy local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_SPSUM_PARAM) e1:SetTargetRange(POS_FACEUP_ATTACK,0) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --to grave local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BE_MATERIAL) e2:SetOperation(s.regop) c:RegisterEffect(e2) end s.listed_series={SET_HERO} function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0,nil)==0 end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=e:GetHandler():GetReasonCard() if r==REASON_SUMMON and rc:IsSetCard(SET_HERO) then local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_GRAVE) e1:SetTarget(s.drtarget) e1:SetOperation(s.droperation) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.drtarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.droperation(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Draw(p,1,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase, you can: Immediately after this effect resolves, Xyz Summon 1 Xyz Monster, using only "Goblin" monsters you control. If you control a "Goblin" Xyz Monster: You can target 1 Effect Monster on the field; detach 1 Xyz Material from a monster on either field, and if you do, negate that monster's effects until the end of this turn. You can only use 1 "Goblin Biker Grand Stampede" effect per turn, and only once that turn.
--百鬼羅刹大暴走 --Goblin Biker Grand Stampede --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Xyz Summon using only "Goblin" monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.xyztg) e1:SetOperation(s.xyzop) c:RegisterEffect(e1) --Detach 1 Xyz material from a monster on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e2:SetCondition(function(_,tp) return Duel.IsExistingMatchingCard(s.gfilter,tp,LOCATION_MZONE,0,1,nil) end) e2:SetTarget(s.dttg) e2:SetOperation(s.dtop) c:RegisterEffect(e2) end s.listed_series={SET_GOBLIN} function s.matfilter(c) return c:IsFaceup() and c:IsSetCard(SET_GOBLIN) and c:IsCanBeXyzMaterial() end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg=Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_MZONE,0,nil) return Duel.IsExistingMatchingCard(Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,mg) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) local mg=Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_MZONE,0,nil) if #mg==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local xc=Duel.SelectMatchingCard(tp,Card.IsXyzSummonable,tp,LOCATION_EXTRA,0,1,1,nil,nil,mg):GetFirst() if xc then Duel.XyzSummon(tp,xc,nil,mg) end end function s.gfilter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(SET_GOBLIN) end function s.disfilter(c) return c:IsNegatableMonster() and c:IsType(TYPE_EFFECT) end function s.dttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc) end if chk==0 then return Duel.CheckRemoveOverlayCard(tp,1,1,1,REASON_EFFECT) and Duel.IsExistingTarget(s.disfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,s.disfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.dtop(e,tp,eg,ep,ev,re,r,rp) if Duel.RemoveOverlayCard(tp,1,1,1,1,REASON_EFFECT)==0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then tc:NegateEffects(e:GetHandler(),RESET_PHASE|PHASE_END) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 "Crashbug Y" from your Deck. You must control a face-up "Crashbug X" to activate and to resolve this effect.
--バグマンZ --Crashbug Z local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={87526784,23915499} function s.cfilter(c) return c:IsFaceup() and c:IsCode(87526784) end function s.spfilter(c,e,tp) return c:IsCode(23915499) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) then return end local tc=Duel.GetFirstMatchingCard(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters You can discard any number of cards to the GY, then target the same number of cards your opponent controls; return those cards to the hand. You can only use this effect of "Brionac, Dragon of the Ice Barrier" once per turn.
--氷結界の龍 ブリューナク --Brionac, Dragon of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.costfilter(c) return c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local rt=Duel.GetTargetCount(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,nil) if chk==0 then return aux.IceBarrierDiscardCost(s.costfilter,true,1,rt)(e,tp,eg,ep,ev,re,r,rp,0) end local cg=aux.IceBarrierDiscardCost(s.costfilter,true,1,rt)(e,tp,eg,ep,ev,re,r,rp,1) e:SetLabel(cg) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end local ct=e:GetLabel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local eg=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,eg,ct,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local rg=tg:Filter(Card.IsRelateToEffect,nil,e) if #rg>0 then Duel.SendtoHand(rg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent would Special Summon exactly 1 monster: Negate the Special Summon, and if you do, destroy it.
--昇天の黒角笛 --Black Horn of Heaven local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SPSUMMON) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and #eg==1 and Duel.GetCurrentChain(true)==0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,#eg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp,chk) Duel.NegateSummon(eg) Duel.Destroy(eg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be treated as 2 Tributes for the Tribute Summon of a Warrior monster. You can only use each of the following effects of "Gaia the Fierce Knight Origin" once per turn. You can send 1 Level 5 or higher monster from your hand to the GY; Special Summon this card from your hand. During the Battle Phase (Quick Effect): You can banish this card from your GY, then target 1 monster on the field whose current ATK is different from its original ATK; its ATK becomes its original ATK.
--暗黒騎士ガイアオリジン --Gaia the Fierce Knight Origin --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Can be treated as 2 tributes for a warrior monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DOUBLE_TRIBUTE) e2:SetValue(s.dccon) c:RegisterEffect(e2) --Banish from GY; reset a monster's ATK to its original ATK local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_GRAVE) e3:SetHintTiming(TIMING_DAMAGE_STEP) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.atkcon) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end --Specifically lists itself s.listed_names={id} --Check for level 5+ monster function s.spfilter(c) return c:IsLevelAbove(5) and c:IsAbleToGraveAsCost() end --Send 1 level 5+ monster from hand to the GY as cost function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,s.spfilter,1,1,REASON_COST,e:GetHandler()) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end --Special summon itself from hand function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end --Check if monster being tribute summoned is a warrior monster function s.dccon(e,c) return c:IsRace(RACE_WARRIOR) end --Check for a monster with its ATK different from its original ATK function s.atkfilter(c) return c:IsFaceup() and c:GetAttack()~=c:GetBaseAttack() end --Check if it is the battle phase function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() and aux.StatChangeDamageStepCondition() end --Activation legality function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end --Reset a monster's ATK to its original ATK function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetBaseAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send monster(s) from your hand and/or face-up field to the GY whose total Levels equal 10; draw 2 cards.
--十種神鏡陣 --Tokusano Shinkyojin --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:HasLevel() and c:IsAbleToGraveAsCost() and (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,nil) local ct=#g if chk==0 then return ct>0 and g:CheckWithSumEqual(Card.GetLevel,10,1,ct) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local cg=g:SelectWithSumEqual(tp,Card.GetLevel,10,1,ct) Duel.SendtoGrave(cg,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can reveal 1 Link Monster in your Extra Deck, and if you do, when you Link Summon this turn, you can treat this card as Link Material with the same name, Type, and Attribute as the revealed monster. If this card is sent to the GY as Link Material: You can add 1 Level 5 or higher Cyberse monster from your Deck to your hand. You can only use each effect of "Formud Skipper" once per turn.
--フォーマッド・スキッパー --Formud Skipper local s,id=GetID() function s.initial_effect(c) --Reveal 1 Link Monster in your Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.revtg) e1:SetOperation(s.revop) c:RegisterEffect(e1) --Search 1 Level 5 or higher Cyberse monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_LINK end) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.revfilter(c,code) return c:IsLinkMonster() and not c:IsCode(code) end function s.revtg(e,tp,eg,ep,ev,re,r,rp,chk) local code=e:GetHandler():GetCode(nil,SUMMON_TYPE_LINK,tp) if chk==0 then return Duel.IsExistingMatchingCard(s.revfilter,tp,LOCATION_EXTRA,0,1,nil,code) end end function s.revop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local code=c:GetCode(nil,SUMMON_TYPE_LINK,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.revfilter,tp,LOCATION_EXTRA,0,1,1,nil,code):GetFirst() if not rc then return end Duel.ConfirmCards(1-tp,rc) local code1,code2=rc:GetOriginalCodeRule() --Can be treated as the revealed monster's name, Type, and Attribute, when used as Link Material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_FORMUD_SKIPPER) e1:SetLabel(ASSUME_CODE,code1,ASSUME_RACE,rc:GetRace(),ASSUME_ATTRIBUTE,rc:GetAttribute()) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end function s.thfilter(c) return c:IsRace(RACE_CYBERSE) and c:IsLevelAbove(5) 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 you do not control another "Beacon of White", and you have 3 or more "Blue-Eyes" monsters in your GY: Target 1 of them; Special Summon it, but it has its effects negated, also equip it with this card. When this card leaves the field, banish the equipped monster. Other monsters you control cannot attack, also if you have any number of "Blue-Eyes" monster(s) in your GY, the equipped monster can attack up to that number of times during each Battle Phase.
--光の導き --Beacon of White local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --extra attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_EXTRA_ATTACK) e2:SetValue(s.val) c:RegisterEffect(e2) --remove local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetOperation(s.rmop) c:RegisterEffect(e3) --cannot attack local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_ATTACK) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(s.ftarget) c:RegisterEffect(e4) end s.listed_series={SET_BLUE_EYES} s.listed_names={id} function s.spfilter(c,e,tp) return c:IsSetCard(SET_BLUE_EYES) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.gvfilter(c) return c:IsSetCard(SET_BLUE_EYES) end function s.cfilter(c) return c:IsFaceup() and c:IsCode(id) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(s.gvfilter,tp,LOCATION_GRAVE,0,3,nil) and not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) end function s.eqlimit(e,c) return e:GetOwner()==c end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end Duel.Equip(tp,c,tc) --Add Equip limit local e1=Effect.CreateEffect(tc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) c:RegisterEffect(e1) --Disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_DISABLE_EFFECT) tc:RegisterEffect(e3) Duel.SpecialSummonComplete() end end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetEquipTarget() if tc then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.ftarget(e,c) return e:GetHandler():GetEquipTarget()~=c end function s.val(e,c) local ct=Duel.GetMatchingGroupCount(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_GRAVE,0,nil,SET_BLUE_EYES) return math.max(0,ct-1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot Tribute this face-up card on the field, and cannot target it with card effects. You can only use each of these effects of "Darkest Diabolos, Lord of the Lair" once per turn. ● If a DARK monster you control is Tributed (except during the Damage Step): You can Special Summon this card from your GY (if it was there when you Tributed) or hand (even if not). ● You can Tribute 1 DARK monster; your opponent places 1 card from their hand on either the top or bottom of the Deck.
--闇黒の魔王ディアボロス --Darkest Diabolos, Lord of the Lair --Scripted by Eerie Code, completed by Lyris local s,id=GetID() function s.initial_effect(c) --cannot release local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetValue(s.sumlimit) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_RELEASE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,1) e2:SetTarget(s.relval) e2:SetValue(1) c:RegisterEffect(e2) --cannot be target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) --spsummon local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_RELEASE) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetRange(LOCATION_HAND|LOCATION_GRAVE) e4:SetCountLimit(1,id) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) --to deck local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1,{id,1}) e5:SetCost(s.tdcost) e5:SetTarget(s.tdtg) e5:SetOperation(s.tdop) c:RegisterEffect(e5) end function s.sumlimit(e,c) if not c then return false end return not c:IsControler(e:GetHandlerPlayer()) end function s.relval(e,c) return c==e:GetHandler() end function s.spcfilter(c,tp) return c:IsPreviousControler(tp) and c:GetPreviousAttributeOnField()&ATTRIBUTE_DARK==ATTRIBUTE_DARK end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spcfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ((c:IsLocation(LOCATION_GRAVE) and not eg:IsContains(c)) or (c:IsLocation(LOCATION_HAND))) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.tdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsAttribute,1,false,nil,nil,ATTRIBUTE_DARK) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsAttribute,1,1,false,nil,nil,ATTRIBUTE_DARK) Duel.Release(g,REASON_COST) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_HAND,1,nil) end end function s.tdop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(1-tp,Card.IsAbleToDeck,1-tp,LOCATION_HAND,0,1,1,nil) if #g>0 then if Duel.SelectOption(1-tp,aux.Stringid(id,2),aux.Stringid(id,3))==0 then Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT) else Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be destroyed by battle with a Level 7 or lower monster. During each of your End Phases: This card gains 1000 ATK. If this card attacks, this increased ATK returns to 0, after damage calculation.
--サテライト・キャノン --Satellite Cannon local s,id=GetID() function s.initial_effect(c) --ind local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(s.indval) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetCondition(s.atkcon) e2:SetOperation(s.atkop) c:RegisterEffect(e2) --atk clear local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BATTLED) e3:SetOperation(s.retop) c:RegisterEffect(e3) end function s.indval(e,c) return c:IsLevelBelow(7) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c==Duel.GetAttacker() then c:ResetEffect(RESET_DISABLE,RESET_EVENT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If you have an "Igknight" card in your other Pendulum Zone: You can destroy both cards in your Pendulum Zones, and if you do, add 1 FIRE Warrior-Type monster from your Deck or Graveyard to your hand. ---------------------------------------- [ Flavor Text ] A high-ranking Igknight warrior. When he does enter the fray, his sweeping attacks are feared not just by the enemy but also his own troops.
--イグナイト・ライオット --Igknight Margrave local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --tohand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_IGKNIGHT} function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_PZONE,0,1,e:GetHandler(),SET_IGKNIGHT) end function s.filter(c) return c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local dg=Duel.GetFieldGroup(tp,LOCATION_PZONE,0) if #dg<2 then return end if Duel.Destroy(dg,REASON_EFFECT)~=2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn: You can discard this card; until the End Phase, "Gravekeeper's" monsters you control cannot be destroyed by battle.
--シャブティのお守り --Charm of Shabti local s,id=GetID() function s.initial_effect(c) --indes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfDiscard) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GRAVEKEEPERS} function s.condition(e,tp,eg,ep,ev,re,r,rp) local ph=Duel.GetCurrentPhase() return ph~=PHASE_MAIN2 and ph~=PHASE_END end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTarget(s.tgfilter) e1:SetValue(1) Duel.RegisterEffect(e1,tp) end function s.tgfilter(e,c) return c:IsSetCard(SET_GRAVEKEEPERS) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: If it is the Main Phase: Apply these effects in sequence. ● Your opponent draws 1 card. ● Send 1 card from your hand to the GY. ● Give control of this card to your opponent. During your Main Phase: You can Special Summon this card from your hand to your opponent's field in face-down Defense Position. If this card is Normal or Special Summoned: You can change 1 face-down monster on the field to face-up Attack or Defense Position. You can only use each effect of "Mimighoul Archfiend" once per turn.
--ミミグル・デーモン --Mimighoul Archfiend --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --FLIP: Apply these effects in sequence local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TOGRAVE+CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_F) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) --Special Summon this card to your opponent's field in face-down Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.selfsptg) e2:SetOperation(s.selfspop) c:RegisterEffect(e2) --Flip 1 face-down monster face-up local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.postg) e3:SetOperation(s.posop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) end s.listed_series={SET_MIMIGHOUL} function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end if Duel.IsPlayerCanDraw(1-tp,1) then Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-tp,1) end if Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,nil) then Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) end local c=e:GetHandler() if c:IsAbleToChangeControler() then Duel.SetOperationInfo(0,CATEGORY_CONTROL,c,1,0,0) end end function s.effop(e,tp,eg,ep,ev,re,r,rp,chk) --Your opponent draws 1 card Duel.Draw(1-tp,1,REASON_EFFECT) local break_chk=false --Send 1 card from your hand to the GY Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then break_chk=true Duel.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT) end --Give control of this card to your opponent local c=e:GetHandler() if c:IsRelateToEffect(e) then if break_chk then Duel.BreakEffect() end Duel.GetControl(c,1-tp) end end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE,1-tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,1-tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(tp,c) end end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,tp,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local tc=Duel.SelectMatchingCard(tp,aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil):GetFirst() if tc then Duel.HintSelection(tc) local pos=Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK|POS_FACEUP_DEFENSE) Duel.ChangePosition(tc,pos) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can change the battle position of the equipped monster to Defense Position. When the equipped monster is returned from the field to the hand and this card is sent to the Graveyard, inflict 600 damage to your opponent. If this card is in the Graveyard, you can add it to your hand instead of conducting a normal draw during your Draw Phase.
--スピリット・バーナー --Spirit Burner local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Change the position of the equipped monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --When the equipped monster is returned from the field to the hand and this card is sent to the GY, inflict 600 damage to your opponent local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --Add this card to your hand instead of conducting your normal draw local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PREDRAW) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(s.retcon) e3:SetTarget(s.rettg) e3:SetOperation(s.retop) c:RegisterEffect(e3) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local ec=e:GetHandler():GetEquipTarget() if chk==0 then return ec and ec:IsAttackPos() and ec:IsCanChangePosition() end end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.ChangePosition(c:GetEquipTarget(),POS_FACEUP_DEFENSE) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ec=c:GetPreviousEquipTarget() return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsPreviousLocation(LOCATION_MZONE) and ec:IsLocation(LOCATION_HAND) 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(600) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.GetDrawCount(tp)>0 end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) end function s.retop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() _replace_count=_replace_count+1 if _replace_count<=_replace_max and c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 2 Cyberse monsters from your GY. You can target 1 monster your opponent controls with higher ATK than this card (Quick Effect); banish it until the End Phase. You can only use this effect of "Degrade Buster" once per turn.
--デグレネード・バスター --Degrade Buster local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.sprcon) e1:SetTarget(s.sprtg) e1:SetOperation(s.sprop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.sprfilter(c) return c:IsRace(RACE_CYBERSE) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.sprfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) return #rg>1 and aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),0) end function s.sprtg(e,tp,eg,ep,ev,re,r,rp,c) local rg=Duel.GetMatchingGroup(s.sprfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.sprop(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.rmfilter(c,atk) return c:IsFaceup() and c:GetAttack()>atk and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local atk=e:GetHandler():GetAttack() if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.rmfilter(chkc,atk) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE,1,nil,atk) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE,1,1,nil,atk) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Remove(tc,0,REASON_EFFECT|REASON_TEMPORARY)~=0 then tc: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_PHASE+PHASE_END) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetLabelObject(tc) e1:SetCountLimit(1) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabelObject():GetFlagEffect(id)~=0 end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetLabelObject()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish all Spell Cards from your Graveyard; destroy all face-up monsters your opponent controls with DEF less than or equal to the number of Spell Cards you banished x 300.
--暴走する魔力 --That Wacky Magic! local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.cfilter(c) return c:IsSpell() and c:IsAbleToRemove() end function s.filter(c,def) return c:IsFaceup() and c:IsDefenseBelow(def) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) local ct=Duel.GetMatchingGroupCount(s.cfilter,tp,LOCATION_GRAVE,0,nil) return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil,ct*300) end local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE,0,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) e:SetLabel(#g*300) local sg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil,#g*300) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil,e:GetLabel()) Duel.Destroy(sg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Nordic" monsters on the field cannot be destroyed by battle. If this card on the field is destroyed: Destroy all "Nordic" monsters on the field.
--極星の輝き --The Nordic Lights 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) --battle indestructable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.indtg) e2:SetValue(1) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_series={SET_NORDIC} function s.indtg(e,c) return c:IsSetCard(SET_NORDIC) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.desfilter(c) return c:IsFaceup() and c:IsSetCard(SET_NORDIC) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 monsters Your opponent cannot target monsters for attacks, except this one. Once per turn: You can detach 1 Xyz Material from this card, then target 1 face-up monster you control; it can make a second attack during each Battle Phase this turn.
--シャーク・フォートレス --Shark Fortress local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz summon procedure Xyz.AddProcedure(c,nil,5,2) --Targeted monster can make a second attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.condition) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Opponent can only target this card for attacks local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetValue(s.atlimit) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsAbleToEnterBP() end function s.filter(c) return c:IsFaceup() and not c:IsHasEffect(EFFECT_EXTRA_ATTACK) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Can make a second attack local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3201) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) end end function s.atlimit(e,c) return c~=e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 WATER Dragon-Type monster you control; this card's Level becomes the current Level of that monster.
--幻木龙 --Mythic Tree Dragon local s,id=GetID() function s.initial_effect(c) --lvchange local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) end function s.lvfilter(c,lv) local clv=c:GetLevel() return c:IsFaceup() and clv>0 and clv~=lv and c:IsAttribute(ATTRIBUTE_WATER) and c:IsRace(RACE_DRAGON) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.lvfilter(chkc,e:GetHandler():GetLevel()) end if chk==0 then return Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_MZONE,0,1,nil,e:GetHandler():GetLevel()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,0,1,1,nil,e:GetHandler():GetLevel()) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(tc:GetLevel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Both players toss a coin once. If a player's result is Heads, they gain 2000 Life Points, and if their result is Tails, they take 2000 damage.
--運命の分かれ道 --The Paths of Destiny local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_COIN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.toss_coin=true function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,PLAYER_ALL,2) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local res=Duel.TossCoin(tp,1) if res==COIN_HEADS then Duel.Recover(tp,2000,REASON_EFFECT) elseif res==COIN_TAILS then Duel.Damage(tp,2000,REASON_EFFECT) end res=Duel.TossCoin(1-tp,1) if res==COIN_HEADS then Duel.Recover(1-tp,2000,REASON_EFFECT) elseif res==COIN_TAILS then Duel.Damage(1-tp,2000,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase 2: You can send this card from your hand to the Graveyard; add 1 "Bujin" monster from your Deck to your hand. You cannot activate cards or effects the turn you activate this effect, except "Bujin" cards. You can only use the effect of "Bujingi Peacock" once per turn.
--武神器-ヤサカニ --Bujingi Peacock local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) end s.listed_series={SET_BUJIN} function s.chainfilter(re,tp,cid) return re:GetHandler():IsSetCard(SET_BUJIN) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_MAIN2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)==0 and c:IsAbleToGraveAsCost() end Duel.SendtoGrave(c,REASON_COST) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.aclimit(e,re,tp) return not re:GetHandler():IsSetCard(SET_BUJIN) end function s.filter(c) return c:IsSetCard(SET_BUJIN) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can excavate cards from the top of your Deck equal to the number of other WIND monsters you control, add 1 excavated card to your hand, also place the rest on the bottom of your Deck in any order. You can banish this card from your GY, then target 1 Level 3 or higher WIND monster you control; reduce its Level by 2. You can only use each effect of "Speedroid Fuki-Modoshi Piper" once per turn.
--SR吹持童子 --Speedroid Fuki-Modoshi Piper --scripted by Hatter local s,id=GetID() function s.initial_effect(c) --excavate and add to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --reduce level local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,{id,1}) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.lvtg) e3:SetOperation(s.lvop) c:RegisterEffect(e3) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WIND),tp,LOCATION_MZONE,0,e:GetHandler()) return ct>0 and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=ct and Duel.GetDecktopGroup(tp,ct):FilterCount(Card.IsAbleToHand,nil)>0 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WIND),tp,LOCATION_MZONE,0,e:GetHandler()) Duel.ConfirmDecktop(tp,ct) local g=Duel.GetDecktopGroup(tp,ct) if #g<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.DisableShuffleCheck() if sg:GetFirst():IsAbleToHand() then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) else Duel.SendtoGrave(sg,REASON_RULE) end ct=ct-1 if ct>0 then Duel.MoveToDeckBottom(ct,tp) Duel.SortDeckbottom(tp,tp,ct) end end function s.filter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WIND) and c:IsLevelAbove(3) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Reduce Level local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(-2) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] You can banish this card from your Pendulum Zone; add 2 face-up Pendulum Monster Cards with the same name from your Extra Deck to your hand. You can only use this effect of "Rescue Hamster" once per Duel. ---------------------------------------- [ Monster Effect ] If this card was Normal Summoned this turn and you have a face-up Level 5 or lower Pendulum Monster Card in your Extra Deck: You can Tribute this card; choose 1 face-up Level 5 or lower Pendulum Monster Card in your Extra Deck, and Special Summon 2 monsters from your Deck with the same name as that card, but they have their effects negated, also they are destroyed during the End Phase.
--レスキューラット --Rescue Hamster local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_DUEL) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetOperation(s.regop) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCost(Cost.SelfTribute) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsAbleToHand() end function s.filter2(c,g) return g:IsExists(Card.IsCode,1,c,c:GetCode()) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_EXTRA,0,nil) return g:IsExists(s.filter2,1,nil,g) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_EXTRA) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_EXTRA,0,nil) local sg=g:Filter(s.filter2,nil,g) if #sg==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local hg1=sg:Select(tp,1,1,nil) local hg2=sg:Filter(Card.IsCode,hg1:GetFirst(),hg1:GetFirst():GetCode()) hg1:AddCard(hg2:GetFirst()) Duel.SendtoHand(hg1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,hg1) end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) 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:IsFaceup() and c:IsType(TYPE_PENDULUM) and c:IsLevelBelow(5) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_DECK,0,2,nil,c:GetCode(),e,tp) end function s.spfilter2(c,code,e,tp) return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g==0 then return end local code=g:GetFirst():GetCode() local dg=Duel.GetMatchingGroup(s.spfilter2,tp,LOCATION_DECK,0,nil,code,e,tp) if #dg>1 then local c=e:GetHandler() local fid=c:GetFieldID() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg1=dg:Select(tp,1,1,nil) local tc1=sg1:GetFirst() local sg2=dg:Filter(Card.IsCode,tc1,tc1:GetCode()) local tc2=sg2:GetFirst() Duel.SpecialSummonStep(tc1,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonStep(tc2,0,tp,tp,false,false,POS_FACEUP) tc1:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) tc2:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) Duel.SpecialSummonComplete() sg1:Merge(sg2) sg1:KeepAlive() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(sg1) e1:SetCondition(s.descon) e1:SetOperation(s.desop) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc1:RegisterEffect(e2) local e3=e2:Clone() tc2:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetCode(EFFECT_DISABLE_EFFECT) e4:SetReset(RESET_EVENT|RESETS_STANDARD) tc1:RegisterEffect(e4) local e5=e4:Clone() tc2:RegisterEffect(e5) end end function s.desfilter(c,fid) return c:GetFlagEffectLabel(id)==fid end function s.descon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() if not g:IsExists(s.desfilter,1,nil,e:GetLabel()) then g:DeleteGroup() e:Reset() return false else return true end end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local tg=g:Filter(s.desfilter,nil,e:GetLabel()) Duel.Destroy(tg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, or only "Amazoness" monsters: You can Special Summon this card from your hand. If this card is Normal or Special Summoned: You can Set 1 "Amazoness" Spell/Trap or 1 "Polymerization" directly from your Deck, also you can only attack with "Amazoness" monsters for the rest of this turn. You can only use each effect of "Amazoness War Chief" once per turn.
--アマゾネスの戦士長 --Amazoness War Chief --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Set 1 "Amazoness" Spell/Trap or "Polymerization" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_AMAZONESS} s.listed_names={CARD_POLYMERIZATION} function s.cfilter(c) return c:IsFacedown() or not c:IsSetCard(SET_AMAZONESS) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not 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) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.setfilter(c) return (c:IsCode(CARD_POLYMERIZATION) or (c:IsSetCard(SET_AMAZONESS) and c:IsSpellTrap())) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local tc=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.SSet(tp,tc) end local c=e:GetHandler() --Cannot attack, except with "Amazoness" monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return not c:IsSetCard(SET_AMAZONESS) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,2),nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, when an opponent's monster declares an attack: You can target 1 other "Heroic" monster you control; this card gains ATK equal to that face-up monster's original ATK, until the end of the Battle Phase.
--H・C スパルタス --Heroic Challenger - Spartan local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCountLimit(1) e1:SetCondition(s.atkcon) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end s.listed_series={SET_HEROIC} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_HEROIC) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,e:GetHandler()) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetBaseAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 "Darklord" monster from your hand or face-up field to the GY; destroy 1 card on the field. You can only activate 1 "Darklord Rebellion" per turn.
--背徳の堕天使 --Darklord Rebellion 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_DARKLORD} function s.costfilter(c) return c:IsSetCard(SET_DARKLORD) and c:IsMonster() and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(nil,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local exc=nil if e:IsHasType(EFFECT_TYPE_ACTIVATE) then exc=e:GetHandler() end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,exc) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local exc=nil if e:IsHasType(EFFECT_TYPE_ACTIVATE) then exc=e:GetHandler() end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,exc) if #g>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 "Ghostrick" monster in your hand; this turn, "Ghostrick" cards you control, and face-down Defense Position monsters you control, cannot be targeted by, or be destroyed by, card effects.
--ゴーストリック・アウト --Ghostrick Vanish local s,id=GetID() function s.initial_effect(c) -- local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GHOSTRICK} function s.cfilter(c) return c:IsSetCard(SET_GHOSTRICK) and c:IsMonster() and not c:IsPublic() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE) e1:SetTargetRange(LOCATION_ONFIELD,0) e1:SetTarget(s.tgfilter) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE) e2:SetValue(1) Duel.RegisterEffect(e2,tp) end function s.tgfilter(e,c) return (c:IsFaceup() and c:IsSetCard(SET_GHOSTRICK)) or (c:IsFacedown() and c:IsLocation(LOCATION_MZONE)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned. If you Tribute Summon this card, all Tributes must be WATER. This card gains 300 ATK for each face-up WATER monster you control, except this card.
--ジョーズマン --Jawsman local s,id=GetID() function s.initial_effect(c) --cannot special summon local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --tribute limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRIBUTE_LIMIT) e2:SetValue(s.tlimit) c:RegisterEffect(e2) --atkup local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(s.atkup) c:RegisterEffect(e3) end function s.tlimit(e,c) return not c:IsAttribute(ATTRIBUTE_WATER) end function s.atkfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WATER) end function s.atkup(e,c) return Duel.GetMatchingGroupCount(s.atkfilter,c:GetControler(),LOCATION_MZONE,0,c)*300 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ EARTH monsters All monsters your opponent controls must attack this card, if able. Once per battle, if this card battles an opponent's monster, before damage calculation (Quick Effect): You can send 1 EARTH monster from your hand to the GY; until the end of this turn, that opponent's monster loses 200 ATK, also negate its effects. When your opponent activates a card or effect that targets a Link Monster(s) you control (Quick Effect): You can negate that effect, and if you do, destroy that card. You can only use this effect of "G Golem Dignified Trilithon" once per turn.
--Gゴーレム・ディグニファイド・トリリトン --G Golem Dignified Trilithon --Scripted by Eerie Code, anime version by Larry126 local s,id=GetID() function s.initial_effect(c) --Link Summon c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_EARTH),2) --Must attack this card, if able local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_MUST_ATTACK) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetRange(LOCATION_MZONE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_MUST_ATTACK_MONSTER) e2:SetValue(function(e,c) return c==e:GetHandler() end) c:RegisterEffect(e2) --Reduce ATK and negate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DISABLE+CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_CONFIRM) e3:SetCondition(s.atkcon) e3:SetCost(s.atkcost) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) --Negate and destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,id) e4:SetCondition(s.discon) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local _,bc=Duel.GetBattleMonster(tp) if not bc then return false end e:SetLabelObject(bc) return true end function s.cfilter(c) return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsAbleToGraveAsCost() end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local d=e:GetLabelObject() Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,d,1,1-tp,-200) Duel.SetOperationInfo(0,CATEGORY_DISABLE,d,1,1-tp,LOCATION_MZONE) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local d=e:GetLabelObject() if d and d:IsRelateToBattle() and d:IsFaceup() and d:IsControler(1-tp) then local c=e:GetHandler() --Reduce ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-200) e1:SetReset(RESETS_STANDARD_PHASE_END) d:RegisterEffect(e1) Duel.NegateRelatedChain(d,RESET_TURN_SET) --Negate its effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESETS_STANDARD_PHASE_END) d:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetValue(RESET_TURN_SET) e3:SetReset(RESETS_STANDARD_PHASE_END) d:RegisterEffect(e3) end end function s.tfilter(c,tp) return c:IsFaceup() and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_LINK) and c:IsControler(tp) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if rp==tp or e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) then return false end if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(s.tfilter,1,nil,tp) and Duel.IsChainDisablable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) local rc=re:GetHandler() if chk==0 then return not rc:IsStatus(STATUS_DISABLED) end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) if rc:IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(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:
If this card is in your hand or GY: You can target 1 "Lunalight" card you control, except "Lunalight Yellow Marten"; return it to the hand, and if you do, Special Summon this card in Defense Position, but banish this card when it leaves the field. If this card is sent to the GY by a card effect: You can add 1 "Lunalight" Spell/Trap from your Deck to your hand. You can only use each effect of "Lunalight Yellow Marten" once per turn.
--月光黄鼬 --Lunalight Yellow Marten --Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 "Lunalight" spell/trap from deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end --Lists "Lunalight" archetype s.listed_series={SET_LUNALIGHT} --Specifically lists itself s.listed_names={id} --Check for "Lunalight" card to return to hand function s.thfilter1(c,tp) return c:IsFaceup() and c:IsSetCard(SET_LUNALIGHT) and not c:IsCode(id) and c:IsAbleToHand() and Duel.GetMZoneCount(tp,c) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and s.thfilter1(chkc,tp) end if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.thfilter1,tp,LOCATION_ONFIELD,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter1,tp,LOCATION_ONFIELD,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end --Special summon itself from hand or GY by returning 1 "Lunalight" card to hand function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_HAND) and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end --If sent to the GY by card effect function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end --Check for "Lunalight" spell/trap function s.srchfilter(c) return c:IsSetCard(SET_LUNALIGHT) and c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.srchfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end --Add 1 "Lunalight" spell/trap from deck function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.srchfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 Level 4 or lower Cyberse monster; Special Summon any number of Cyberse Normal Monsters from your Deck and/or GY whose total Levels equal the Tributed monster's Level on the field, but banish them during the End Phase. You can only use this effect of "Prompthorn" once per turn.
--プロンプトホーン --Prompthorn -- 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_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.costfilter(c,e,tp,g,ft) local lv=c:GetLevel() return c:IsLevelBelow(4) and c:IsRace(RACE_CYBERSE) and Duel.GetMZoneCount(tp,c)>0 and (c:IsControler(tp) or c:IsFaceup()) and g:CheckWithSumEqual(Card.GetLevel,lv,1,ft+1) end function s.spfilter(c,e,tp) return c:IsRace(RACE_CYBERSE) and c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end if chk==0 then return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,e,tp,g,ft) end local sg=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,e,tp,g,ft) e:SetLabel(sg:GetFirst():GetLevel()) Duel.Release(sg,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp) if ft<=0 or #g==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:SelectWithSumEqual(tp,Card.GetLevel,e:GetLabel(),1,ft) if #sg>0 then local fid=e:GetHandler():GetFieldID() local tc=sg:GetFirst() for tc in aux.Next(sg) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) end Duel.SpecialSummonComplete() sg:KeepAlive() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(sg) e1:SetCondition(s.rmcon) e1:SetOperation(s.rmop) Duel.RegisterEffect(e1,tp) end end function s.rmfilter(c,fid) return c:GetFlagEffectLabel(id)==fid end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() if not g:IsExists(s.rmfilter,1,nil,e:GetLabel()) then g:DeleteGroup() e:Reset() return false else return true end end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local tg=g:Filter(s.rmfilter,nil,e:GetLabel()) Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "Amorphage" monsters on the field gain 100 ATK and DEF for each "Amorphage" card on the field. If a monster(s) in your hand or you control is Tributed, or destroyed by battle or card effect: You can add 1 "Amorphage" card from your Deck to your hand. You can only use this effect of "Amorphage Infection" once per turn.
--アモルファージ・インフェクション --Amorphage Infection local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_AMORPHAGE)) e2:SetValue(s.value) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --To Hand local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCode(EVENT_RELEASE) e4:SetRange(LOCATION_SZONE) e4:SetCountLimit(1,id) e4:SetCondition(s.thcon1) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_DESTROYED) e5:SetCondition(s.thcon2) c:RegisterEffect(e5) end s.listed_series={SET_AMORPHAGE} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_AMORPHAGE) end function s.value(e,c) return Duel.GetMatchingGroupCount(s.filter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,nil)*100 end function s.cfilter1(c,tp) return c:IsMonster() and c:IsPreviousLocation(LOCATION_MZONE|LOCATION_HAND) and c:IsPreviousControler(tp) end function s.thcon1(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter1,1,nil,tp) end function s.cfilter2(c,tp) return c:IsMonster() and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE|LOCATION_HAND) and c:IsPreviousControler(tp) end function s.thcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter2,1,nil,tp) end function s.thfilter(c) return c:IsSetCard(SET_AMORPHAGE) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish 1 "Red Dragon Archfiend" Synchro Monster from your Graveyard, then target 1 "Red Dragon Archfiend" Synchro Monster you control; its name becomes the banished monster's original name, and replace its effects with the banished monster's original effects.
--レッド・スプレマシー --Red Supremacy local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_RED_DRAGON_ARCHFIEND} s.check=false function s.cfilter(c,tp) local code=c:GetOriginalCode() return c:IsSetCard(SET_RED_DRAGON_ARCHFIEND) and c:IsType(TYPE_SYNCHRO) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,c,code) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) s.check=true return true end function s.filter(c,code) return c:IsFaceup() and c:IsSetCard(SET_RED_DRAGON_ARCHFIEND) and c:IsType(TYPE_SYNCHRO) and (not c:IsCode(code) or not c:IsOriginalCode(code)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc,e:GetLabel()) end if chk==0 then if not s.check then return false end s.check=false return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) local code=g:GetFirst():GetOriginalCode() e:SetLabel(code) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,code) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() local code=e:GetLabel() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(code) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) tc:ReplaceEffect(code,RESET_EVENT|RESETS_STANDARD) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters, including a Tuner If this card is Link Summoned: You can Special Summon 1 Level 3 or lower Tuner from your hand or Deck in Defense Position, but it cannot activate its effects this turn. During your opponent's Main Phase or Battle Phase (Quick Effect): You can banish this card you control; Special Summon 1 Tuner Synchro Monster from your Extra Deck. (This is treated as a Synchro Summon.) You can only use each effect of "Crystron Halqifibrax" once per turn.
--水晶機巧-ハリファイバー --Crystron Halqifibrax --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,nil,2,2,s.lcheck) --Special Summon 1 Level 3 or lower Tuner monster from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --Special Summon 1 Synchro Tuner monster from your Extra Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START|TIMING_BATTLE_END) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_TUNER,lc,sumtype,tp) end function s.hspcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLinkSummoned() end function s.hspfilter(c,e,tp) return c:IsType(TYPE_TUNER) and c:IsLevelBelow(3) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.hspfilter,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.hspop(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.hspfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then --Cannot activate its effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3302) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and (Duel.IsMainPhase() or Duel.IsBattlePhase()) end function s.spfilter(c,e,tp) local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,c,nil,REASON_SYNCHRO) return #pg<=0 and c:IsType(TYPE_SYNCHRO) and c:IsType(TYPE_TUNER) and Duel.GetLocationCountFromEx(tp,tp,e:GetHandler(),c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) local tc=g:GetFirst() if tc and Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)>0 then tc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Toss a coin 3 times. If all 3 results are Heads, destroy all monsters on your opponent's side of the field. If all 3 results are Tails, destroy all monsters on your side of the field. You can only activate this effect once per turn, during your Main Phase.
--サンド・ギャンブラー --Sand Gambler local s,id=GetID() function s.initial_effect(c) --Toss 3 coins and destroy monsters on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COIN+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.toss_coin=true function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,3) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c1,c2,c3=Duel.TossCoin(tp,3) if Duel.CountHeads(c1,c2,c3)==3 then local g=Duel.GetMatchingGroup(nil,tp,0,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) elseif Duel.CountTails(c1,c2,c3)==3 then local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,nil) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase: Ritual Summon 1 "Nekroz" Ritual Monster from your hand or banishment, by Tributing monsters from your hand/field, and/or sending "Nekroz" monsters from your Extra Deck to the GY, whose total Levels equal or exceed its Level. During your Main Phase: You can banish this card and 1 "Nekroz" monster from your GY; add 1 "Nekroz" Spell from your Deck to your hand. You can only use each effect of "Nekroz Divinemirror" once per turn.
--影霊衣の神魔鏡 --Nekroz Divinemirror --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Ritual Summon 1 "Nekroz" Ritual Monster from your hand or banishment, by Tributing monsters from your hand and/or field, and/or sending "Nekroz" monsters from your Extra Deck to the GY, whose total Levels equal or exceed its Level local e1=Ritual.CreateProc({handler=c,lvtype=RITPROC_GREATER,filter=aux.FilterBoolFunction(Card.IsSetCard,SET_NEKROZ),extrafil=s.extrafil,location=LOCATION_HAND|LOCATION_REMOVED}) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCondition(function() return Duel.IsMainPhase() end) c:RegisterEffect(e1) --Add 1 "Nekroz" Spell from your Deck to your hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_NEKROZ} function s.extrafilter(c) return c:IsSetCard(SET_NEKROZ) and c:HasLevel() and c:IsAbleToGrave() end function s.extrafil(e,tp,eg,ep,ev,re,r,rp,chk) return Duel.GetMatchingGroup(s.extrafilter,tp,LOCATION_EXTRA,0,nil) end function s.thcostfilter(c) return c:IsSetCard(SET_NEKROZ) and c:IsMonster() and c:IsAbleToRemoveAsCost() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.thcostfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.thcostfilter,tp,LOCATION_GRAVE,0,1,1,nil) g:AddCard(c) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.thfilter(c) return c:IsSetCard(SET_NEKROZ) and c:IsSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Gains 200 ATK/DEF for each card in your opponent's GY. During your Standby Phase, if this card is in your hand or GY and your opponent has more cards in their GY than you: You can Special Summon this card. You can only use this effect of "Leafplace Plaice" once per turn.
--枯鰈葉リプレース --Leafplace Plaice --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) 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) --Gain ATK/DEF local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.incval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and Duel.GetFieldGroupCount(tp,0,LOCATION_GRAVE)>Duel.GetFieldGroupCount(tp,LOCATION_GRAVE,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.incval(e) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),0,LOCATION_GRAVE)*200 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks an opponent's monster, this card gains 300 ATK during the Damage Step only. If this card is attacked by an opponent's monster, this card loses 500 ATK during the Damage Step only. When this card is selected as an attack target, you can Tribute another "Saber" monster to negate the attack.
--X-セイバー ガラハド --X-Saber Galahad local s,id=GetID() function s.initial_effect(c) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.atkval) c:RegisterEffect(e1) --negate attack local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetCost(s.cost) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.atkval(e,c) local ph=Duel.GetCurrentPhase() if ph~=PHASE_DAMAGE and ph~=PHASE_DAMAGE_CAL then return 0 end if c==Duel.GetAttacker() and Duel.GetAttackTarget() then return 300 end if c==Duel.GetAttackTarget() then return -500 end return 0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsSetCard,1,false,nil,e:GetHandler(),SET_SABER) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsSetCard,1,1,false,nil,e:GetHandler(),SET_SABER) Duel.Release(g,REASON_COST) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.NegateAttack() end