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:
During either player's turn, you can activate "Magical Musket" Spell/Trap Cards from your hand. If a Spell/Trap Card is activated in this card's column: You can discard 1 "Magical Musket" card; draw 2 cards. You can only use this effect of "Magical Musketeer Kidbrave" once per turn.
--魔弾の射手 ザ・キッド --Magical Musketeer Kidbrave local s,id=GetID() function s.initial_effect(c) --Activate "Magical Musket" Spell/Traps from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_QP_ACT_IN_NTPHAND) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_HAND,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_MAGICAL_MUSKET)) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_TRAP_ACT_IN_HAND) c:RegisterEffect(e2) --Draw 2 cards local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_DRAW) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.drcon) e3:SetCost(s.drcost) e3:SetTarget(s.drtg) e3:SetOperation(s.drop) c:RegisterEffect(e3) end s.listed_series={SET_MAGICAL_MUSKET} function s.drcon(e,tp,eg,ep,ev,re,r,rp) if Duel.GetCurrentPhase()&(PHASE_DAMAGE|PHASE_DAMAGE_CAL)>0 or not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return false end local c=e:GetHandler() local p,seq=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CONTROLER,CHAININFO_TRIGGERING_SEQUENCE) return c:IsColumn(seq,p,LOCATION_SZONE) end function s.cfilter(c) return c:IsSetCard(SET_MAGICAL_MUSKET) and c:IsDiscardable() end function s.drcost(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.DiscardHand(tp,s.cfilter,1,1,REASON_COST|REASON_DISCARD) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,2) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: Target 1 Equip Spell Card in your Graveyard; banish that target, and if you do, add it to your hand during your next Standby Phase.
--ヴァイロン・オーム --Vylon Ohm local s,id=GetID() function s.initial_effect(c) --remove local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) end function s.filter(c) return c:IsType(TYPE_EQUIP) and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) 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 and tc:IsRelateToEffect(e) and Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)~=0 then 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:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN) 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) Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks a face-up monster on the field, at the start of the Damage Step: Destroy that monster. Its DEF must be higher than this card's ATK to activate and to resolve this effect.
--スクープ・シューター --Cameraclops local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_START) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return e:GetHandler()==Duel.GetAttacker() and d and d:IsFaceup() and d:GetDefense()>e:GetHandler():GetAttack() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttackTarget(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() if d:IsRelateToBattle() and d:GetDefense()>e:GetHandler():GetAttack() then Duel.Destroy(d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase: Immediately after this effect resolves, Tribute Summon 1 Divine-Beast monster. When you do, you can Tribute a monster(s) your opponent controls, even though you do not control them, but if you Tribute their monster(s) for the Summon, apply this effect. ● Until the end of the next turn, you can only activate 1 card or effect per turn, not counting the effects of Divine-Beast monsters. You can only activate 1 "Soul Crossing" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--交差する魂 --Soul Crossing --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(function()return Duel.IsMainPhase() end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) end function s.chainfilter(re,tp,cid) if Duel.GetFlagEffect(tp,id)==0 then return true end return not (re:IsSpellTrapEffect() or not re:GetHandler():IsRace(RACE_DIVINE)) end function s.filter(c,e,ec) if not c:IsRace(RACE_DIVINE) then return false end local e1=Effect.CreateEffect(ec) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(POS_FACEUP) e1:SetReset(RESET_CHAIN) c:RegisterEffect(e1,true) local res=c:IsSummonable(true,nil,1) or c:IsMSetable(true,nil,1) e1:Reset() return res end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,c):GetFirst() if tc then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_ADD_EXTRA_TRIBUTE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(POS_FACEUP) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) local s1=tc:IsSummonable(true,nil,1) local s2=tc:IsMSetable(true,nil,1) if (s1 and s2 and Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEDOWN_DEFENSE)==POS_FACEUP_ATTACK) or not s2 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetOperation(s.sumsuc) e2:SetLabel(tp) e2:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) tc:RegisterEffect(e2,true) Duel.Summon(tp,tc,true,nil,1) else local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_MSET) e3:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) e3:SetOperation(s.sumsuc) e3:SetLabel(tp) tc:RegisterEffect(e3,true) Duel.MSet(tp,tc,true,nil,1) end end end function s.sumsuc(e,tp,eg,ep,ev,re,r,rp) local player=e:GetLabel() if e:GetHandler():GetMaterial():IsExists(Card.IsPreviousControler,1,nil,1-player) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetCondition(s.accon) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,player) Duel.RegisterFlagEffect(player,id,RESET_PHASE|PHASE_END,0,2) end end function s.accon(e) return Duel.GetCustomActivityCount(id,e:GetHandlerPlayer(),ACTIVITY_CHAIN)>0 end function s.aclimit(e,re,tp) return re:IsSpellTrapEffect() or not re:GetHandler():IsRace(RACE_DIVINE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card only if you have 2 "Zefra" cards in your Pendulum Zones, with active Pendulum Scales of 1 and 7. When this card is activated: Shuffle all monsters you control (if any) into the Deck, except "Zefra" monsters. Neither player can Special Summon monsters, except from the hand or the Extra Deck. While you have a card(s) in your Pendulum Zone, this card cannot be targeted by card effects. Destroy this card if a card(s) in your Pendulum Zone is destroyed. * The above text is unofficial and describes the card's functionality in the OCG.
--セフィラの輝跡 --Zefra Path local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetOperation(s.activate) c:RegisterEffect(e1) --splimit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetTarget(s.splimit) 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_SZONE) e3:SetCondition(s.tgcon) e3:SetValue(1) c:RegisterEffect(e3) --self destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_DESTROY) e4:SetCondition(s.descon) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_series={SET_ZEFRA} function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc1=Duel.GetFieldCard(tp,LOCATION_PZONE,0) local tc2=Duel.GetFieldCard(tp,LOCATION_PZONE,1) if not (tc1 and tc2 and tc1:IsSetCard(SET_ZEFRA) and tc2:IsSetCard(SET_ZEFRA)) then return false end local scl1=tc1:GetLeftScale() local scl2=tc2:GetRightScale() if scl1>scl2 then scl1,scl2=scl2,scl1 end return scl1==1 and scl2==7 end function s.filter(c) return (c:IsFacedown() or not c:IsSetCard(SET_ZEFRA)) and c:IsAbleToDeck() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.splimit(e,c,sump,sumtype,sumpos,targetp) return not c:IsLocation(LOCATION_HAND|LOCATION_EXTRA) end function s.tgcon(e) local tp=e:GetHandlerPlayer() return Duel.GetFieldCard(tp,LOCATION_PZONE,0) or Duel.GetFieldCard(tp,LOCATION_PZONE,1) end function s.desfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_PZONE) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.desfilter,1,nil,tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Take control of 1 monster on your opponent's side of the field until the end of the turn that this card's effect is activated. When the controlled monster attacks, it can attack your opponent's Life Points directly.
--X・E・N・O --Jowls of Dark Demise local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsControlerCanBeChanged() end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then if Duel.GetControl(tc,tp,PHASE_END,1)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent controls a monster with a Predator Counter: You can Special Summon this card from your hand. If this card in its owner's possession is destroyed by your opponent's card: You can target 1 DARK Dragon or 1 DARK Plant monster in your GY, except "Predaplant Heliamphorhynchus"; Special Summon it. You can only use each effect of "Predaplant Heliamphorhynchus" once per turn.
--捕食植物ヘリアンフォリンクス --Predaplant Heliamphorhynchus --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --spsummon (self) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon1) e1:SetTarget(s.sptg1) e1:SetOperation(s.spop1) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon2) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end s.counter_list={COUNTER_PREDATOR} function s.spcfilter(c) return c:IsFaceup() and c:GetCounter(COUNTER_PREDATOR)>0 end function s.spcon1(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spcfilter,tp,0,LOCATION_MZONE,1,nil) end function s.sptg1(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.spop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_BATTLE) or (rp~=tp and c:IsReason(REASON_EFFECT) and c:GetPreviousControler()==tp) end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON|RACE_PLANT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.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:
There can only be 1 "Earthbound Immortal" monster on the field. During the Main Phase (Quick Effect): You can banish this card from your hand or GY; send 1 "Earthbound Immortal" monster or "Red Dragon Archfiend" from your hand or face-up Monster Zone to the GY, then you can apply 1 of these effects. ● Special Summon 1 "Earthbound" monster from your Deck or Extra Deck. ● Special Summon 1 "Red Nova Dragon" from your Extra Deck. (This is treated as a Synchro Summon.) You can only use this effect of "Earthbound Immortal Red Nova" once per turn.
--地縛神 スカーレッド・ノヴァ --Earthbound Immortal Red Nova --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --There can only be 1 "Earthbound Immortal" monster on the field c:SetUniqueOnField(1,1,aux.FilterBoolFunction(Card.IsSetCard,SET_EARTHBOUND_IMMORTAL),LOCATION_MZONE) --Send 1 "Earthbound Immortal" monster or "Red Dragon Archfiend" from your hand or face-up Monster Zone to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) end s.listed_names={CARD_RED_DRAGON_ARCHFIEND,97489701} --"Red Nova Dragon" s.listed_series={SET_EARTHBOUND,SET_EARTHBOUND_IMMORTAL} function s.tgfilter(c) return (c:IsSetCard(SET_EARTHBOUND_IMMORTAL) or c:IsCode(CARD_RED_DRAGON_ARCHFIEND)) and c:IsMonster() and c:IsAbleToGrave() and (c:IsFaceup() or not c:IsOnField()) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_MZONE) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.earthboundspfilter(c,e,tp) if not (c:IsSetCard(SET_EARTHBOUND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)) then return false end if c:IsLocation(LOCATION_DECK) then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 elseif c:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,nil,c) end end function s.rednovaspfilter(c,e,tp) return c:IsCode(97489701) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local gc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil):GetFirst() if gc and Duel.SendtoGrave(gc,REASON_EFFECT)>0 and gc:IsLocation(LOCATION_GRAVE) then local b1=Duel.IsExistingMatchingCard(s.earthboundspfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil,e,tp) local b2=Duel.IsExistingMatchingCard(s.rednovaspfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) if not ((b1 or b2) and Duel.SelectYesNo(tp,aux.Stringid(id,1))) then return end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) if op==1 then --Special Summon 1 "Earthbound" monster from your Deck or Extra Deck Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.earthboundspfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end elseif op==2 then --Special Summon "Red Nova Dragon" from your Extra Deck Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.rednovaspfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if not sc then return end Duel.BreakEffect() if Duel.SpecialSummon(sc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) then sc:CompleteProcedure() end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card battles an Effect Monster, after damage calculation: Negate that monster's effects (including in the GY). * The above text is unofficial and describes the card's functionality in the OCG.
--ヴェルズ・オ・ウィスプ --Evilswarm Obliviwisp local s,id=GetID() function s.initial_effect(c) --Disable local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLED) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local a=Duel.GetAttacker() if a==c then a=Duel.GetAttackTarget() end e:SetLabelObject(a) return a and a:IsType(TYPE_EFFECT) and a:IsRelateToBattle() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsFacedown() or not tc:IsRelateToBattle() then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESET_TURN_SET|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TOHAND|RESET_TODECK|RESET_TOFIELD|RESET_OVERLAY) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESET_TURN_SET|RESET_REMOVE|RESET_TEMP_REMOVE|RESET_TOHAND|RESET_TODECK|RESET_TOFIELD|RESET_OVERLAY) tc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except by sending an "Elemental HERO Bubbleman" you control and "Metamorphosis" in your hand to the Graveyard. This card's name is treated as "Elemental HERO Bubbleman" while it is face-up on the field. Destroy an opponent's monster that battles this card at the end of the Damage Step.
--E・HERO バブルマン・ネオ --Elemental HERO Neo Bubbleman local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Cannot be Special Summoned, except by its own effect 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) --Special Summon procedure local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetProperty(EFFECT_FLAG_UNCOPYABLE) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --This card's name becomes "Elemental HERO Bubbleman" local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CHANGE_CODE) e3:SetValue(79979666) c:RegisterEffect(e3) --Destroy a monster that battles with this card local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DAMAGE_STEP_END) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_names={79979666,46411259} --Elemental HERO Bubbleman, Metamorphosis function s.spfilter(c,...) return c:IsCode(...) and c:IsAbleToGraveAsCost() end function s.rescon(sg,e,tp,mg) return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:IsExists(s.chk,1,nil,sg) end function s.chk(c,sg) return c:IsCode(79979666) and sg:IsExists(Card.IsCode,1,c,46411259) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local g1=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil,79979666) local g2=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,46411259) local g=g1:Clone() g:Merge(g2) return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and #g1>0 and #g2>0 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE,0,nil,79979666) sg:Merge(Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,46411259)) local g=aux.SelectUnselectGroup(sg,e,tp,2,2,s.rescon,1,tp,HINTMSG_TOGRAVE,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_COST) g:DeleteGroup() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return bc and bc:IsRelateToBattle() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,bc,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() if bc and bc:IsRelateToBattle() then Duel.Destroy(bc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 face-up monster you control to the GY; Special Summon from your Deck, 1 monster with the same Type and Attribute as that monster in the GY, but 1 Level higher. You can only activate 1 "Transmodify" per turn.
--トランスターン --Transmodify 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:SetLabel(0) e1:SetCountLimit(1,id) 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(100) if chk==0 then return true end end function s.cfilter(c,e,tp,ft) local lv=c:GetOriginalLevel() local rc=c:GetOriginalRace() local att=c:GetOriginalAttribute() local eff4064256={Duel.GetPlayerEffect(tp,4064256)} for _,te in ipairs(eff4064256) do local val=te:GetValue() if val and val(te,c,e,0) then rc=val(te,c,e,1) end end local eff12644061={Duel.GetPlayerEffect(tp,CARD_ADVANCED_DARK)} for _,te in ipairs(eff12644061) do local val=te:GetValue() if val and val(te,c,e,0) then att=val(te,c,e,1) end end return c:IsMonsterCard() and lv>0 and c:IsFaceup() and c:IsAbleToGraveAsCost() and (ft>0 or c:GetSequence()<5) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,lv+1,rc,att,e,tp) end function s.spfilter(c,lv,rc,att,e,tp) return c:IsLevel(lv) and c:IsRace(rc) and c:IsAttribute(att) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return ft>-1 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,e,tp,ft) end e:SetLabel(0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp,ft) local tc=g:GetFirst() Duel.SendtoGrave(tc,REASON_COST) Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if not tc or not tc:IsLocation(LOCATION_GRAVE) or not tc:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetLevel()+1,tc:GetRace(),tc:GetAttribute(),e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If there is a face-up Field Spell Card on the field, you can Special Summon this card (from your hand). You can only control 1 "Chronomaly Tula Guardian".
--先史遺産トゥーラ・ガーディアン --Chronomaly Tula Guardian local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) end 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(Card.IsFaceup,0,LOCATION_FZONE,LOCATION_FZONE,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you draw this card: You can reveal it; Special Summon it from your hand. If this card is Special Summoned from the hand: You can target 1 other face-up monster on the field; banish it until the Standby Phase of your next turn. You can only use each effect of "Fortune Fairy Swee" once per turn.
--占い魔女 スィーちゃん --Fortune Fairy Swee --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DRAW) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --banish 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:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.rmcon) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsPublic() end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function s.rmfilter(c) return c:IsFaceup() and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.rmfilter(chkc) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c) 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,tc:GetPosition(),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:SetRange(LOCATION_REMOVED) e1:SetCountLimit(1) if Duel.IsTurnPlayer(tp) then e1:SetLabel(Duel.GetTurnCount()+2) else e1:SetLabel(Duel.GetTurnCount()+1) end e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) tc:RegisterEffect(e1) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetTurnCount()==e:GetLabel() end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetHandler()) e:Reset() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Plaguespreader Zombie" + 1 or more non-Tuner Zombie-Type monsters Negate the effects of Effect Monsters destroyed by battle with Zombie-Type monsters you control.
--蘇りし魔王 ハ・デス --Revived King Ha Des local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterSummonCode(33420078),1,1,Synchro.NonTunerEx(Card.IsRace,RACE_ZOMBIE),1,99) c:EnableReviveLimit() --Disable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLED) e1:SetRange(LOCATION_MZONE) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.material={33420078} s.listed_names={33420078} function s.operation(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() local p=e:GetHandler():GetControler() if d==nil then return end local tc=nil if a:GetControler()==p and a:IsRace(RACE_ZOMBIE) and d:IsStatus(STATUS_BATTLE_DESTROYED) then tc=d elseif d:GetControler()==p and d:IsRace(RACE_ZOMBIE) and a:IsStatus(STATUS_BATTLE_DESTROYED) then tc=a end if not tc then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD&~(RESET_LEAVE|RESET_TOGRAVE)) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD&~(RESET_LEAVE|RESET_TOGRAVE)) tc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Spell/Trap on the field; destroy that target.
--サイクロン --Mystical Space Typhoon local s,id=GetID() function s.initial_effect(c) --Destroy 1 Spell/Trap on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() and chkc~=c end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Tsukahagi, the Poisonous Mayakashi". If a "Mayakashi" monster(s) in your possession, except "Tsukahagi, the Poisonous Mayakashi", is destroyed by battle or an opponent's card effect, while this card is in the GY: You can Special Summon this card. You cannot Special Summon monsters from the Extra Deck the turn you activate this effect, except "Mayakashi" monsters.
--毒の魔妖-束脛 --Tsukahagi, the Poisonous Mayakashi --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --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:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_GRAVE) e1:SetCondition(s.spcon) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) --Lizard check aux.addContinuousLizardCheck(c,LOCATION_MZONE,s.lizfilter) end s.listed_series={SET_MAYAKASHI} function s.counterfilter(c) return not c:IsSummonLocation(LOCATION_EXTRA) or c:IsSetCard(SET_MAYAKASHI) end function s.cfilter(c,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsSetCard(SET_MAYAKASHI) and not c:IsCode(id) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and rp~=tp end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) 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,true,false,POS_FACEUP) end end function s.splimit(e,c,sump,sumtype,sumpos,targetp) return c:IsLocation(LOCATION_EXTRA) and not c:IsSetCard(SET_MAYAKASHI) end function s.lizfilter(e,c) return not c:IsOriginalSetCard(SET_MAYAKASHI) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 of your banished Dragon-Type monsters; add that target to your hand.
--牙竜転生 --Dragoncarnation local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Cyberse monsters Your opponent's monsters cannot target monsters this card points to for attacks. The first time this card would be destroyed by battle each turn, it is not destroyed, and you take no battle damage from that battle.
--プロトコル・ガードナー --Protocol Gardna --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2,2) c:EnableReviveLimit() --cannot be battle target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_MZONE) e1:SetValue(s.atlimit) c:RegisterEffect(e1) --battle indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.valcon) c:RegisterEffect(e2) --no damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetValue(s.damlimit) c:RegisterEffect(e3) end function s.atlimit(e,c) return e:GetHandler():GetLinkedGroup():IsContains(c) end function s.valcon(e,re,r,rp) if r&REASON_BATTLE~=0 then e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) return true else return false end end function s.damlimit(e,c) if e:GetHandler():GetFlagEffect(id)==0 then return true else return false end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 "Evoltile" monster; Special Summon 1 "Evolsaur" monster from your Deck. (This is treated as a Special Summon by the effect of an "Evoltile" monster.)
--強制進化 --Evo-Force local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_EVOLTILE,SET_EVOLSAUR} function s.cfilter(c,ft,tp) return c:IsSetCard(SET_EVOLTILE) and (ft>0 or (c:IsControler(tp) and c:GetSequence()<5)) and (c:IsControler(tp) or c:IsFaceup()) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,ft,tp) end local rg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,ft,tp) Duel.Release(rg,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_EVOLSAUR) and c:IsCanBeSpecialSummoned(e,170,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==1 then e:SetLabel(0) return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) else return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end end e:SetLabel(0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,170,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control another "Exosister" monster: You can draw 1 card, then if you control "Exosister Irene", you gain 800 LP. If your opponent moves a card(s) out of either GY (except during the Damage Step): You can Special Summon from your Extra Deck, 1 "Exosister" Xyz Monster using this face-up card you control as material. (This is treated as an Xyz Summon.) You can only use each effect of "Exosister Sophia" once per turn.
--エクソシスター・ソフィア --Exosister Sophia --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.drcon) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --Special Summon Xyz local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_LEAVE_GRAVE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(_,tp,_,_,_,_,_,rp)return rp==1-tp end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={79858629} s.listed_series={SET_EXOSISTER} function s.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_EXOSISTER),tp,LOCATION_MZONE,0,1,e:GetHandler()) 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)==d and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,79858629),tp,LOCATION_ONFIELD,0,1,nil) then Duel.BreakEffect() Duel.Recover(tp,800,REASON_EFFECT) end end function s.spfilter(c,e,tp,mc) return c:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsSetCard(SET_EXOSISTER) and mc:IsCanBeXyzMaterial(c,tp) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then local c=e:GetHandler() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsControler(1-tp) or c:IsImmuneToEffect(e) then return end local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) if #pg>1 or (#pg==1 and not pg:IsContains(c)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c):GetFirst() if sc then local mg=Group.FromCards(c) sc:SetMaterial(mg) Duel.Overlay(sc,mg) if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then sc:CompleteProcedure() end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is targeted for an attack: Destroy this card. When this card is sent to the GY by card effect: You can target 1 "Battlin' Boxer" monster in your GY, except "Battlin' Boxer Glassjaw"; add it to your hand.
--BK グラスジョー --Battlin' Boxer Glassjaw local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_BATTLIN_BOXER} function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) end function s.filter(c) return c:IsSetCard(SET_BATTLIN_BOXER) and c:GetCode()~=id and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 "Noble Arms" Equip Spell equipped to this card and 1 face-up monster your opponent controls; destroy them, then draw 1 card, also, this card cannot attack for the rest of this turn. You can only use this effect of "Noble Knight Pellinore" once per turn.
--聖騎士ペリノア --Noble Knight Pellinore local s,id=GetID() function s.initial_effect(c) --Destroy 1 "Noble Arms" equipped to this card and 1 of opponent's monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.listed_series={SET_NOBLE_ARMS} function s.desfilter(c,g) return c:IsFaceup() and c:IsSetCard(SET_NOBLE_ARMS) and g:IsContains(c) end 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(s.desfilter,tp,LOCATION_SZONE,0,1,nil,e:GetHandler():GetEquipGroup()) and Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_SZONE,0,1,1,nil,e:GetHandler():GetEquipGroup()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetTargetCards(e) if #g>0 and Duel.Destroy(g,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) --Cannot attack this 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_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Gyroid" + "Steamroid"
--スチームジャイロイド --Steam Gyroid local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,18325492,44729197) end s.material_setcode=SET_ROID
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 Spell/Trap; add 1 "Power Bond" from your Deck to your hand, you can only use Dragon or Machine "Cyber" monsters as Fusion Material this turn, also once when you Fusion Summon this turn, you can also banish monster(s) from your GY as material. If this card is sent to the GY: You can send 1 "Cyberdark" monster from your Deck to the GY, with a different name from the cards in your GY. You can only use each effect of "Cyberdark Chimera" once per turn.
--サイバー・ダーク・キメラ --Cyberdark Chimera --Scripted by Rundas --Necessary changes to the Fusion Proc made by pyrQ and edo9300 local s,id=GetID() function s.initial_effect(c) --Add 1 "Power Bond" from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Send 1 "Cyberdark" monster from your Deck to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) end s.listed_names={37630732} --"Power Bond" s.listed_series={SET_CYBER,SET_CYBERDARK} function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.AND(Card.IsSpellTrap,Card.IsDiscardable),tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,aux.AND(Card.IsSpellTrap,Card.IsDiscardable),1,1,REASON_COST|REASON_DISCARD) end function s.thfilter(c) return c:IsCode(37630732) 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 local c=e:GetHandler() --Can also banish monsters from your GY as material once when you Fusion Summon this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_EXTRA_FUSION_MATERIAL) e1:SetCountLimit(1) e1:SetTargetRange(LOCATION_GRAVE,0) e1:SetTarget(function(e,c) return c:IsAbleToRemove() and c:IsMonster() end) e1:SetOperation(Fusion.BanishMaterial) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,2)) --Can only use Dragon or Machine "Cyber" monsters as Fusion Material this turn local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(0xff,0xff) e2:SetTarget(function(e,c) return not (c:IsSetCard(SET_CYBER) and c:IsRace(RACE_DRAGON|RACE_MACHINE)) end) e2:SetValue(function(e,c) return c and c:IsControler(e:GetHandlerPlayer()) end) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,3)) end function s.tgfilter(c,tp) return c:IsSetCard(SET_CYBERDARK) and c:IsMonster() and c:IsAbleToGrave() and not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,c:GetCode()) 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,tp) 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,tp) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only equip this card to a Level 3 or lower Normal Monster on your side of the field. When you activate this card, Tribute all Normal Monsters (except Tokens) on your side of the field, except the equipped monster. Increase the ATK of the equipped monster by 1000 points for each Normal Monster that you Tributed.
--魂喰らいの魔刀 --Sword of the Soul-Eater local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,0,s.filter,nil,s.cost,s.target,s.operation) end function s.filter(c) return c:IsType(TYPE_NORMAL) and c:IsLevelBelow(3) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) if chk==0 then return true end end function s.rfilter(c) local tpe=c:GetType() return (tpe&TYPE_NORMAL)~=0 and (tpe&TYPE_TOKEN)==0 and c:IsReleasable() end function s.target(e,tp,eg,ep,ev,re,r,rp,tc,chk) local label=e:GetLabel() e:SetLabel(0) if chk==0 then return true end if label==1 then local rg=Duel.GetMatchingGroup(s.rfilter,tp,LOCATION_MZONE,0,tc) Duel.Release(rg,REASON_COST) Duel.SetTargetParam(#rg*1000) else Duel.SetTargetParam(0) end 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 and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM)) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Cyber Dragon" while in the GY. Once per turn: You can reveal 1 Spell in your hand; this card's name becomes "Cyber Dragon" until the End Phase. If this card attacks an opponent's monster, it gains 300 ATK during the Damage Step only.
--サイバー・ドラゴン・ツヴァイ --Cyber Dragon Zwei local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.atkcon) e1:SetValue(300) c:RegisterEffect(e1) --change code local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.cost) e2:SetOperation(s.cdop) c:RegisterEffect(e2) --code local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CHANGE_CODE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_GRAVE) e3:SetValue(CARD_CYBER_DRAGON) c:RegisterEffect(e3) end function s.atkcon(e) local phase=Duel.GetCurrentPhase() return (phase==PHASE_DAMAGE or phase==PHASE_DAMAGE_CAL) and Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget()~=nil end function s.costfilter(c) return c:IsSpell() 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.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) end function s.cdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(CARD_CYBER_DRAGON) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Level 8 or higher Synchro Monster: Banish all monsters on the field, except the monster(s) with the highest Level, also the remaining face-up monsters on the field are unaffected by other card effects, except their own, until the end of this turn. If a DARK Dragon Synchro Monster is Synchro Summoned to your field while this card is in your GY: You can add this card to your hand. You can only use this effect of "Red Reign" once per turn.
--スカーレッド・レイン --Red Reign --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Banish all monsters on the field, except monster(s) with the highest level local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) 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.activate) c:RegisterEffect(e1) --Add this card from GY to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsFaceup() and c:IsLevelAbove(8) and c:IsType(TYPE_SYNCHRO) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local fdwng,fupg=g:Split(Card.IsFacedown,nil) local exg=fupg:GetMaxGroup(Card.GetLevel) or Group.CreateGroup() if chk==0 then return #fdwng>0 or #(g-exg)>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,(g-exg),#(g-exg),tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local fg=g:Filter(aux.FaceupFilter(Card.IsLevelAbove,1),nil) if #fg>0 then g=g-fg:GetMaxGroup(Card.GetLevel) end Duel.Remove(g,POS_FACEUP,REASON_EFFECT) local ig=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #ig==0 then return end ig:ForEach(s.immop,e:GetHandler()) end function s.immop(tc,c) --Unaffected by other card effects local e1=Effect.CreateEffect(c) e1:SetDescription(3100) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.efilter) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end function s.efilter(e,te) return te:GetOwner()~=e:GetHandler() end function s.thcfilter(c,tp) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsControler(tp) and c:IsSynchroSummoned() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.thcfilter,1,nil,tp) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Labrynth" monster from your Deck, also until the end of the next turn after this card resolves, you cannot Special Summon monsters from the Deck or Extra Deck, except Fiend monsters. If a monster leaves the field by your Normal Trap effect, while this card is in your GY, except the turn it was sent there: You can Set this card. You can only use each effect of "Welcome Labrynth" once per turn.
--ウェルカム・ラビュリンス --Welcome Labrynth --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Labrynth" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Set itself if a monster leaves the field due to a Normal Trap's effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.setcon) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_series={SET_LABRYNTH} function s.spfilter(c,e,tp) return c:IsSetCard(SET_LABRYNTH) 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,0,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 aux.WelcomeLabrynthTrapDestroyOperation(e,tp) if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end local c=e:GetHandler() --Cannot Special Summon from the Deck or Extra Deck, except Fiend monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END,2) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_DECK|LOCATION_EXTRA) and not c:IsRace(RACE_FIEND) end) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalRace(RACE_FIEND) end) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return aux.exccon(e,tp,eg,ep,ev,re,r,rp) and rp==tp and r&REASON_EFFECT==REASON_EFFECT and re and re:IsTrapEffect() and re:GetHandler():GetOriginalType()==TYPE_TRAP and eg:IsExists(Card.IsPreviousLocation,1,nil,LOCATION_MZONE) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Unless you have a "Symphonic Warrior" card in your other Pendulum Zone, this card's Pendulum Scale becomes 4. Once per turn, during your End Phase: You can target 1 of your banished "Symphonic Warrior" monsters; add it to your hand. ---------------------------------------- [ Monster Effect ] You can Special Summon this card (from your hand) by removing 3 Symphonic Counters from your field. After you Normal or Special Summon this card, you can Normal Summon 1 monster during your Main Phase this turn, in addition to your Normal Summon/Set. (You can only gain this effect once per turn.)
--音響戦士マイクス --Symphonic Warrior Miccs local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --scale local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CHANGE_LSCALE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_PZONE) e2:SetCondition(s.slcon) e2:SetValue(4) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_CHANGE_RSCALE) c:RegisterEffect(e3) --tohand local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_TOHAND) e4:SetDescription(aux.Stringid(id,0)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetRange(LOCATION_PZONE) e4:SetCountLimit(1) e4:SetCondition(s.thcon) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_SPSUMMON_PROC) e5:SetProperty(EFFECT_FLAG_UNCOPYABLE) e5:SetRange(LOCATION_HAND) e5:SetCondition(s.spcon) e5:SetOperation(s.spop) c:RegisterEffect(e5) --extra summon local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e6:SetCode(EVENT_SUMMON_SUCCESS) e6:SetOperation(s.sumop) c:RegisterEffect(e6) local e7=e6:Clone() e7:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e7) end s.listed_series={SET_SYMPHONIC_WARRIOR} s.counter_place_list={0x35} function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SYMPHONIC_WARRIOR) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function s.slcon(e) return not Duel.IsExistingMatchingCard(Card.IsSetCard,e:GetHandlerPlayer(),LOCATION_PZONE,0,1,e:GetHandler(),SET_SYMPHONIC_WARRIOR) 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.IsCanRemoveCounter(tp,1,0,0x35,3,REASON_COST) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) Duel.RemoveCounter(tp,1,0,0x35,3,REASON_COST) end function s.sumop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters, including a Link Monster
--Skyforce Kishin --Berserker of the Tenyi local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,nil,2,3,s.lcheck) c:EnableReviveLimit() end function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_LINK,lc,sumtype,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with "Black Luster Ritual".
--カオス・ソルジャー --Black Luster Soldier local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() end s.listed_names={55761792}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 monster that mentions "Ancient Fairy Dragon" from your Deck to your hand. You can only activate the following effects while you control a Level 7 or higher LIGHT Dragon Synchro Monster. Each time a monster(s) is Special Summoned in Attack Position: Change it to Defense Position. Once per turn, during the End Phase: Destroy all Attack Position monsters on the turn player's field. You can only activate 1 "World of Spirits" per turn.
--精霊の世界 --World of Spirits --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Change any monster that is Special Summoned in Attack Position to Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) e2:SetCondition(s.lightdragonsynchrocon) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) --Destroy all the turn player's Attack Position monsters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(s.lightdragonsynchrocon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end s.listed_names={CARD_ANCIENT_FAIRY_DRAGON} function s.thfilter(c) return c:IsMonster() and c:ListsCode(CARD_ANCIENT_FAIRY_DRAGON) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end end function s.lightdragonsynchroconfilter(c) return c:IsLevelAbove(7) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() end function s.lightdragonsynchrocon(e,tp,eg,ev,ep,re,r,rp) return Duel.IsExistingMatchingCard(s.lightdragonsynchroconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local g=eg:Filter(Card.IsPosition,nil,POS_ATTACK) if chk==0 then return #g>0 end Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,tp,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Filter(Card.IsPosition,nil,POS_ATTACK) if #g>0 then Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsPosition,Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil,POS_ATTACK) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsPosition,Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil,POS_ATTACK) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up Spell on the field; negate its effects (until the end of this turn), then you can place 1 "Dracotail" card from your GY or banishment on the bottom of the Deck, except "Dracotail Flame", then draw 1 card. You can only activate 1 "Dracotail Flame" per turn.
--星辰の吼炎 --Dracotail Flame --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Negate the effects of 1 face-up Spell, then you can place 1 "Dragontail" card from your GY or banishment on the bottom of the Deck, then draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE+CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_DRACOTAIL} s.listd_names={id} function s.disfilter(c) return c:IsSpell() and c:IsNegatableSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.disfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.disfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,s.disfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,1) end function s.tdfilter(c) return c:IsSetCard(SET_DRACOTAIL) and c:IsFaceup() and c:IsAbleToDeck() and not c:IsCode(id) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsCanBeDisabledByEffect(e) then tc:NegateEffects(c,RESETS_STANDARD_PHASE_END) Duel.AdjustInstantly(tc) if tc:IsDisabled() and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.tdfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil) and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.tdfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil) if #g==0 then return end Duel.HintSelection(g) Duel.BreakEffect() if Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the GY: You can Special Summon 1 EARTH Warrior monster with 1500 or less ATK from your Deck, in Attack Position.
--荒野の女戦士 --Warrior Lady of the Wasteland local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c,e,tp) return c:IsAttackBelow(1500) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 2 FIRE monsters (1 Tuner and 1 non-Tuner) with 200 DEF in your GY; banish both monsters, and if you do, Special Summon 1 FIRE Synchro Monster from your Extra Deck whose Level equals the total Levels of those monsters. You can only activate 1 "Birth of the Prominence Flame" per turn.
--炎雄爆誕 --Birth of the Prominence Flame --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.rmfilter1(c,e,tp) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsDefense(200) and not c:IsType(TYPE_TUNER) and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(s.rmfilter2,tp,LOCATION_GRAVE|LOCATION_MZONE,0,1,nil,e,tp,c:GetOriginalLevel()) and aux.SpElimFilter(c,true) end function s.rmfilter2(c,e,tp,lv) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsDefense(200) and c:IsType(TYPE_TUNER) and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetOriginalLevel()+lv) and aux.SpElimFilter(c,true) end function s.spfilter(c,e,tp,lv) return c:GetLevel()==lv and c:IsType(TYPE_SYNCHRO) and c:IsAttribute(ATTRIBUTE_FIRE) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.rmfilter1(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter1,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectTarget(tp,s.rmfilter1,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectTarget(tp,s.rmfilter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,g1:GetFirst():GetLevel()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g1,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not tg or tg:FilterCount(Card.IsRelateToEffect,nil,e)~=2 then return end if Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)==2 then local og=Duel.GetOperatedGroup() local lv=og:GetSum(Card.GetLevel) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,lv) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you activate this card: You can target 1 Effect Monster your opponent controls; banish 1 "Myutant" monster from your GY, and if you do, negate its effect until the end of this turn (even if this card leaves the field). When your Level 8 or higher "Myutant" monster destroys an opponent's monster by battle: You can draw 1 card. You can only use this effect of "Myutant Clash" once per turn. You can only activate 1 "Myutant Clash" per turn.
--ミュートリア連鎖応動 --Myutant Clash --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Activate (without effect) local e0=Effect.CreateEffect(c) e0:SetDescription(aux.Stringid(id,0)) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Activate (negate 1 of opponent's monsters) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_DISABLE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) --If your level 8+ "Myutant" destroys a monster by battle, draw 1 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCountLimit(1,{id,1}) e2:SetRange(LOCATION_SZONE) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end s.listed_series={SET_MYUTANT} function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsNegatableMonster() and chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_GRAVE,0,1,nil) end if Duel.IsExistingTarget(Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,nil,e,tp) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,Card.IsNegatableMonster,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_GRAVE) end end --Check for "Myutant" monster to banish function s.rmfilter(c) return c:IsAbleToRemove() and c:IsMonster() and c:IsSetCard(SET_MYUTANT) end --Banish 1 "Myutant" monster from GY, and if you do, negate targeted monster's effects function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local rc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil) if #rc>0 and Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)>0 then local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsDisabled() then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end end --If your level 8+ "Myutant" destroys an opponent's monster by battle function s.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not eg then return end for rc in aux.Next(eg) do if rc:IsStatus(STATUS_OPPO_BATTLE) then if rc:IsRelateToBattle() then if rc:IsControler(tp) and rc:IsSetCard(SET_MYUTANT) and rc:IsLevelAbove(8) then return true end else if rc:IsPreviousControler(tp) and rc:IsPreviousSetCard(SET_MYUTANT) then return true end end end end return false end --Activation legality 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 --Draw 1 function s.drop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Dinosaur-Type monster with 2500 or more ATK: Destroy all cards on the field.
--ジュラック・インパクト --Jurrac Impact 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 function s.cfilter(c) return c:IsFaceup() and c:IsAttackAbove(2500) and c:IsRace(RACE_DINOSAUR) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned by its own effect. You can reveal this card in your hand; draw 1 card, and if you do, show it, then Special Summon this card if the drawn card is a "Flower Cardian" monster. Otherwise, send it and this card to the Graveyard. During either player's Damage Step, when your "Flower Cardian" monster battles an opponent's monster: You can discard this card; your battling monster gains 1000 ATK until the end of this turn.
--花札衛-桜に幕- --Flower Cardian Cherry Blossom with Curtain local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Draw 1 card, and if you do, show it, then Special Summon this card if the drawn card is a "Flower Cardian" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(Cost.SelfReveal) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) --Your battling "Flower Cardian" monster gains 1000 ATK until the end of this turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_HAND) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetCondition(s.atkcon) e2:SetCost(Cost.SelfDiscard) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_series={SET_FLOWER_CARDIAN} function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,c,2,tp,LOCATION_HAND) 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 c=e:GetHandler() local dc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,dc) if dc:IsSetCard(SET_FLOWER_CARDIAN) and dc:IsMonster() then if c:IsRelateToEffect(e) then Duel.BreakEffect() if Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)>0 then c:CompleteProcedure() end end else local g=Group.FromCards(dc) if c:IsRelateToEffect(e) then g:AddCard(c) end Duel.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT) end Duel.ShuffleHand(tp) end end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) if not aux.StatChangeDamageStepCondition() then return false end local bc1,bc2=Duel.GetBattleMonster(tp) return bc1 and bc2 and bc1:IsSetCard(SET_FLOWER_CARDIAN) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local bc=Duel.GetBattleMonster(tp) e:SetLabelObject(bc) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetLabelObject() if bc:IsRelateToBattle() and bc:IsFaceup() and bc:IsControler(tp) then --Your battling monster gains 1000 ATK until the end of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_PHASE_END) bc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only equip this card to "Gradius". Increase the ATK of "Gradius" by 300 points. When the equipped "Gradius" attacks with an ATK that is higher than the DEF of a Defense Position monster, inflict the difference as Battle Damage to your opponent's Life Points.
--サイクロンレーザー --Cyclon Laser local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsCode,10992251)) --atk local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(300) c:RegisterEffect(e2) --pierce local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) end s.listed_names={10992251}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is destroyed by battle and sent to the GY: Add 1 Level 4 or lower "Dark World" monster from your Deck to your hand.
--暗黒界の斥候 スカー --Scarr, Scout of Dark World local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.filter(c) return c:IsLevelBelow(4) and c:IsSetCard(SET_DARK_WORLD) and c:IsAbleToHand() 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:
When this card is Normal or Special Summoned: You can add 1 "Majespecter" card from your Deck to your hand during the End Phase of this turn. You can only use this effect of "Majespecter Cat - Nekomata" once per turn. Cannot be targeted or destroyed by your opponent's card effects.
--マジェスペクター・キャット --Majespecter Cat - Nekomata local s,id=GetID() function s.initial_effect(c) --Pendulum Summon Pendulum.AddProcedure(c) --Search 1 "Majespecter" card during the End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.regtg) e1:SetOperation(s.regop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Cannot be targeted by the opponent's effects local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) --Cannot be destroyed by the opponent's effects local e4=e3:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e4:SetValue(aux.indoval) c:RegisterEffect(e4) end function s.regtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:IsSetCard(SET_MAJESPECTER) and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent to the Graveyard for a Synchro Summon, you can pay 500 Life Points to have that Synchro Monster gain 1000 ATK until the End Phase.
--メンタル・カウンセラー リリー --Counselor Lily local s,id=GetID() function s.initial_effect(c) --atk change local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BE_MATERIAL) e1:SetCondition(s.con) e1:SetCost(Cost.PayLP(500)) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.con(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local sync=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_PHASE_END) sync:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ WATER monsters You can target 1 "Marincess" card in your GY, except "Marincess Marbled Rock"; add it to your hand. You can only use this effect of "Marincess Marbled Rock" once per turn. When an opponent's monster declares an attack: You can send 1 "Marincess" monster from your hand to the GY; for that battle, monsters cannot be destroyed by battle, also you take no battle damage.
--海晶乙女 マーブルド・ロック --Marincess Marbled Rock --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_WATER),2) c:EnableReviveLimit() --tohand 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:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.negcon) e2:SetCost(s.negcost) e2:SetOperation(s.negop) c:RegisterEffect(e2) end function s.thfilter(c) return c:IsSetCard(SET_MARINCESS) and not c:IsCode(id) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.negcon(e,tp,eg,ep,ev,re,r,rp) return not Duel.GetAttacker():IsControler(tp) end function s.cfilter(c) return c:IsSetCard(SET_MARINCESS) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.negcost(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.DiscardHand(tp,s.cfilter,1,1,REASON_COST) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) a:RegisterEffect(e1) if d then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) e2:SetReset(RESET_PHASE|PHASE_DAMAGE) d:RegisterEffect(e2) end local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e3,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 monsters Cannot be destroyed by the activated effects of monsters Special Summoned from the GY. You can only use each of the following effects of "Exosister Gibrine" once per turn. If you control this card that was Xyz Summoned this turn by using an "Exosister" monster as material (Quick Effect): You can target 1 Effect Monster your opponent controls; negate its effects until the end of this turn. You can detach 1 material from this card; for the rest of this turn, all Xyz Monsters you control will gain 800 ATK.
--エクソシスター・ジブリーヌ --Exosister Gibrine --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 4 monsters Xyz.AddProcedure(c,nil,4,2) --Check if this card was Xyz Summoned by using an "Exosister" monster as material local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_MATERIAL_CHECK) e0:SetValue(s.valcheck) c:RegisterEffect(e0) --Cannot be destroyed by the activated effects of monsters Special Summoned from the GY 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(s.indval) c:RegisterEffect(e1) --Negate the effects of 1 Effect Monster your opponent controls until the end of this turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DISABLE) 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:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end) e2:SetCost(Cost.HintSelectedEffect) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) --Apply a "for the rest of this turn, all Xyz Monsters you control will gain 800 ATK" effect local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCost(Cost.AND(Cost.DetachFromSelf(1),Cost.HintSelectedEffect)) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_series={SET_EXOSISTER} function s.valcheck(e,c) if c:GetMaterial():IsExists(Card.IsSetCard,1,nil,SET_EXOSISTER) then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END&~RESET_TOFIELD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) end end function s.indval(e,re,rp) local rc=re:GetHandler() return rc:IsSpecialSummoned() and rc:IsSummonLocation(LOCATION_GRAVE) and re:IsMonsterEffect() and re:IsActivated() end function s.disfilter(c) return c:IsNegatableMonster() and c:IsType(TYPE_EFFECT) end function s.distg(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.disfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.disfilter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,s.disfilter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,tp,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Negate its effects until the end of this turn tc:NegateEffects(e:GetHandler(),RESET_PHASE|PHASE_END) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() aux.RegisterClientHint(c,nil,tp,1,0,aux.Stringid(id,3)) --For the rest of this turn, all Xyz Monsters you control will gain 800 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_XYZ)) e1:SetValue(800) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card inflicts Battle Damage to your opponent by a direct attack, discard 1 random card from your opponent's hand.
--エレキンメダイ --Wattberyx local s,id=GetID() function s.initial_effect(c) --handes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_DAMAGE) 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 ep~=tp and Duel.GetAttackTarget()==nil end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(ep,LOCATION_HAND,0,nil) if #g==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoGrave(sg,REASON_DISCARD|REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard Machine monster(s) whose total Levels equal 8 or more, then Special Summon this card (from your hand or GY). If this card is destroyed by battle and sent to the GY: Target 1 card your opponent controls; destroy that target. Before resolving an opponent's monster effect that targets this face-up card, look at your opponent's hand and discard 1 card from their hand.
--マシンナーズ・フォートレス --Machina Fortress 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|LOCATION_GRAVE) e1:SetCondition(s.spcon) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --handes local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_CHAIN_SOLVING) e3:SetOperation(s.hdop) c:RegisterEffect(e3) end function s.spfilter(c) return c:IsRace(RACE_MACHINE) and c:IsDiscardable() end function s.spcon(e,c) if c==nil then return true end local eff={c:GetCardEffect(EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then return false end end local tp=c:GetControler() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil) if not c:IsAbleToGraveAsCost() then g:RemoveCard(c) end if g:IsContains(c) then eff={Duel.GetPlayerEffect(tp,EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then g:RemoveCard(c) break end end end return g:CheckWithSumGreater(Card.GetLevel,8) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.GetMatchingGroup(s.spfilter,c:GetControler(),LOCATION_HAND,0,nil) if not c:IsAbleToGraveAsCost() then g:RemoveCard(c) end if g:IsContains(c) then eff={Duel.GetPlayerEffect(tp,EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then g:RemoveCard(c) break end end end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local sg=g:SelectWithSumGreater(tp,Card.GetLevel,8) Duel.SendtoGrave(sg,REASON_COST|REASON_DISCARD) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.hdop(e,tp,eg,ep,ev,re,r,rp) if ep==tp then return end if not re:IsActiveType(TYPE_EFFECT) or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if g and g:IsContains(e:GetHandler()) then local hg=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #hg==0 then return end Duel.ConfirmCards(tp,hg) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local sg=hg:Select(tp,1,1,nil) Duel.SendtoGrave(sg,REASON_EFFECT|REASON_DISCARD) Duel.ShuffleHand(1-tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Both players reveal their hands and add 1 card from each other's hand to their hand.
--エクスチェンジ --Exchange 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,0,LOCATION_HAND)>0 and Duel.IsExistingMatchingCard(nil,tp,LOCATION_HAND,0,1,e:GetHandler()) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g1=Duel.GetFieldGroup(tp,LOCATION_HAND,0) local g2=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g1==0 or #g2==0 then return end Duel.ConfirmCards(tp,g2) Duel.ConfirmCards(1-tp,g1) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local ag1=g2:Select(tp,1,1,nil) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) local ag2=g1:Select(1-tp,1,1,nil) Duel.SendtoHand(ag1,tp,REASON_EFFECT) Duel.SendtoHand(ag2,1-tp,REASON_EFFECT) 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 pay half your LP, then target 1 Level 6 or lower monster you control; Special Summon this card, and if you do, this card's Level is reduced by the Level of the targeted monster, also place this card on the bottom of the Deck if it leaves the field. You can only use this effect of "Destrudo the Lost Dragon's Frisson" once per turn.
--亡龍の戦慄-デストルドー --Destrudo the Lost Dragon's Frisson local s,id=GetID() function s.initial_effect(c) --Special Summon this card 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2)) end function s.filter(c) return c:IsFaceup() and c:IsLevelBelow(6) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and 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) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Decrease its level by the level of the target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(-tc:GetLevel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end --Return it to deck if it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(3301) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e2:SetReset(RESET_EVENT|RESETS_REDIRECT) e2:SetValue(LOCATION_DECKBOT) c:RegisterEffect(e2) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect, is activated that targets a DARK monster on the field: Negate the activation, and if you do, destroy that card.
--闇の幻影 --Dark Illusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) end function s.condition(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return end if not re:IsMonsterEffect() and not re:IsHasType(EFFECT_TYPE_ACTIVATE) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(s.cfilter,1,nil) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 card, then target 1 monster your opponent controls that has a Level; roll a six-sided die and apply this effect based on the result. ● Higher than the targeted monster's Level: Destroy the targeted monster, then you can add 1 monster with the same original Level from your Deck to your hand, also you cannot activate this effect of "Shateki" for the rest of this turn. ● Equal to or lower than that targeted monster's Level: Reduce the targeted monster's Level by 1.
--射敵 --Shateki --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) --Roll a six-sided die and apply an effect based on the result local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DICE+CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_SZONE) e1:SetCondition(function(e,tp) return not Duel.HasFlagEffect(tp,id) end) e1:SetCost(Cost.Discard()) e1:SetTarget(s.dietg) e1:SetOperation(s.dieop) c:RegisterEffect(e1) end s.roll_dice=true s.listed_names={id} function s.dietg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() and chkc:HasLevel() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.HasLevel),tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.HasLevel),tp,0,LOCATION_MZONE,1,1,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c,lv) return c:IsOriginalLevel(lv) and c:IsAbleToHand() end function s.dieop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:HasLevel()) then return end local c=e:GetHandler() local dc=Duel.TossDice(tp,1) if dc>tc:GetLevel() then --Destroy it, then you can add 1 monster with the same original Level from your Deck to your hand if Duel.Destroy(tc,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tc:GetOriginalLevel()) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetOriginalLevel()) if #g>0 then Duel.BreakEffect() Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end --Cannot activate this effect of "Shateki" for the rest of this turn Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) aux.RegisterClientHint(c,0,tp,1,0,aux.Stringid(id,2)) else --Reduce its Level by 1 if tc:IsLevelBelow(1) then return end tc:UpdateLevel(-1,RESET_EVENT|RESETS_STANDARD,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All "Battleguard" monsters you control gain 500 ATK. You can only use each of the following effects of "Battleguard Cadet" once per turn. If this card is Normal or Special Summoned: You can add 1 "Feast of the Wild LV5" from your Deck to your hand. You can Tribute this card; Special Summon 1 Level 8 Warrior monster from your hand.
--バーバリアン0号 --Battleguard Cadet --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetRange(LOCATION_MZONE) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_BATTLEGUARD)) e1:SetValue(500) c:RegisterEffect(e1) --Search 1 "Feast of the Wild LV5" 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:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,0}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Special Summon 1 Level 8 Warrior from your hand 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:SetCountLimit(1,{id,1}) e4:SetCost(Cost.SelfTribute) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_BATTLEGUARD} s.listed_names={55416843} function s.thfilter(c) return c:IsCode(55416843) 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.spfilter(c,e,tp) return c:IsRace(RACE_WARRIOR) and c:IsLevel(8) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when a "Scrap" monster you control is destroyed and sent to the Graveyard. Destroy all face-up Spell/Trap Cards on the field.
--スクラップ・クラッシュ --Scrap Crash 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_TO_GRAVE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsSetCard(SET_SCRAP) and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and c:GetPreviousLocation()==LOCATION_MZONE and (c:GetPreviousPosition()&POS_FACEUP)~=0 end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c) return c:IsFaceup() and 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,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your End Phase, if you control no Spell or Trap Cards, you can Special Summon this card from your Graveyard in face-up Attack Position. This card's controller takes 1000 damage during each of their Standby Phases.
--サクリファイス・ロータス --Samsara Lotus local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1) e1:SetCondition(s.sscon) e1:SetTarget(s.sstg) e1:SetOperation(s.ssop) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) 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.dmcon) e2:SetTarget(s.dmtg) e2:SetOperation(s.dmop) c:RegisterEffect(e2) end function s.filter(c) return c:IsSpellTrap() end function s.sscon(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.ssop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) and not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP_ATTACK) end end function s.dmcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.dmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,0,0,tp,1000) end function s.dmop(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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Worm Drake" + "Humanoid Slime"
--ヒューマノイド・ドレイク --Humanoid Worm Drake local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,73216412,46821314) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Apply 1 of these effects. Unless you have a "Vaalmonica" card in your Pendulum Zone, your opponent chooses the effect. ● Gain 500 LP, then you can place 1 card from your hand on the bottom of the Deck, then draw 2 cards. ● Take 500 damage, then you can add 1 "Vaalmonica" Spell/Trap from your Deck to your hand, except "Vaalmonica Scelta". You can only activate 1 "Vaalmonica Scelta" per turn.
--ヴァルモニカ・シェルタ --Vaalmonica Scelta --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER+CATEGORY_TODECK+CATEGORY_DRAW+CATEGORY_DAMAGE+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_VAALMONICA} s.listed_names={id} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,500) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) Duel.SetPossibleOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,500) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c) return c:IsSetCard(SET_VAALMONICA) and c:IsSpellTrap() and not c:IsCode(id) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp,angello_or_dimonno) --Additional parameter used by "Angello Vaalmonica" and "Dimonno Vaalmonica" local op=nil if angello_or_dimonno then op=angello_or_dimonno else local sel_player=Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_PZONE,0,1,nil,SET_VAALMONICA) and tp or 1-tp local offset=sel_player==1-tp and 2 or 0 op=Duel.SelectEffect(sel_player, {true,aux.Stringid(id,1+offset)}, {true,aux.Stringid(id,2+offset)}) end if op==1 then --Gain 500 LP and draw 2 cards local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_HAND,0,nil) if Duel.Recover(tp,500,REASON_EFFECT)>0 and #g>0 and Duel.IsPlayerCanDraw(tp,2) and Duel.SelectYesNo(tp,aux.Stringid(id,5)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local sc=g:Select(tp,1,1,nil):GetFirst() Duel.BreakEffect() if not (Duel.SendtoDeck(sc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_DECK)) then return end Duel.Draw(tp,2,REASON_EFFECT) end elseif op==2 then --Take 500 damage and search 1 "Valmonica" Spell/Trap local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if Duel.Damage(tp,500,REASON_EFFECT)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,6)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.BreakEffect() Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Sets exactly 1 monster (and no other cards): Target that Set monster and 1 monster you control; destroy those targets, and if you do, banish them.
--異次元の落とし穴 --D.D. Trap Hole local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_MSET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_CHANGE_POS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetTarget(s.target2) e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end function s.filter(c,e,tp) return c:IsPosition(POS_FACEDOWN_DEFENSE) and c:GetReasonPlayer()==tp and c:IsCanBeEffectTarget(e) and c:IsAbleToRemove() end function s.filter2(c,e) return c:IsAbleToRemove() and c:IsCanBeEffectTarget(e) end function s.filter3(c,e,tp) return c:IsPosition(POS_FACEDOWN_DEFENSE) and c:IsSummonPlayer(tp) and c:IsCanBeEffectTarget(e) and c:IsAbleToRemove() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then local sg=eg:Filter(s.filter,nil,e,1-tp) return #sg==1 and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_MZONE,0,1,sg:GetFirst(),e) end local sg1=eg:Filter(s.filter,nil,e,1-tp) e:SetLabelObject(sg1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg2=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_MZONE,0,1,1,sg1:GetFirst(),e) sg1:Merge(sg2) Duel.SetTargetCard(sg1) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg1,#sg1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg1,#sg1,0,0) end function s.target2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then local sg=eg:Filter(s.filter3,nil,e,1-tp) return #sg==1 and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_MZONE,0,1,sg:GetFirst(),e) end local sg1=eg:Filter(s.filter3,nil,e,1-tp) e:SetLabelObject(sg1:GetFirst()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg2=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_MZONE,0,1,1,sg1:GetFirst(),e) sg1:Merge(sg2) Duel.SetTargetCard(sg1) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg1,#sg1,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,sg1,#sg1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc1=g:GetFirst() local tc2=g:GetNext() local sc=e:GetLabelObject() if tc1 and tc1:IsRelateToEffect(e) and tc2 and tc2:IsRelateToEffect(e) and sc:IsFacedown() then Duel.Destroy(g,REASON_EFFECT,LOCATION_REMOVED) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 face-up Tuner monster you control. That monster cannot be destroyed by battle or by card effects, until the End Phase of the next turn.
--チューナーズ・バリア --Tuner's Barrier local s,id=GetID() function s.initial_effect(c) --Make 1 Tuner you control unable to be destroyed by battle or card effects until the end of the next turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START) c:RegisterEffect(e1) end function s.tgfilter(c) return c:IsType(TYPE_TUNER) and c:IsFaceup() and not c:HasFlagEffect(id) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO) Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_TUNER) then tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,2) --That Tuner cannot be destroyed by battle or card effects until the end of the next turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3008) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END,2) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If there are 2 or more different Monster Types among the Level 10 or higher monsters on the field: Shuffle all cards except this one from both players' hands, fields, and GYs into the Deck, then each player draws 5 cards. You can banish this card from your GY; add 1 "Crystal Beast" monster and 1 Field Spell from your Deck to your hand. You can only apply each effect of "Rainbow Bridge of Salvation" once per Duel.
--救いの架け橋 --Rainbow Bridge of Salvation --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.tdcon) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --Search 1 "Crystal Beast" and 1 Field Spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCondition(function(_,tp) return Duel.GetFlagEffect(tp,id+1)==0 end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_CRYSTAL_BEAST} function s.tdcon(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsLevelAbove,10),tp,LOCATION_MZONE,LOCATION_MZONE,nil) return #g>1 and g:GetClassCount(Card.GetRace)>1 and Duel.GetFlagEffect(tp,id)==0 end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) local loc=LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,loc,loc,nil,e:GetHandler()) if chk==0 then return #g>0 and Duel.IsPlayerCanDraw(tp,5) and Duel.IsPlayerCanDraw(1-tp,5) end Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,5) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end Duel.RegisterFlagEffect(tp,id,0,0,0) local loc=LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,loc,loc,nil,e:GetHandler()) if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKTOP,REASON_EFFECT)>0 then local og=Duel.GetOperatedGroup() if not og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK|LOCATION_EXTRA) then return end local dg=og:Filter(Card.IsLocation,nil,LOCATION_DECK) local ct=dg:FilterCount(Card.IsControler,nil,tp) if ct>0 then Duel.ShuffleDeck(tp) end if #dg>ct then Duel.ShuffleDeck(1-tp) end Duel.BreakEffect() Duel.Draw(tp,5,REASON_EFFECT) Duel.Draw(1-tp,5,REASON_EFFECT) end end function s.cbfilter(c,tp) return c:IsMonster() and c:IsSetCard(SET_CRYSTAL_BEAST) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.fsfilter,tp,LOCATION_DECK,0,1,c) end function s.fsfilter(c) return c:IsType(TYPE_FIELD) 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.cbfilter,tp,LOCATION_DECK,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id+1)~=0 then return end Duel.RegisterFlagEffect(tp,id+1,0,0,0) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.cbfilter,tp,LOCATION_DECK,0,1,1,nil,tp) if #g<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) g=g+Duel.SelectMatchingCard(tp,s.fsfilter,tp,LOCATION_DECK,0,1,1,g) if #g<2 then return end Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 WATER Tuner + 1+ non-Tuner WATER monsters When this card is Synchro Summoned: You can destroy all your opponent's Attack Position monsters. This card can make up to 2 attacks on monsters during each Battle Phase. If this card attacks a Defense Position monster, inflict piercing battle damage. If this card you control is destroyed by an opponent's card (by battle or card effect) and sent to your GY: You can banish 1 other WATER monster from your GY; Special Summon this card, and if you do, it is treated as a Tuner.
--白闘気白鯨 --White Aura Whale local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 WATER Tuner + 1+ non-Tuner WATER monsters Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_WATER),1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_WATER),1,99) --Destroy all your opponent's Attack Position monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --This card can make up to 2 attacks on monsters during each Battle Phase local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_EXTRA_ATTACK_MONSTER) e2:SetRange(LOCATION_MZONE) e2:SetValue(1) c:RegisterEffect(e2) --If this card attacks a Defense Position monster, inflict piercing battle damage local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) --Special Summon this card as a Tuner local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(s.spcon) e4:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsPreviousControler(tp) and c:IsLocation(LOCATION_GRAVE) end function s.spcostfilter(c,mmz_chk,tp) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and (mmz_chk or Duel.GetMZoneCount(tp,c)>0) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local mmz_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,c,mmz_chk,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,c,mmz_chk,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() c:AssumeProperty(ASSUME_TYPE,c:GetType()|TYPE_TUNER) if chk==0 then return 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 not c:IsRelateToEffect(e) then return end c:AssumeProperty(ASSUME_TYPE,c:GetType()|TYPE_TUNER) if Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP) 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(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If the ATK of an attacking monster your opponent controls is lower than the DEF of the attacked Defense Position monster you control, destroy the attacking monster at the end of the Damage Step. (Damage calculation is applied normally.)
--カウンターパンチ --Destruction Punch 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_DAMAGE_STEP_END) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() return d and a:IsControler(1-tp) and a:IsRelateToBattle() and d:IsDefensePos() and d:IsRelateToBattle() and d:GetDefense()>a:GetAttack() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetCard(Duel.GetAttacker()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttacker(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: Place 1 Spell Counter on it (max. 1). You can remove 1 Spell Counter from this card, then target 1 face-up Trap on the field; destroy that target.
--ハンニバル・ネクロマンサー --Hannibal Necromancer local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(COUNTER_SPELL) c:SetCounterLimit(COUNTER_SPELL,1) --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.addct) e1:SetOperation(s.addc) 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:SetRange(LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.counter_place_list={COUNTER_SPELL} function s.addct(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,COUNTER_SPELL) end function s.addc(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then e:GetHandler():AddCounter(COUNTER_SPELL,1) end end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,COUNTER_SPELL,1,REASON_COST) end e:GetHandler():RemoveCounter(tp,COUNTER_SPELL,1,REASON_COST) end function s.filter(c) return c:IsTrap() and c:IsFaceup() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares a direct attack: You can Special Summon 1 "F.A." monster from your Deck. You can only use this effect of "F.A. Dead Heat" once per turn. Once per battle, if your "F.A." monster battles an opponent's monster, before damage calculation: You can have both players roll a six-sided die. If your result is higher, increase the Level of your battling monster by 4, until the end of this turn (even if this card leaves the field). If your result is lower, destroy your battling monster. If it's a tie, both players roll again.
--F.A.デッド・ヒート --F.A. Dead Heat 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) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --atk up local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_LVCHANGE+CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_CONFIRM) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.lvlcon) e3:SetOperation(s.lvlop) c:RegisterEffect(e3) end s.listed_series={SET_FA} s.roll_dice=true function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.spfilter(c,e,tp) return c:IsSetCard(SET_FA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.sptg(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.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 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.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.lvlcon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() local bc=Duel.GetAttackTarget() if not bc then return false end if tc:IsControler(1-tp) then bc,tc=tc,bc end return bc:IsFaceup() and tc:IsFaceup() and tc:IsSetCard(SET_FA) and tc:HasLevel() end function s.lvlop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetAttacker() local bc=Duel.GetAttackTarget() if not bc then return false end if tc:IsControler(1-tp) then bc,tc=tc,bc end local d1=0 local d2=0 while d1==d2 do d1,d2=Duel.TossDice(tp,1,1) end if d1>d2 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(4) tc:RegisterEffect(e1) else Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All non-Fairy monsters lose 500 ATK/DEF. The activation and effects of Spell/Trap Cards activated on your field cannot be negated.
--The splendid VENUS --Splendid Venus local s,id=GetID() function s.initial_effect(c) --atk,def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.NOT(aux.TargetBoolFunction(Card.IsRace,RACE_FAIRY))) e1:SetValue(-500) c:RegisterEffect(e1) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.NOT(aux.TargetBoolFunction(Card.IsRace,RACE_FAIRY))) e1:SetValue(-500) c:RegisterEffect(e1) --inactivatable local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_INACTIVATE) e4:SetRange(LOCATION_MZONE) e4:SetValue(s.effectfilter) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_CANNOT_DISEFFECT) e5:SetRange(LOCATION_MZONE) e5:SetValue(s.effectfilter) c:RegisterEffect(e5) end function s.effectfilter(e,ct) local p=e:GetHandler():GetControler() local te,tp,loc=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_LOCATION) return p==tp and te:IsSpellTrapEffect() and (loc&LOCATION_ONFIELD)~=0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an opponent's monster declares an attack: Return all your opponent's Attack Position monsters to the hand.
--神風のバリア -エア・フォース- --Storming Mirror Force local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) 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 function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.filter(c) return c:IsAttackPos() 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,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) you control is destroyed by battle or card effect: Special Summon 1 "Performapal" monster from your hand or Graveyard.
--EMリバイバル --Performapal Revival 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_DESTROYED) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.filter(c,e,tp) return c:IsSetCard(SET_PERFORMAPAL) 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_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.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 "Subterror" monster from your Deck to your hand. Once per turn: You can change 1 face-down Defense Position "Subterror" monster you control to face-up Attack or Defense Position. Once per turn, when an opponent's monster declares an attack: You can change 1 face-down Defense Position "Subterror" monster you control to face-up Attack or Defense Position, then you can negate the attack. You can only activate 1 "The Hidden City" per turn.
--地中界シャンバラ --The Hidden City local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Change 1 face-down Defense Position "Subterror" monster you control to face-up Attack or Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) --Change 1 face-down Defense Position "Subterror" monster you control to face-up Attack or Defense Position, then you can negate an opponent's monster's attack local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.thfilter(c) return c:IsMonster() and c:IsSetCard(SET_SUBTERROR) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.filter(c) return c:IsSetCard(SET_SUBTERROR) and c:IsFacedown() and c:IsDefensePos() end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp,chk) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) local tc=g:GetFirst() if tc then local pos=Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEUP_DEFENSE) Duel.ChangePosition(tc,pos) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() if tc then local pos=Duel.SelectPosition(tp,tc,POS_FACEUP_ATTACK+POS_FACEUP_DEFENSE) if Duel.ChangePosition(tc,pos)~=0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.NegateAttack() end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Increase the original ATK and DEF of all face-up Level 2 Normal Monsters (except Tokens) on your side of the field by 1000 points until the End Phase. Destroy all Level 2 Normal Monsters on your side of the field during the End Phase.
--サウザンドエナジー --Thousand Energy local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) local tpe=c:GetType() return c:IsFaceup() and (tpe&TYPE_NORMAL)~=0 and (tpe&TYPE_TOKEN)==0 and c:GetLevel()==2 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(tc:GetBaseAttack()+1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_BASE_DEFENSE) e2:SetValue(tc:GetBaseDefense()+1000) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end local de=Effect.CreateEffect(e:GetHandler()) de:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) de:SetCode(EVENT_PHASE+PHASE_END) de:SetCountLimit(1) de:SetCondition(s.descon) de:SetOperation(s.desop) de:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(de,tp) end function s.dfilter(c) return c:IsFaceup() and c:IsType(TYPE_NORMAL) and c:GetLevel()==2 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.dfilter,tp,LOCATION_MZONE,0,1,nil) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.dfilter,tp,LOCATION_MZONE,0,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 face-up monster your opponent controls. Special Summon 1 monster from your hand that has the same Level as the selected monster.
--ライバル登場! --A Rival Appears! local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) local lv=c:GetLevel() return c:IsFaceup() and lv>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp,lv) end function s.spfilter(c,e,tp,lv) return c:GetLevel()==lv and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPPO) Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil,e,tp) 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.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,tc:GetLevel()) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target up to 5 cards in any GY(s); banish them.
--魂の解放 --Soul Release local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.rmfilter(c) return c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,5,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish 1 Tuner from your GY; Special Summon this card from your hand.
--泣き神の石像 --Weeping Idol 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:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.costfilter(c,tp) return c:IsType(TYPE_TUNER) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) 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:
1 WIND Machine Tuner + 1+ non-Tuner monsters If this card is Synchro Summoned: You can activate 1 of these effects; ● Destroy all other cards on the field. ● Negate the effects of all face-up cards your opponent currently controls. If this card in your possession is sent to your GY by your opponent: You can add 1 "Speedroid" monster from your Deck to your hand. You can only use each effect of "Hi-Speedroid Kitedrake" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--HSRカイドレイク --Hi-Speedroid Kitedrake --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --synchro summon c:EnableReviveLimit() Synchro.AddProcedure(c,s.tfilter,1,1,Synchro.NonTuner(nil),1,99) --Destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetCondition(s.syncon) e1:SetCost(s.announcecost) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Negate local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) --Add to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_SPEEDROID} function s.tfilter(c,scard,sumtype,tp) return c:IsRace(RACE_MACHINE,scard,sumtype,tp) and c:IsAttribute(ATTRIBUTE_WIND,scard,sumtype,tp) end function s.announcecost(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.syncon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c) 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(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_ONFIELD,nil) local c=e:GetHandler() for tc in aux.Next(g) do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsPreviousControler(tp) end function s.thfilter(c) return c:IsSetCard(SET_SPEEDROID) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your turn, negate the effects of all face-up monsters your opponent controls. During your opponent's turn, negate the effects of all face-up monsters you control.
--形勢反転 --Underdog local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Negate effects depending on turn player local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetCondition(s.con1) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(0,LOCATION_MZONE) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCondition(s.con2) e3:SetTargetRange(LOCATION_MZONE,0) c:RegisterEffect(e3) end function s.con1(e,tp,ep,eg,ev,re,r,rp) return Duel.GetTurnPlayer()==e:GetHandlerPlayer() end function s.con2(e,tp,ep,eg,ev,re,r,rp) return Duel.GetTurnPlayer()~=e:GetHandlerPlayer() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Level 8 or higher Synchro Monster, you can Special Summon this card (from your hand).
--クリエイト・リゾネーター --Creation Resonator local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and c:IsLevelAbove(8) and c:IsType(TYPE_SYNCHRO) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.cfilter,c:GetControler(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster you control; increase its Level by 3, also if you activated this card in response to your opponent's monster effect activation, while you control "Shining Sarcophagus" and a monster that mentions it, negate that opponent's effect. During damage calculation, if your monster that mentions "Shining Sarcophagus" battles: You can banish this card from your GY; end the Battle Phase. You can only activate 1 "Turn Silence" per turn.
--時の沈黙-ターン・サイレンス --Turn Silence --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE+CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --End the Battle Phase local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(function(_,tp) local tc=Duel.GetBattleMonster(tp) return tc and tc:ListsCode(CARD_SHINING_SARCOPHAGUS) end) e2:SetCost(Cost.SelfBanish) e2:SetOperation(s.skipop) c:RegisterEffect(e2) end s.listed_names={CARD_SHINING_SARCOPHAGUS} function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:HasLevel() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.HasLevel),tp,LOCATION_MZONE,0,1,1,nil) local ch=Duel.GetCurrentChain()-1 local trig_p,trig_e=Duel.GetChainInfo(ch,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_EFFECT) if e:IsHasType(EFFECT_TYPE_ACTIVATE) and ch>0 and trig_p==1-tp and trig_e:IsMonsterEffect() and Duel.IsChainDisablable(ch) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_SHINING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.ListsCode,CARD_SHINING_SARCOPHAGUS),tp,LOCATION_MZONE,0,1,nil) then e:SetLabel(1) else e:SetLabel(0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:HasLevel() then --Increase its Level by 3 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(3) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end local ch=Duel.GetCurrentChain()-1 if e:GetLabel()==1 then Duel.NegateEffect(ch) end end function s.skipop(e,tp,eg,ep,ev,re,r,rp) Duel.GetAttacker():SetStatus(STATUS_ATTACK_CANCELED,true) Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can pay 500 LP; during your Main Phase this turn, you can Normal Summon 1 "Vampire" monster in addition to your Normal Summon/Set. (Even if this card leaves the field. You can only gain this effect once per turn.) Each time your "Vampire" monster inflicts battle damage to your opponent: Gain the same amount of LP.
--ヴァンパイアの領域 --Vampire's Domain 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) --extra summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.sumcon) e2:SetCost(Cost.PayLP(500)) e2:SetTarget(s.sumtg) e2:SetOperation(s.sumop) c:RegisterEffect(e2) --recover local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_RECOVER) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_BATTLE_DAMAGE) e3:SetCondition(s.reccon) e3:SetTarget(s.rectg) e3:SetOperation(s.recop) c:RegisterEffect(e3) end s.listed_series={SET_VAMPIRE} function s.sumcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPlayerCanAdditionalSummon(tp) end function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanSummon(tp) end end function s.sumop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetDescription(aux.Stringid(id,2)) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_VAMPIRE)) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.reccon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and eg:GetFirst():IsControler(tp) and eg:GetFirst():IsSetCard(SET_VAMPIRE) end function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ev) Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ev) end function s.recop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Recover(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 face-up Level 5 or higher Normal Summoned/Set monster, then target 1 face-up card on the field; negate its effects, then draw 1 card. (The effects remain negated until the end of this turn.) During your Main Phase, if this card is in your Graveyard: You can banish this card, then declare 1 Attribute; all face-up monsters currently on the field become that Attribute until the end of this turn.
--帝王の轟毅 --Strike of the Monarchs local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --change attributes local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.attg) e2:SetOperation(s.atop) c:RegisterEffect(e2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.cfilter(c,e,dg) if c:IsFacedown() or not c:IsLevelAbove(5) or not c:IsNormalSummoned() then return false end local a=0 if dg:IsContains(c) then a=1 end if c:GetEquipCount()==0 then return #dg-a>=1 end local eg=c:GetEquipGroup() local tc=eg:GetFirst() for tc in aux.Next(eg) do if dg:IsContains(tc) then a=a+1 end end return #dg-a>=1 end function s.tgfilter(c,e) return c:IsNegatable() and c:IsCanBeEffectTarget(e) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.tgfilter(chkc,e) and chkc~=e:GetHandler() end if chk==0 then if not Duel.IsPlayerCanDraw(tp,1) then return false end if e:GetLabel()==1 then e:SetLabel(0) local rg=Duel.GetReleaseGroup(tp) local dg=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler(),e) return rg:IsExists(s.cfilter,1,e:GetHandler(),e,dg) else return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end end if e:GetLabel()==1 then e:SetLabel(0) local rg=Duel.GetReleaseGroup(tp) local dg=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler(),e) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local sg=rg:FilterSelect(tp,s.cfilter,1,1,e:GetHandler(),e,dg) Duel.Release(sg,REASON_COST) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and ((tc:IsFaceup() and not tc:IsDisabled()) or tc:IsType(TYPE_TRAPMONSTER)) then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) local e3 if tc:IsType(TYPE_TRAPMONSTER) then e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end if tc:IsImmuneToEffect(e1) or tc:IsImmuneToEffect(e2) or (e3 and tc:IsImmuneToEffect(e3)) then return end Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end function s.attg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTRIBUTE) local rc=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL) Duel.SetTargetParam(rc) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local rc=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_ATTRIBUTE) e1:SetValue(rc) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters If this card is Special Summoned: You can target 2 "White Forest" monsters in your GY; place them face-up in their owners' Spell & Trap Zones as Continuous Spells. During your opponent's Main Phase, you can (Quick Effect): Immediately after this effect resolves, Synchro Summon using this card you control. You can only use each effect of "Poplar of the White Forest" once per turn.
--白き森の幻妖 --Poplar of the White Forest --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Place 2 "White Forest" monsters from your GY in face-up in their owners' Spell & Trap Zones as Continuous Spells local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.pltg) e1:SetOperation(s.plop) c:RegisterEffect(e1) --Immediately after this effect resolves, Synchro Summon using this card you control 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|TIMINGS_CHECK_MONSTER) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp) return Duel.IsMainPhase() and Duel.IsTurnPlayer(1-tp) end) e2:SetTarget(s.synchtg) e2:SetOperation(s.synchop) c:RegisterEffect(e2) end s.listed_series={SET_WHITE_FOREST} function s.plfilter(c) local p=c:GetOwner() return c:IsSetCard(SET_WHITE_FOREST) and c:IsMonster() and c:CheckUniqueOnField(p,LOCATION_SZONE) and not c:IsForbidden() end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>=2 and Duel.IsExistingTarget(s.plfilter,tp,LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectTarget(tp,s.plfilter,tp,LOCATION_GRAVE,0,2,2,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,2,tp,0) end function s.plop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 then return end local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if ft<=0 then return end if #tg>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) tg=tg:Select(tp,ft,ft,nil) end for tc in tg:Iter() do if Duel.MoveToField(tc,tp,tc:GetOwner(),LOCATION_SZONE,POS_FACEUP,tc:IsMonsterCard()) then --Treat it 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 end function s.synchtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.synchop(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:
During each of your End Phases, destroy this card unless you send 1 "Iron Core of Koa'ki Meiru" from your hand to the Graveyard or reveal 1 Zombie-Type monster in your hand. If a "Koa'ki Meiru" monster you control would be destroyed by battle or by a card effect, you can remove from play 1 "Koa'ki Meiru" monster in your Graveyard instead.
--コアキメイル・グールズスレイブ --Koa'ki Meiru Ghoulungulate local s,id=GetID() function s.initial_effect(c) --cost local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.mtcon) e1:SetOperation(s.mtop) 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_MZONE) e2:SetTarget(s.destg) e2:SetValue(1) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_names={36623431} function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.cfilter1(c) return c:IsCode(36623431) and c:IsAbleToGraveAsCost() end function s.cfilter2(c) return c:IsMonster() and c:IsRace(RACE_ZOMBIE) and not c:IsPublic() end function s.mtop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.HintSelection(Group.FromCards(c)) local g1=Duel.GetMatchingGroup(s.cfilter1,tp,LOCATION_HAND,0,nil) local g2=Duel.GetMatchingGroup(s.cfilter2,tp,LOCATION_HAND,0,nil) local select=2 if #g1>0 and #g2>0 then select=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,1),aux.Stringid(id,2)) elseif #g1>0 then select=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,2)) if select==1 then select=2 end elseif #g2>0 then select=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 else select=Duel.SelectOption(tp,aux.Stringid(id,2)) select=2 end if select==0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=g1:Select(tp,1,1,nil) Duel.SendtoGrave(g,REASON_COST) elseif select==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=g2:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) else Duel.Destroy(c,REASON_COST) end end function s.rfilter(c) return c:IsMonster() and c:IsSetCard(SET_KOAKI_MEIRU) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if #eg~=1 then return false end local tc=eg:GetFirst() return tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) and tc:IsSetCard(SET_KOAKI_MEIRU) and not tc:IsReason(REASON_REPLACE) and tc:IsReason(REASON_BATTLE|REASON_EFFECT) and Duel.IsExistingMatchingCard(s.rfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.rfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's turn, when a card or effect is activated that targets a "Bujin" monster you control (except during the Damage Step): You can banish this card from your Graveyard; negate that effect.
--武神器-ヘツカ --Bujingi Turtle local s,id=GetID() function s.initial_effect(c) --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_GRAVE) e1:SetCondition(s.negcon) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) end function s.tfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsFaceup() and c:IsSetCard(SET_BUJIN) end function s.negcon(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g and g:IsExists(s.tfilter,1,nil,tp) and Duel.IsChainDisablable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Effect Monsters If another monster is Special Summoned to a zone a Link Monster points to, while this monster is on the field: Destroy all monsters in the Main Monster Zones, also your other monsters cannot attack for the rest of this turn. After damage calculation, if this card attacked an opponent's monster: Inflict damage to your opponent equal to that monster's original ATK.
--トポロジック・ボマー・ドラゴン --Topologic Bomber Dragon local s,id=GetID() function s.initial_effect(c) --link summon Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2) c:EnableReviveLimit() --destroy monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --damage 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:SetCode(EVENT_BATTLED) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.cfilter(c,ec) if c:IsLocation(LOCATION_MZONE) then return ec:GetLinkedGroup():IsContains(c) else return (ec:GetLinkedZone(c:GetPreviousControler())&(1<<c:GetPreviousSequence()))~=0 end end function s.descon(e,tp,eg,ep,ev,re,r,rp) if eg:IsContains(e:GetHandler()) then return false end for tc in aux.Next(Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,nil,TYPE_LINK)) do if eg:IsExists(s.cfilter,1,nil,tc) then return true end end return false end function s.desfilter(c) return c:GetSequence()<5 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) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.ftarget) e1:SetLabel(e:GetHandler():GetFieldID()) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) end function s.ftarget(e,c) return e:GetLabel()~=c:GetFieldID() end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker()==e:GetHandler() and Duel.GetAttackTarget() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,Duel.GetAttackTarget():GetBaseAttack()) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetAttackTarget() if bc and bc:IsRelateToBattle() and bc:IsFaceup() then Duel.Damage(1-tp,bc:GetBaseAttack(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Dark Magician" + 1 Level 7 or higher Dragon or Warrior monster If your monster attacks a Defense Position monster, inflict piercing battle damage to your opponent. Once per turn, when your monster destroys an opponent's monster by battle: You can inflict damage to your opponent equal to the destroyed monster's original ATK. If this card is destroyed: You can Special Summon both 1 "Dark Magician" and 1 "Gaia the Dragon Champion" from your hand, Deck, Extra Deck, and/or GY.
--竜魔導騎士ブラック・マジシャン --Dark Magician the Knight of Dragon Magic --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Material Fusion.AddProcMix(c,true,true,CARD_DARK_MAGICIAN,s.ffilter) --Your monsters deal piercing damage local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_PIERCE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) c:RegisterEffect(e1) --Inflict damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --Special Summon 1 "Dark Magician" and 1 "Gaia the Dragon Champion" local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={CARD_DARK_MAGICIAN,CARD_GAIA_CHAMPION} local LOCATION_HAND_DECK_GRAVE_EXTRA=LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA function s.ffilter(c,fc,sumtype,tp) return c:IsLevelAbove(7) and c:IsRace(RACE_DRAGON|RACE_WARRIOR,fc,sumtype,tp) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local dg=eg:Filter(Card.IsPreviousControler,nil,1-tp) if #dg==0 or #dg>1 then return false end local rc=dg:GetFirst():GetReasonCard() if rc:IsRelateToBattle() then return rc:IsControler(tp) else return rc:IsPreviousControler(tp) end end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local dc=eg:Filter(Card.IsPreviousControler,nil,1-tp):GetFirst() if chk==0 then return dc and dc:GetBaseAttack()>0 end local dam=dc:GetBaseAttack() Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.spfilter(c,e,tp) return c:IsCode(CARD_DARK_MAGICIAN,CARD_GAIA_CHAMPION) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.rescon(sg,e,tp,mg) return sg:FilterCount(Card.IsCode,nil,CARD_DARK_MAGICIAN)==1 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND_DECK_GRAVE_EXTRA,0,nil,e,tp) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND_DECK_GRAVE_EXTRA) 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 g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND_DECK_GRAVE_EXTRA,0,nil,e,tp) if #g==0 then return end local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_SPSUMMON) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Summons a monster(s) while you control a Toon monster: Shuffle that monster(s) into the Deck.
--トゥーンのかばん --Toon Briefcase local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_TOON),tp,LOCATION_MZONE,0,1,nil) end function s.filter(c,tp) return c:IsSummonPlayer(tp) and c:IsAbleToDeck() and c:IsLocation(LOCATION_MZONE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.filter,1,nil,1-tp) end local g=eg:Filter(s.filter,nil,1-tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Filter(Card.IsRelateToEffect,nil,e) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains these effects based on the Monster Types on the field. ● Warrior, Beast, or Pyro: Once per turn, if you activate a Trap Card (except during the Damage Step): You can target 1 card your opponent controls; destroy it. ● Dinosaur, Sea Serpent, or Thunder: Once per turn, if you activate a Spell Card (except during the Damage Step): You can inflict 1000 damage to your opponent. ● Machine, Fairy, or Fiend: Once per turn, if you activate a monster effect (except during the Damage Step): You can target 1 face-up monster you control; it gains 1000 ATK (even if this card leaves the field).
--デュエル・アカデミア --Duel Academy --Scripted by The Razgriz 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 your opponent controls if you activate a Trap Card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetRange(LOCATION_FZONE) e1:SetCountLimit(1) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Inflict 1000 damage to your opponent if you activate a Spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) --1 monster you control gains 1000 ATK if you activate a monster effect local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(s.atkcon) e3:SetTarget(s.atktg) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end function s.typecheck(types) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,types),0,LOCATION_MZONE,LOCATION_MZONE,1,nil) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return s.typecheck(RACE_WARRIOR|RACE_BEAST|RACE_PYRO) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsTrapEffect() and rp==tp and not e:GetHandler():IsDisabled() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return s.typecheck(RACE_DINOSAUR|RACE_SEASERPENT|RACE_THUNDER) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() and rp==tp and re:GetHandler()~=c and not c:IsDisabled() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Damage(1-tp,1000,REASON_EFFECT) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return s.typecheck(RACE_MACHINE|RACE_FAIRY|RACE_FIEND) and re:IsMonsterEffect() and rp==tp and not e:GetHandler():IsDisabled() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(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 tc:IsFaceup() and tc:IsRelateToEffect(e) then --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, if an "Appliancer" monster you control battles an opponent's monster (Quick Effect): You can discard this card; for that battle, that monster you control cannot be destroyed, also you take no battle damage. If an "Appliancer" monster(s) you control would be destroyed by a card effect, you can banish this card from your field or GY instead.
--遮断機塊ブレイカーバンクル --Appliancer Breakerbuncle --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Prevent destruction by battle and battle damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.indcon) e1:SetCost(Cost.SelfDiscard) e1:SetOperation(s.indop) c:RegisterEffect(e1) --Destruction replacement for "Appliancer" monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE|LOCATION_MZONE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end s.listed_series={SET_APPLIANCER} function s.indcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not d or a:GetControler()==d:GetControler() then return false end local tc=a if d:IsControler(tp) then tc=d end if not (tc:IsFaceup() and tc:IsSetCard(SET_APPLIANCER)) then return false end e:SetLabelObject(tc) return true end function s.indop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e1,tp) local tc=e:GetLabelObject() if tc and tc:IsRelateToBattle() and tc:IsFaceup() then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetReset(RESET_PHASE|PHASE_DAMAGE) e2:SetValue(1) tc:RegisterEffect(e2) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_APPLIANCER) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT) 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 not c:IsStatus(STATUS_DESTROY_CONFIRMED) and 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:
Neither player can Special Summon monsters. If a card is sent from the Deck or the field to your Graveyard: Destroy this card.
--虚無空間 --Vanity's Emptiness local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) c:RegisterEffect(e1) --prevent special summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) c:RegisterEffect(e2) --destroy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.descon) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) end function s.filter(c,tp) return c:IsPreviousLocation(LOCATION_DECK|LOCATION_ONFIELD) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsRelateToEffect(e) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.Destroy(c,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a card(s) is destroyed by battle or card effect: You can Special Summon this card from your hand. During your Main Phase: You can destroy 1 Dinosaur monster in your hand or field, then Special Summon 1 Dinosaur Normal Monster from your hand or Deck, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Dragon, Dinosaur, Sea Serpent, or Wyrm monsters. You can only use each effect of "Xeno Meteorus" once per turn.
--ゼノ・メテオロス --Xeno Meteorus --Scripted by Satella local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.selfspcon) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Destroy 1 Dinosaur you control or in your hand, then Special Summon 1 Dinosaur Normal Monster from your hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.selfspcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsReason,1,nil,REASON_BATTLE|REASON_EFFECT) end function s.selfsptg(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.selfspop(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.desfilter(c,tp) return c:IsRace(RACE_DINOSAUR) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and Duel.GetMZoneCount(tp,c)>0 end function s.spfilter(c,e,tp) return c:IsType(TYPE_NORMAL) and c:IsRace(RACE_DINOSAUR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,1,nil,tp) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,nil,tp) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Cannot Special Summon from the Extra Deck, except Dragon, Dinosaur, Sea Serpent, and Wyrm monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(_,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(RACE_DRAGON|RACE_DINOSAUR|RACE_SEASERPENT|RACE_WYRM) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(_,c) return not c:IsOriginalRace(RACE_DRAGON|RACE_DINOSAUR|RACE_SEASERPENT|RACE_WYRM) end) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,1,1,nil,tp) if #dg>0 and Duel.Destroy(dg,REASON_EFFECT)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by sending 3 monsters you control to the Graveyard, and cannot be Special Summoned by other ways. When this card is Special Summoned: Toss a coin and gain the appropriate effect. ● Heads: When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can target 1 card in your Graveyard; add that target to your hand. ● Tails: During either player's turn, when a Spell/Trap Card, or monster effect, that targets this card is activated: This card loses exactly 1000 ATK and you negate the activation, and if you do, destroy it.
--アルカナフォースEX-THE LIGHT RULER --Arcana Force EX - The Light Ruler local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Special limitation local e2=Effect.CreateEffect(c) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e2) --Coin registration local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_COIN) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetTarget(s.cointg) e3:SetOperation(s.coinop) c:RegisterEffect(e3) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.toss_coin=true function s.spcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local rg=Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_MZONE,0,nil) return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and #rg>2 and aux.SelectUnselectGroup(rg,e,tp,3,3,nil,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local rg=Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_MZONE,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,3,3,nil,1,tp,HINTMSG_TOGRAVE,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 or #g~=3 then return end Duel.SendtoGrave(g,REASON_COST) g:DeleteGroup() end function s.cointg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function s.coinop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end s.arcanareg(c,Arcana.TossCoin(c,tp)) end function s.arcanareg(c,coin) --coin effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_F) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.negcon) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) Arcana.RegisterCoinResult(c,coin) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return Arcana.GetCoinResult(c)==COIN_HEADS and c:IsRelateToBattle() and c:GetBattleTarget():IsLocation(LOCATION_GRAVE) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or not g:IsContains(c) then return false end return Arcana.GetCoinResult(c)==COIN_TAILS and (re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsMonsterEffect()) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(id)==0 end if c:IsHasEffect(EFFECT_REVERSE_UPDATE) then c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsFaceup() or c:GetAttack()<1000 or not c:IsRelateToEffect(e) or Duel.GetCurrentChain()~=ev+1 then return end if Duel.NegateActivation(ev) then if re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(re:GetHandler(),REASON_EFFECT) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-1000) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This monster may attack your opponent's Life Points directly.
--女王の影武者 --Queen's Double local s,id=GetID() function s.initial_effect(c) --direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 LIGHT Fairy-Type monster in your Graveyard; add it to your hand. You cannot activate non-LIGHT monster effects during the turn you activate this effect.
--幻奏の音姫ローリイット・フランソワ --Shopina the Melodious Maestra local s,id=GetID() function s.initial_effect(c) --Add 1 LIGHT Fairy monster from your GY to your 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) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,s.chainfilter) end function s.chainfilter(re,tp,cid) local attr=Duel.GetChainInfo(cid,CHAININFO_TRIGGERING_ATTRIBUTE) return not (re:IsMonsterEffect() and attr~=ATTRIBUTE_LIGHT) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)==0 end --Cannot activate non-LIGHT monster effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(function(_,re) return re:IsMonsterEffect() and re:GetHandler():IsAttributeExcept(ATTRIBUTE_LIGHT) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when you take 1000 or more damage from your opponent's card effect: Place 1 Payback Counter on this card for every 1000 damage you took. During the End Phase of your opponent's next turn: Destroy this card, and if you do, inflict 2000 damage to your opponent for each Payback Counter on this card.
--倍返し --Double Payback local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x1a) --counter local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_DAMAGE) e1:SetCondition(s.actcon) e1:SetOperation(s.actop) c:RegisterEffect(e1) end s.counter_place_list={0x1a} function s.actcon(e,tp,eg,ep,ev,re,r,rp) return ep==tp and tp~=rp and ev>=1000 and (r&REASON_EFFECT)~=0 end function s.actop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then local ct=math.floor(ev/1000) c:AddCounter(0x1a,ct) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) if Duel.IsTurnPlayer(tp) then e1:SetLabel(0) e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN) else e1:SetLabel(Duel.GetTurnCount()) e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN,2) end c:RegisterEffect(e1) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.GetTurnCount()~=e:GetLabel() end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) local dam=e:GetHandler():GetCounter(0x1a)*2000; Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.Destroy(e:GetHandler(),REASON_EFFECT)~=0 then local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent draws 2 cards.
--強欲な贈り物 --The Gift of Greed 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(1-tp,2) end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,1-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:
2 Level 4 monsters You can detach 1 material from this card; Special Summon 1 LIGHT monster from your hand. If this card is in your GY, except the turn it was sent there: You can target 1 Level 4 LIGHT Fairy monster you control; Special Summon this card, and if you do, attach that monster to this card as material. You can only use each effect of "Starring Knight" once per turn.
--天翔ける騎士 --Starring Knight --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Xyz Summon procedure Xyz.AddProcedure(c,nil,4,2) c:EnableReviveLimit() --Special Summon from your 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_MZONE) e1:SetCountLimit(1,{id,0}) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Summon itself from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(aux.exccon) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.matfilter(c) return c:IsFaceup() and c:IsLevel(4) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY) and not c:IsType(TYPE_TOKEN) end function s.sptg2(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.matfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.matfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.matfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and tc:IsRelateToEffect(e) and s.matfilter(tc) and not tc:IsImmuneToEffect(e) then Duel.Overlay(c,tc,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Raidraptor" monster other than "Raidraptor - Fuzzy Lanius": You can Special Summon this card from your hand. If this card is sent to the Graveyard: You can add 1 "Raidraptor - Fuzzy Lanius" from your Deck to your hand. You can only use each effect of "Raidraptor - Fuzzy Lanius" once per turn. You cannot Special Summon monsters the turn you activate either of this card's effects, except "Raidraptor" monsters.
--RR-ファジー・レイニアス --Raidraptor - Fuzzy Lanius local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetCost(s.cost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.cost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end function s.counterfilter(c) return c:IsSetCard(SET_RAIDRAPTOR) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e2:SetDescription(aux.Stringid(id,1)) e2:SetReset(RESET_PHASE|PHASE_END) e2:SetTargetRange(1,0) Duel.RegisterEffect(e2,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsSetCard(SET_RAIDRAPTOR) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_RAIDRAPTOR) and not c:IsCode(id) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.thfilter(c) return c:IsCode(id) 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:
Tribute 3 "Scareclaw" monsters; for the rest of this turn, your opponent can only Special Summon monsters in Defense Position. During your turn: You can banish this card from your GY; inflict 100 damage to your opponent for each Defense Position monster on the field. You can only use this effect of "Scareclaw Alternative" once per turn.
--肆世壊の継承 --Scareclaw Alternative --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(tp) end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_series={SET_SCARECLAW} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsSetCard,3,false,nil,nil,SET_SCARECLAW) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsSetCard,3,3,false,nil,nil,SET_SCARECLAW) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,id)==0 end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) --Can only Special Summon in Defense Position local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_FORCE_SPSUMMON_POSITION) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(0,1) e1:SetValue(POS_DEFENSE) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(Card.IsDefensePos,0,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return #dg>0 end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#dg*100) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetMatchingGroup(Card.IsDefensePos,0,LOCATION_MZONE,LOCATION_MZONE,nil) if #dg==0 then return end local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) Duel.Damage(p,#dg*100,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a DARK monster(s) you control that was Special Summoned from the Extra Deck is destroyed by battle or card effect: You can send this card from your hand or field to the GY, then target 1 of those destroyed monsters; Special Summon 1 DARK monster from your GY with a different original name from that targeted monster. You can only use this effect of "Rokket Recharger" once per turn. While you control a DARK monster Special Summoned from the Extra Deck, your opponent's monsters cannot target this card for attacks.
--ヴァレット・リチャージャー --Rokket Recharger --Scripted by AlphaKretin 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:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_MZONE|LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --cannot be battle target local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET) e2:SetCondition(s.imcon) e2:SetValue(aux.imval1) c:RegisterEffect(e2) end function s.cfilter(c,tp) return c:IsPreviousControler(tp) and c:GetPreviousAttributeOnField()&ATTRIBUTE_DARK == ATTRIBUTE_DARK and c:IsPreviousLocation(LOCATION_MZONE) and c:IsSummonLocation(LOCATION_EXTRA) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.cfilter,nil,tp) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true else return false end end function s.spfilter(c,oc,e,tp) return not c:IsOriginalCodeRule(oc:GetOriginalCodeRule()) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.tgfilter(c,eg,e,tp) return eg:IsContains(c) and s.cfilter(c,tp) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,c,e,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=e:GetLabelObject() if chkc then return chkc:IsLocation(LOCATION_GRAVE|LOCATION_REMOVED) and s.tgfilter(chkc,g,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,LOCATION_GRAVE|LOCATION_REMOVED,1,nil,g,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tg=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,LOCATION_GRAVE|LOCATION_REMOVED,1,1,nil,g,e,tp) g:DeleteGroup() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,tc,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end function s.imfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsSummonLocation(LOCATION_EXTRA) end function s.imcon(e) return Duel.IsExistingMatchingCard(s.imfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent controls a monster: Target 1 Level 2 or lower Defense Position monster you control; Special Summon from your Deck, in Defense Position, 1 monster with the same name as that monster on the field, but banish it when it leaves the field. You can only activate 1 "Mimiclay" per turn.
--モノマネンド --Mimiclay local s,id=GetID() function s.initial_effect(c) --Special summon 1 level 2 or lower monster from your deck 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 end function s.filter(c,e,tp) return c:IsLevelBelow(2) and c:IsPosition(POS_FACEUP_DEFENSE) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetCode()) end function s.spfilter(c,e,tp,code) return c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) 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_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUPDEFENSE) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsFacedown() or not tc:IsRelateToEffect(e) 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,tc:GetCode()) if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(e:GetHandler()) 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) g:GetFirst():RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a face-up Plant-Type monster(s) on the field is destroyed, place 1 Flower Counter on this card. You can remove any number of Flower Counters from this card to activate these effects. ● 1 Counter: Target 1 Plant-Type monster on the field; that target gains 400 ATK and DEF until the end of this turn. (This ATK gain remains even if this card leaves the field.) ● 2 Counters: Target 1 card on the field; destroy that target. ● 3 Counters: Target 1 Plant-Type monster in your Graveyard; Special Summon that target.
--世界樹 --The World Tree local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x18) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --add counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_DESTROYED) e2:SetCondition(s.ctcon) e2:SetOperation(s.ctop) c:RegisterEffect(e2) --atkup defup local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetDescription(aux.Stringid(id,0)) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCost(s.cost1) e3:SetTarget(s.tg1) e3:SetOperation(s.op1) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DESTROY) e4:SetDescription(aux.Stringid(id,1)) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_SZONE) e4:SetCost(s.cost2) e4:SetTarget(s.tg2) e4:SetOperation(s.op2) c:RegisterEffect(e4) --special summon local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetDescription(aux.Stringid(id,2)) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_SZONE) e5:SetCost(s.cost3) e5:SetTarget(s.tg3) e5:SetOperation(s.op3) c:RegisterEffect(e5) end s.counter_place_list={0x18} function s.ctfilter(c) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and (c:GetPreviousRaceOnField()&RACE_PLANT)~=0 end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.ctfilter,1,nil) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():AddCounter(0x18,1) end function s.cost1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x18,1,REASON_COST) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) e:GetHandler():RemoveCounter(tp,0x18,1,REASON_COST) end function s.filter1(c) return c:IsFaceup() and c:IsRace(RACE_PLANT) end function s.tg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter1(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,1,0,500) end function s.op1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(400) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end function s.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x18,2,REASON_COST) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) e:GetHandler():RemoveCounter(tp,0x18,2,REASON_COST) end function s.tg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.op2(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.cost3(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x18,3,REASON_COST) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) e:GetHandler():RemoveCounter(tp,0x18,3,REASON_COST) end function s.filter3(c,e,tp) return c:IsRace(RACE_PLANT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.tg3(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter3(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter3,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter3,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.op3(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Special Summoned by the effect of a "Gladiator Beast" monster: Target 1 face-up monster; destroy that target. At the end of the Battle Phase, if this card attacked or was attacked: You can shuffle it into the Deck; Special Summon 1 "Gladiator Beast" monster from your Deck, except "Gladiator Beast Murmillo".
--剣闘獣ムルミロ --Gladiator Beast Murmillo local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(aux.gbspcon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfToDeck) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.destg(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 true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetBattledGroupCount()>0 end function s.filter(c,e,tp) return not c:IsCode(id) and c:IsSetCard(SET_GLADIATOR) and c:IsCanBeSpecialSummoned(e,105,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc then Duel.SpecialSummon(tc,105,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(tc:GetOriginalCode(),RESET_EVENT|RESETS_STANDARD_DISABLE,0,0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send all cards in your hand and on your side of the field to the Graveyard. Call the type of card (Spell, Trap, or Monster) on top of your Deck. If you call it right, exchange your current Life Points with your opponent's current ones.
--大逆転クイズ --Reversal Quiz 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:SetCost(s.cost) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cfilter(c) return not c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,LOCATION_HAND|LOCATION_ONFIELD,0) g:RemoveCard(e:GetHandler()) if chk==0 then return #g>0 and not g:IsExists(s.cfilter,1,nil) end Duel.SendtoGrave(g,REASON_COST) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetDecktopGroup(tp,1) local tc=g:GetFirst() if not tc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) local res=Duel.SelectOption(tp,70,71,72) Duel.ConfirmDecktop(tp,1) if (res==0 and tc:IsMonster()) or (res==1 and tc:IsSpell()) or (res==2 and tc:IsTrap()) then local lp1=Duel.GetLP(tp) local lp2=Duel.GetLP(1-tp) Duel.SetLP(tp,lp2) Duel.SetLP(1-tp,lp1) end Duel.ShuffleDeck(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 Winged Beast monster in your hand or face-up field; add 1 Winged Beast monster from your Deck to your hand with the same Level that the Tributed monster had. You can only activate 1 "Swallow's Cowrie" per turn.
--スワローズ・カウリー --Swallow's Cowrie --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Search 1 Winged Beast monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.costfilter(c,tp) return c:IsRace(RACE_WINGEDBEAST) and c:HasLevel() and (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetLevel()) end function s.thfilter(c,lv) return c:IsRace(RACE_WINGEDBEAST) and c:IsLevel(lv) and c:IsAbleToHand() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,true,nil,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local tc=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,true,nil,nil,tp):GetFirst() e:SetLabel(tc:GetLevel()) Duel.Release(tc,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetLabel()==100 end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end