instruction
stringclasses
1 value
input
stringlengths
10
1.11k
output
stringlengths
67
7.06k
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Summoned: You can Special Summon 1 "Iron Knight" from your Deck, also if "Golden Castle of Stromberg" is not in a Field Zone when this effect resolves, you cannot Special Summon monsters from the Extra Deck for the rest of this turn. You can only use this effect of "Iron Hans" once per turn. Gains 1000 ATK for each "Iron Knight" you control, while "Golden Castle of Stromberg" is in a Field Zone.
--鉄のハンス --Iron Hans --scripted by Naim local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) 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) --Change ATK local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCode(EFFECT_UPDATE_ATTACK) e4:SetCondition(s.condition) e4:SetValue(s.value) c:RegisterEffect(e4) end s.listed_names={CARD_STROMBERG,73405179} function s.fieldcond(c) return c:IsFaceup() and c:IsCode(CARD_STROMBERG) end function s.spfilter(c,e,tp) return c:IsCode(73405179) 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.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstMatchingCard(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) if tc then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) if not Duel.IsExistingMatchingCard(s.fieldcond,tp,LOCATION_FZONE,LOCATION_FZONE,1,nil,tp) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetDescription(aux.Stringid(id,2)) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp) end end end function s.splimit(e,c) return c:IsLocation(LOCATION_EXTRA) end function s.atkfilter(c) return c:IsFaceup() and c:IsCode(73405179) end function s.value(e,c) return Duel.GetMatchingGroupCount(s.atkfilter,c:GetControler(),LOCATION_MZONE,0,nil)*1000 end function s.condition(e) return Duel.IsExistingMatchingCard(s.fieldcond,0,LOCATION_FZONE,LOCATION_FZONE,1,nil) 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 change all face-up monsters your opponent controls to face-down Defense Position. Illusion and Spellcaster Synchro Monsters you control gain 500 ATK, also if they attack a Defense Position monster, inflict double piercing battle damage to your opponent.
--白き森の魔狼シルウィア --Silvera, Wolf Tamer of the White Forest --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Flip all opponent monsters face-down local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --Illusion and Spellcaster Synchro Monsters gain 500 ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(function(e,c) return c:IsRace(RACE_ILLUSION|RACE_SPELLCASTER) and c:IsType(TYPE_SYNCHRO) end) e2:SetValue(500) c:RegisterEffect(e2) --Illusion and Spellcaster Synchro Monsters inflict double piercing damage local e3=e2:Clone() e3:SetCode(EFFECT_PIERCE) e3:SetValue(DOUBLE_DAMAGE) c:RegisterEffect(e3) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsCanTurnSet,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Fiend monster you control battles, during the Damage Step: Pay LP in multiples of 100, then target the opponent's battling monster; that opponent's monster loses that much ATK and DEF, until the end of this turn.
--冥王の咆哮 --Bark of Dark Ruler local s,id=GetID() function s.initial_effect(c) --atkdown local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local phase=Duel.GetCurrentPhase() if phase~=PHASE_DAMAGE or Duel.IsDamageCalculated() then return false end local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if a:IsControler(tp) then e:SetLabelObject(d) return a:IsFaceup() and a:IsRace(RACE_FIEND) and a:IsRelateToBattle() and d and d:IsFaceup() and d:IsRelateToBattle() elseif d and d:IsControler(tp) then e:SetLabelObject(a) return d:IsFaceup() and d:IsRace(RACE_FIEND) and d:IsRelateToBattle() and a and a:IsFaceup() and a:IsRelateToBattle() end 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.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tc=e:GetLabelObject() if chkc then return chkc==tc end if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return Duel.CheckLPCost(tp,100) and (tc:IsAttackAbove(100) or tc:IsDefenseAbove(100)) and tc:IsCanBeEffectTarget(e) end local maxc=Duel.GetLP(tp) local maxpay=tc:GetAttack() local def=tc:GetDefense() if maxpay<def then maxpay=def end if maxpay<maxc then maxc=maxpay end if maxc>5000 then maxc=5000 end maxc=math.floor(maxc/100)*100 local t={} for i=1,maxc/100 do t[i]=i*100 end local cost=Duel.AnnounceNumber(tp,table.unpack(t)) Duel.PayLPCost(tp,cost) Duel.SetTargetCard(tc) Duel.SetTargetParam(cost) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local bc=Duel.GetFirstTarget() local val=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) if not bc or not bc:IsRelateToEffect(e) or not bc:IsControler(1-tp) then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-val) e1:SetReset(RESETS_STANDARD_PHASE_END) bc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) bc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Double-Edged Sword". The equipped monster gains 2000 ATK, also both players take any battle damage from attacks involving the equipped monster. If you take 2000 or more battle damage: Send this card to the GY.
--脆刃の剣 --Double-Edged Sword local s,id=GetID() function s.initial_effect(c) --equip aux.AddEquipProcedure(c) c:SetUniqueOnField(1,0,id) --Atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(2000) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_BOTH_BATTLE_DAMAGE) c:RegisterEffect(e2) --to grave local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLE_DAMAGE) e3:SetRange(LOCATION_SZONE) e3:SetCondition(s.tgcon) e3:SetOperation(s.tgop) c:RegisterEffect(e3) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return ep==tp and ev>=2000 end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 monster in your opponent's GY; discard 1 Fiend monster, and if you do, banish that target.
--暗黒の瘴気 --Dark Smog 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,TIMING_END_PHASE) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsRace(RACE_FIEND) and c:IsDiscardable() end function s.rfilter(c) return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rfilter(chkc) end if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) and Duel.IsExistingTarget(s.rfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local cg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) if #cg==0 then return end Duel.SendtoGrave(cg,REASON_EFFECT|REASON_DISCARD) if tc and tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish 2 "Neo-Spacian" monsters with different names from your GY; Special Summon 2 "Neo-Spacian" monsters with different names from your hand, Deck, and/or GY, also, for the rest of this turn you cannot Special Summon monsters from the Extra Deck, except Fusion Monsters. If a face-up Fusion Monster that lists "Elemental HERO Neos" as material returns from your field to the Extra Deck: You can banish this card from your GY; Special Summon 1 of your banished "Neo-Spacian" monsters. You can only activate 1 "Contact Gate" per turn.
--コンタクト・ゲート --Contact Gate --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Special Summon 1 banished "Neo-Spacian" local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_DECK) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_NEO_SPACIAN} s.listed_names={CARD_NEOS} function s.cfilter(c) return c:IsSetCard(SET_NEO_SPACIAN) and c:IsMonster() and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.filter(c,e,tp) return c:IsSetCard(SET_NEO_SPACIAN) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.rescon1(sg,e,tp,mg) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,sg,e,tp) return aux.ChkfMMZ(2)(sg,e,tp,mg) and sg:GetClassCount(Card.GetCode)==2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon2,0) end function s.rescon2(sg,e,tp,mg) return sg:GetClassCount(Card.GetCode)==2 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local rg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_GRAVE|LOCATION_MZONE,0,nil) if chk==0 then return aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon1,0) end local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon1,1,tp,HINTMSG_REMOVE) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon2,1,tp,HINTMSG_SPSUMMON) if #sg==2 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end function s.splimit(e,c) return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not c:IsOriginalType(TYPE_FUSION) end function s.spcfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsType(TYPE_FUSION) and c:ListsCodeAsMaterial(CARD_NEOS) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spcfilter,1,nil,tp) end function s.spfilter(c,e,tp) return s.filter(c,e,tp) and c:IsFaceup() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters from your hand or either field as Fusion Material, including a "Buster Blader" that it lists as material. If this card is in your GY: You can send 1 card from your hand to the GY; add this card to your hand. You can only use each effect of "Destruction Swordsman Fusion" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--破壊剣士融合 --Destruction Swordsman Fusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.ListsCodeAsMaterial,CARD_BUSTER_BLADER),nil,s.fextra) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --Add this card to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.fcheck(tp,sg,fc) return sg:IsExists(aux.FilterBoolFunction(Card.IsSummonCode,fc,SUMMON_TYPE_FUSION,tp,CARD_BUSTER_BLADER),1,nil) end function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(aux.FaceupFilter(Card.IsAbleToGrave)),tp,0,LOCATION_MZONE,nil),s.fcheck end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,1,1,REASON_COST) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card you control is destroyed by your opponent's card and sent to your GY: Send the top card of your Deck to the GY, then, if it is a WATER monster, draw 1 card.
--イマイルカ --Imairuka local s,id=GetID() function s.initial_effect(c) --Send the top card of your Deck to the GY, then, if it is a WATER monster, draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DECKDES+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.tgcon) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardDeck(tp,1,REASON_EFFECT)==1 then local sc=Duel.GetOperatedGroup():GetFirst() if sc:IsAttribute(ATTRIBUTE_WATER) and sc:IsLocation(LOCATION_GRAVE) and Duel.IsPlayerCanDraw(tp) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: Return all face-up Spells and Traps from the field to the hand.
--霞の谷の執行者 --Mist Valley Executor local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 1 monster When an opponent's monster declares an attack: You can Tribute this card; change that opponent's monster's ATK to 0, until the end of this turn. If this card is in your GY (Quick Effect): You can Tribute 1 Level 1 monster; Special Summon this card. You can only use this effect of "Linkuriboh" once per turn.
--リンクリボー --Linkuriboh local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon Link.AddProcedure(c,aux.FilterBoolFunction(Card.IsLevel,1),1) --Change ATK to 0 local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.atkcon) e1:SetCost(Cost.SelfTribute) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Special Summon itself from the GY local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_BATTLE_START|TIMING_END_PHASE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() return at and Duel.IsTurnPlayer(1-tp) and at:HasNonZeroAttack() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsRelateToBattle() and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.cfilter(c,ft,tp) return c:IsLevel(1) and (ft>0 or c:GetSequence()<5) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,ft,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,ft,tp) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters you control as Fusion Materials, including this card. If this card in the Pendulum Zone is destroyed: You can target 1 Dragon-Type Fusion Monster in your Graveyard; Special Summon it, but destroy it during the End Phase.
--EMトランプ・ガール --Performapal Trump Girl local s,id=GetID() function s.initial_effect(c) --pendulum summon Pendulum.AddProcedure(c) --fusion summon local params = {nil,Fusion.OnFieldMat,nil,nil,Fusion.ForcedHandler} local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_FUSION_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(Fusion.SummonEffTG(table.unpack(params))) e2:SetOperation(Fusion.SummonEffOP(table.unpack(params))) c:RegisterEffect(e2) --spsummon and destroy local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_DESTROYED) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_PZONE) end function s.spfilter(c,e,tp) return c:IsType(TYPE_FUSION) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then local fid=e:GetHandler():GetFieldID() tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetLabel(fid) e1:SetLabelObject(tc) e1:SetCondition(s.descon) e1:SetOperation(s.desop) Duel.RegisterEffect(e1,tp) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:GetFlagEffectLabel(id)~=e:GetLabel() then e:Reset() return false else return true end end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetLabelObject(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a card or effect that targets 1 Spellcaster monster you control (and no other cards), while this card is in your hand or GY (Quick Effect): You can Special Summon this card. You can only use this effect of "Palladium Oracle Mana" once per turn. Level 7 or higher Spellcaster monsters you control cannot be destroyed by card effects. If this card is destroyed by battle or card effect: You can Special Summon 1 "Dark Magician Girl" from your hand, Deck, or GY.
--守護神官マナ --Palladium Oracle Mana 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_QUICK_O) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCode(EVENT_CHAINING) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.efilter) e2:SetValue(1) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCondition(s.spcon2) e3:SetTarget(s.sptg2) e3:SetOperation(s.spop2) c:RegisterEffect(e3) end s.listed_names={CARD_DARK_MAGICIAN_GIRL} function s.spcon(e,tp,eg,ep,ev,re,r,rp) if rp==tp or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not tg then return false end local tc=tg:GetFirst() return #tg==1 and tc:IsLocation(LOCATION_MZONE) and tc:IsRace(RACE_SPELLCASTER) and tc:IsFaceup() and tc:IsControler(tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.efilter(e,c) return c:IsRace(RACE_SPELLCASTER) and c:IsLevelAbove(7) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT+REASON_BATTLE)~=0 end function s.spfilter(c,e,tp) return c:IsCode(CARD_DARK_MAGICIAN_GIRL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is flipped face-up: Destroy all Special Summoned monsters on the field. Neither player can Special Summon monsters.
--フォッシル・ダイナ パキケファロ --Fossil Dyna Pachycephalo local s,id=GetID() function s.initial_effect(c) --disable spsummon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,1) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_FLIP) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.filter(c) return c:IsSpecialSummoned() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Elemental HERO Neos" and all Fusion Monsters that specifically list "Elemental HERO Neos" as a Fusion Material gain 500 ATK. Fusion Monsters that specifically list "Elemental HERO Neos" as a Fusion Material do not have to activate their effects during the End Phase that shuffle them into the Extra Deck.
--ネオスペース --Neo Space local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Increase ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(s.atktg) e2:SetValue(500) c:RegisterEffect(e2) --"Neos" Fusions can choose to not return local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(id) e3:SetRange(LOCATION_FZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) c:RegisterEffect(e3) end s.listed_names={CARD_NEOS} function s.atktg(e,c) return c:IsCode(CARD_NEOS) or (c:IsType(TYPE_FUSION) and c:ListsCodeAsMaterial(CARD_NEOS)) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters, including a Rock monster If this card is Special Summoned: You can target 1 Rock monster in your GY; this card gains ATK equal to that monster's ATK. During your opponent's Main Phase (Quick Effect): You can target 1 other monster on the field with ATK less than or equal to this card; this card loses ATK exactly equal to that monster's ATK, and if it does, destroy that monster. You can only use each effect of "Dogurad, the Stonetrooper" once per turn.
--機動石器ドグラード --Dogurad, the Stonetrooper --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 2+ monsters, including a Rock monster Link.AddProcedure(c,nil,2,3,s.matcheck) --Gains the ATK of 1 Rock monster in your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Destroy 1 other monster on the field with ATK less than or equal to this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,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.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.matcheck(g,sc,sumtype,tp) return g:IsExists(Card.IsRace,1,nil,RACE_ROCK,sc,sumtype,tp) end function s.atkfilter(c) return c:IsRace(RACE_ROCK) and c:GetAttack()>0 end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_GRAVE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then --This card gains ATK equal to that monster's local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.desfilter(c,atk) return c:HasNonZeroAttack() and c:IsAttackBelow(atk) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local atk=c:GetAttack() if chkc then return chkc:IsOnField() and s.desfilter(chkc,atk) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,atk) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c,atk) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,c,1,tp,-g:GetFirst():GetAttack()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsRelateToEffect(e) and tc:HasNonZeroAttack() and c:IsAttackAbove(tc:GetAttack()) and c:UpdateAttack(-tc:GetAttack())==-tc:GetAttack() 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 or Special Summoned: You can add 1 Level 8 "Magna Warrior" monster from your Deck to your hand. You can only use this effect of "Alpha The Electromagnet Warrior" once per turn. During your opponent's turn: You can Tribute this card; Special Summon 1 Level 4 "Magnet Warrior" monster from your Deck (this is a Quick Effect).
--電磁石の戦士α --Alpha The Electromagnet Warrior local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --special summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetHintTiming(0,TIMING_END_PHASE) e3:SetCondition(s.spcon) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_MAGNA_WARRIOR,SET_MAGNET_WARRIOR} function s.thfilter(c) return c:IsSetCard(SET_MAGNA_WARRIOR) and c:IsLevel(8) 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.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MAGNET_WARRIOR) and c:IsLevel(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you have 2 or more "X-Saber" monsters in your Graveyard and control no monsters, you can Special Summon this card from your hand.
--XX-セイバー ガルドストライク --XX-Saber Gardestrike 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 s.listed_series={SET_X_SABER} function s.spfilter(c) return c:IsSetCard(SET_X_SABER) and c:IsMonster() end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0 and Duel.IsExistingMatchingCard(s.spfilter,c:GetControler(),LOCATION_GRAVE,0,2,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be treated as 2 Tributes for the Tribute Summon of a Fairy-Type monster. After this card is Special Summoned to your side of the field, you can Normal Summon 1 "Melodious" monster during your Main Phase this turn, in addition to your Normal Summon/Set. (You can only gain this effect once per turn.)
--幻奏の音女セレナ --Serenade the Melodious Diva local s,id=GetID() function s.initial_effect(c) --double tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DOUBLE_TRIBUTE) e1:SetValue(s.condition) c:RegisterEffect(e1) --extra summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetOperation(s.regop) c:RegisterEffect(e2) end s.listed_series={SET_MELODIOUS} function s.condition(e,c) return c:IsRace(RACE_FAIRY) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_MELODIOUS)) 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:
This card cannot declare an attack unless you Tribute 1 monster.
--漆黒の豹戦士パンサーウォリアー --Panther Warrior local s,id=GetID() function s.initial_effect(c) --attack cost local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ATTACK_COST) e1:SetCost(s.atcost) e1:SetOperation(s.atop) c:RegisterEffect(e1) end function s.atcost(e,c,tp) return Duel.CheckReleaseGroup(tp,nil,1,e:GetHandler()) end function s.atop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsAttackCostPaid()~=2 and e:GetHandler():IsLocation(LOCATION_MZONE) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local tc=Duel.GetReleaseGroup(tp):Filter(aux.TRUE,e:GetHandler()):SelectUnselect(Group.CreateGroup(),tp,Duel.IsAttackCostPaid()==0, Duel.IsAttackCostPaid()==0) if tc then Duel.Release(tc,REASON_COST) Duel.AttackCostPaid() else Duel.AttackCostPaid(2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Warrior monster: You can Special Summon this card from your hand. You can send this card from the field to the GY; Special Summon 1 Level 4 or lower Warrior monster from your hand, and if you do, your opponent cannot target it with card effects this turn. You can only use each effect of "Fire Flint Lady" once per turn.
--キリビ・レディ --Fire Flint Lady --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special summon 1 level 4 or lower warrior monster from hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.spcost) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_WARRIOR),tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return c:IsAbleToGraveAsCost() and (ft>0 or c:GetSequence()<5) end Duel.SendtoGrave(c,REASON_COST) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.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.spop2(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 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then --Cannot be targeted by opponent's card effects local e0=Effect.CreateEffect(e:GetHandler()) e0:SetDescription(3061) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e0:SetProperty(EFFECT_FLAG_CLIENT_HINT) e0:SetValue(aux.tgoval) e0:SetReset(RESETS_STANDARD_PHASE_END) g:GetFirst():RegisterEffect(e0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be destroyed by card effects while you control a Fusion Monster. You can only use each of the following effects of "Dragonmaid Tinkhec" once per turn. ● (Quick Effect): You can discard this card, then target 1 "Dragonmaid" monster you control; it gains 2000 ATK until the end of this turn. ● At the end of the Battle Phase: You can return this card to the hand, and if you do, Special Summon 1 Level 3 "Dragonmaid" monster from your hand.
--ドラゴンメイド・フランメ --Dragonmaid Tinkhec --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --ATK increase local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Prevent destruction by effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetCondition(s.incon) e2:SetValue(1) c:RegisterEffect(e2) --Special summon from hand local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_DRAGONMAID} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_DRAGONMAID) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(2000) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.incon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_FUSION),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.spfilter(c,e,tp) return c:GetLevel()==3 and c:IsSetCard(SET_DRAGONMAID) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1 and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SendtoHand(c,nil,REASON_EFFECT)~=0 and c:IsLocation(LOCATION_HAND) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Synchro Monster in your Graveyard; Special Summon that target in Defense Position, but its effects are negated, its Level is reduced by 1, its DEF becomes 0, also its battle position cannot be changed.
--ロスト・スター・ディセント --Descending Lost Star local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Synchro Monster from your GY in Defense Position, but its effects are negated, its Level is reduced by 1, its DEF becomes 0, also its battle position cannot be changed local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) end function s.spfilter(c,e,tp) if not c:IsSynchroMonster() then return false end c:AssumeProperty(ASSUME_LEVEL,c:GetLevel()-1) c:AssumeProperty(ASSUME_DEFENSE,0) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return 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,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end tc:AssumeProperty(ASSUME_LEVEL,tc:GetLevel()-1) tc:AssumeProperty(ASSUME_DEFENSE,0) if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then local c=e:GetHandler() --Its effects are negated tc:NegateEffects(c) --Its Level is reduced by 1 local e1=Effect.CreateEffect(c) e1:SetDescription(3313) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(-1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) --Its DEF becomes 0 local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE_FINAL) e2:SetValue(0) tc:RegisterEffect(e2) --Also its battle position cannot be changed local e3=e1:Clone() e3:SetCode(EFFECT_CANNOT_CHANGE_POSITION) tc:RegisterEffect(e3) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase (Quick Effect): You can target up to 3 Spells/Traps in your GY; banish them, and if you do, shuffle them into the Deck during the End Phase of the next turn. During your Standby Phase: You can target 1 of your banished Spells/Traps; Set it. You can only use each effect of "Secret Stash Slipshod Squirrel" once per turn.
--きのみ隠しのうっかりす --Secret Stash Slipshod Squirrel --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Banish up to 3 Spells/Traps from your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.rmtg) e1:SetOperation(s.rmop) c:RegisterEffect(e1) --Set 1 of your banished Spells/Traps local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_PHASE|PHASE_STANDBY) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsSpellTrap() and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsSpellTrap,Card.IsAbleToRemove),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,aux.AND(Card.IsSpellTrap,Card.IsAbleToRemove),tp,LOCATION_GRAVE,0,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,#g,tp,LOCATION_REMOVED) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 or Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)==0 then return end local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_REMOVED) if #og>0 then local turn=Duel.GetTurnCount() aux.DelayedOperation(og,PHASE_END,id,e,tp, function(ag) Duel.HintSelection(ag) Duel.SendtoDeck(ag,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end, function() return Duel.GetTurnCount()==turn+1 end, nil,2 ) end end function s.setfilter(c) return c:IsSpellTrap() and c:IsSSetable() and c:IsFaceup() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.setfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.setfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_REMOVED,0,1,1,nil) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SSet(tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent from the hand to your Graveyard: You can Special Summon 1 "Gusto" monster from your Deck. You can only use the effect of "Gusto Griffin" once per turn.
--ガスタ・グリフ --Gusto Griffin 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_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GUSTO} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function s.filter(c,e,tp) return c:IsSetCard(SET_GUSTO) 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) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase, if you have a Reptile monster in your GY (Quick Effect): You can send this card from your hand to the GY, then target 1 face-up monster your opponent controls; change its ATK to 0. If your opponent controls a monster with 0 ATK: You can Special Summon this card from your GY. You can only use 1 "Reptilianne Nyami" effect per turn, and only once that turn.
--レプティレス・ニャミニ --Reptilianne Nyami --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Change ATK to 0 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end --Functions for zero ATK effect function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() and Duel.IsExistingMatchingCard(Card.IsRace,tp,LOCATION_GRAVE,0,1,nil,RACE_REPTILE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:HasNonZeroAttack() end if chk==0 then return Duel.IsExistingTarget(Card.HasNonZeroAttack,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.HasNonZeroAttack,tp,0,LOCATION_MZONE,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(0) tc:RegisterEffect(e1) end end --Functions for Special Summon effect function s.spfilter(c) return c:IsFaceup() and c:IsAttack(0) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spfilter,tp,0,LOCATION_MZONE,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Level 4 or lower Dragon or Spellcaster monster You cannot Special Summon, except Dragon monsters. You can only use each of the following effects of "Spirit with Eyes of Blue" once per turn. If this card is Link Summoned: You can take 1 "Mausoleum of White" from your Deck and either add it to your hand or send it to the GY. You can Tribute this card; Special Summon 1 "Blue-Eyes" monster from your hand or GY, but if you Special Summoned an Effect Monster from your GY by this effect, it cannot attack and its effects are negated.
--青き眼の精霊 --Spirit with Eyes of Blue --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 1 Level 4 or lower Dragon or Spellcaster monster Link.AddProcedure(c,s.matfilter,1,1) --You cannot Special Summon, except Dragon monsters local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return not c:IsRace(RACE_DRAGON) end) c:RegisterEffect(e1) --Add to your hand or send to the GY 1 "Mausoleum of White" from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end) e2:SetTarget(s.thtgtg) e2:SetOperation(s.thtgop) c:RegisterEffect(e2) --Special Summon 1 "Blue-Eyes" monster from your hand or GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={24382602} --"Mausoleum of White" s.listed_series={SET_BLUE_EYES} function s.matfilter(c,lc,sumtype,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON|RACE_SPELLCASTER,lc,sumtype,tp) end function s.thtgfilter(c) return c:IsCode(24382602) and (c:IsAbleToHand() or c:IsAbleToGrave()) end function s.thtgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thtgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.thtgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local g=Duel.SelectMatchingCard(tp,s.thtgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then aux.ToHandOrElse(g,tp) end end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BLUE_EYES) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) and sc:IsType(TYPE_EFFECT) and sc:IsSummonLocation(LOCATION_GRAVE) then local c=e:GetHandler() --It cannot attack local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) --Its effects are negated sc:NegateEffects(c) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 face-up Level 8 Dragon monster you control to the GY; Special Summon 1 Rank 8 Dragon Xyz Monster from your Extra Deck (this is treated as an Xyz Summon). You can only activate 1 "Revelation of Hope" per turn.
--希望の天啓 --Revelation of Hope --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Rank 8 Dragon Xyz Monster from your Extra Deck. local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.costfilter(c,e,tp) return c:IsLevel(8) and c:IsRace(RACE_DRAGON) and c:IsFaceup() and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end function s.spfilter(c,e,tp,costc) local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,c,nil,REASON_XYZ) return #pg<=0 and c:IsRank(8) and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,costc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SendtoGrave(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local cost_chk=e:GetLabel()==1 e:SetLabel(0) return cost_chk or Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then sc:CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, when your opponent's monster declares an attack: You can send the top card of your Deck to the GY, and if you do, negate that attack.
--ナチュル・バタフライ --Naturia Butterfly local s,id=GetID() function s.initial_effect(c) --negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst():GetControler()~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,1,REASON_EFFECT) Duel.NegateAttack() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters This card can make a second attack during each Battle Phase. At the start of the Damage Step, if this card battles: It gains 200 ATK. If this card is sent to the GY: You can target 1 of your banished "Speedroid" cards; add it to your hand. You can only Special Summon "Hi-Speedroid Chanbara(s)" once per turn.
--HSRチャンバライダー --Hi-Speedroid Chanbara local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --extra attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(1) c:RegisterEffect(e1) --attack up local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLE_START) e2:SetCondition(s.condition) e2:SetOperation(s.operation) c:RegisterEffect(e2) --tohand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_TO_GRAVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_SPEEDROID} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsRelateToBattle() end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(200) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SPEEDROID) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.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) 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:
If you control no cards (Quick Effect): You can discard this card; apply these effects this turn. ● Each time your opponent Special Summons a monster(s) from the Deck and/or Extra Deck, immediately draw 1 card. ● Once, during this End Phase, if the number of cards in your hand is more than the number of cards your opponent controls +6, you must randomly shuffle cards from your hand into the Deck so the number in your hand equals the number your opponent controls +6. You can only activate 1 other "Mulcharmy" monster effect, the turn you activate this effect.
--マルチャミー・フワロス --Mulcharmy Fuwalos local s,id=GetID() function s.initial_effect(c) --Apply effects for the rest of the turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCondition(function(e,tp) return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 end) e1:SetCost(s.effcost) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) --Keep track of the activations of a "Mulcharmy" monster's effect Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,function(re) return not (re:GetHandler():IsSetCard(SET_MULCHARMY) and re:IsMonsterEffect()) end) end s.listed_series={SET_MULCHARMY} function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsDiscardable() and Duel.GetCustomActivityCount(id,tp,ACTIVITY_CHAIN)<2 end Duel.SendtoGrave(c,REASON_COST|REASON_DISCARD) --You can only activate 1 other "Mulcharmy" monster effect, the turn you activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT+EFFECT_FLAG_OATH) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetCondition(function(e) return Duel.GetCustomActivityCount(id,e:GetHandlerPlayer(),ACTIVITY_CHAIN)>=2 end) e1:SetValue(function(e,re,tp) return re:GetHandler():IsSetCard(SET_MULCHARMY) and re:IsMonsterEffect() end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.effop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Draw 1 card each time your opponent Special Summons a monster(s) from the Deck and/or Extra Deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.drcon) e1:SetOperation(s.drop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Shuffle random cards from your hand to the Deck during the End Phase local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetCountLimit(1) e2:SetOperation(s.tdop) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end function s.drconfilter(c,tp) return c:IsSummonPlayer(1-tp) and c:IsSummonLocation(LOCATION_DECK|LOCATION_EXTRA) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.drconfilter,1,nil,tp) end function s.drop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsChainSolving() then Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,1,REASON_EFFECT) else local eff=e:GetLabelObject() if eff and not eff:IsDeleted() then eff:SetLabel(eff:GetLabel()+1) else local c=e:GetHandler() --Draw cards when the current Chain Link finishes resolving local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_CHAIN_SOLVED) e1:SetOperation(s.chainsolvedop) e1:SetLabel(1) e1:SetLabelObject(e) e1:SetReset(RESET_CHAIN) Duel.RegisterEffect(e1,tp) e:SetLabelObject(e1) --Reset "e1" and the label object of "e" at the end of the Chain Link local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetOperation(function() e:SetLabelObject(nil) e1:Reset() end) e2:SetReset(RESET_CHAIN) Duel.RegisterEffect(e2,tp) end end end function s.chainsolvedop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,1-tp,id) Duel.Draw(tp,e:GetLabel(),REASON_EFFECT) e:Reset() e:GetLabelObject():SetLabelObject(nil) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local dif=Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)-(Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)+6) if dif>0 then local g=Duel.GetFieldGroup(tp,LOCATION_HAND,0):Match(Card.IsAbleToDeck,nil):RandomSelect(tp,dif) if #g==0 then return end Duel.Hint(HINT_CARD,1-tp,id) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 Rock monster; Special Summon from your Deck, 1 Rock monster that has the same original Attribute and Level as that monster, in face-up Attack Position or face-down Defense Position. You can only use this effect of "Doki Doki" once per turn.
--怒気土器 --Doki Doki local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(100) return true end function s.cfilter(c,e,tp) return c:IsRace(RACE_ROCK) and c:IsDiscardable() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetOriginalAttribute(),c:GetOriginalLevel()) end function s.spfilter(c,e,tp,att,lv) return c:IsRace(RACE_ROCK) and c:IsOriginalAttribute(att) and c:GetOriginalLevel()==lv and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()~=100 then return false end e:SetLabel(0) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) e:SetLabelObject(g:GetFirst()) Duel.SendtoGrave(g,REASON_COST|REASON_DISCARD) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,0,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local gc=e:GetLabelObject() 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,gc:GetOriginalAttribute(),gc:GetOriginalLevel()) local tc=g:GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK|POS_FACEDOWN_DEFENSE)~=0 then if tc:IsFacedown() then Duel.ConfirmCards(1-tp,tc) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The equipped monster gains 200 ATK for each monster in your GY. During the End Phase, if this card is in the GY because it was sent there from the field this turn: You can Set this card, but banish it when it leaves the field. You can only use this effect of "Disposable Learner Device" once per turn.
--使い捨て学習装置 --Disposable Learner Device --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Equipped monster gains 200 ATK per monster in GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.val) c:RegisterEffect(e1) --Register the fact it was sent from field to GY local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.regcon) e2:SetOperation(s.regop) c:RegisterEffect(e2) --Set itself from GY local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetRange(LOCATION_GRAVE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e3:SetCondition(s.setcon) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) end function s.val(e,c) return Duel.GetMatchingGroupCount(Card.IsMonster,e:GetHandler():GetControler(),LOCATION_GRAVE,0,nil)*200 end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.regop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),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) --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Normal Summon this card without Tributing, but its original ATK is halved and its Level becomes 3. Once per turn: You can declare 1 Monster Type; if this card is used as a Synchro Material Monster this turn, treat this card and the other Synchro Material Monsters as that Monster Type for that Synchro Summon. If you activate this effect, you cannot Normal or Special Summon monsters for the rest of this turn, except monsters with the declared Monster Type.
--ジェノミックス・ファイター --Genomix Fighter local s,id=GetID() function s.initial_effect(c) --summon with no tribute local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) e1:SetOperation(s.ntop) c:RegisterEffect(e1) --declear local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.dectg) e2:SetOperation(s.decop) c:RegisterEffect(e2) end function s.ntcon(e,c,minc) if c==nil then return true end return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.ntop(e,tp,eg,ep,ev,re,r,rp,c) --change base attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) e1:SetCode(EFFECT_SET_BASE_ATTACK) e1:SetValue(1100) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_LEVEL) e2:SetValue(3) c:RegisterEffect(e2) end function s.dectg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RACE) local rc=Duel.AnnounceRace(tp,1,RACE_ALL) e:SetLabel(rc) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetLabel(rc) Duel.RegisterEffect(e1,tp) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) Duel.RegisterEffect(e2,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.sumlimit(e,c) return c:GetRace()~=e:GetLabel() end function s.decop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local rc=e:GetLabel() c:SetHint(CHINT_RACE,rc) local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SYNCHRO_CHECK) e1:SetValue(s.syncheck) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetLabel(rc) c:RegisterEffect(e1) end end function s.syncheck(e,c) c:AssumeProperty(ASSUME_RACE,e:GetLabel()) return true end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Ritual Summon 1 "Dogmatika" Ritual Monster from your hand or Deck by Tributing "Dogmatika" monsters and/or Ritual, Fusion, or Synchro Monsters from your field whose total Levels exactly equal the Level of the Ritual Monster you Ritual Summon. If this card is in your GY: You can banish this card, then target 2 "Dogmatika" monsters with different Levels in your GY; add 1 of them to your hand, and place the other on the bottom of your Deck. You can only use 1 "Dogmatikaturgy" effect per turn, and only once that turn.
--ドラグマトゥルギー --Dogmatikaturgy --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Ritual.CreateProc({handler=c,lvtype=RITPROC_EQUAL,filter=aux.FilterBoolFunction(Card.IsSetCard,SET_DOGMATIKA),location=LOCATION_HAND|LOCATION_DECK,matfilter=s.mfilter}) e1:SetCountLimit(1,id) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) c:RegisterEffect(e1) --Add 2 "Dogmatika" monsters from your GY to your hand and Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_TODECK) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thdtg) e2:SetOperation(s.thdop) c:RegisterEffect(e2) end s.listed_series={SET_DOGMATIKA} function s.mfilter(c) return c:IsLocation(LOCATION_MZONE) and (c:IsSetCard(SET_DOGMATIKA) or c:IsType(TYPE_RITUAL+TYPE_FUSION+TYPE_SYNCHRO)) end function s.thdfilter(c,e) return c:IsSetCard(SET_DOGMATIKA) and c:HasLevel() and (c:IsAbleToHand() or c:IsAbleToDeck()) and c:IsCanBeEffectTarget(e) end function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetLevel)==#sg and sg:FilterCount(Card.IsAbleToHand,nil)>=1 and sg:FilterCount(Card.IsAbleToDeck,nil)>=1 end function s.thdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local rg=Duel.GetMatchingGroup(s.thdfilter,tp,LOCATION_GRAVE,0,nil,e) if chk==0 then return aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,0) end local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,1,tp,aux.Stringid(id,2)) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) end function s.thdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local hg=g:FilterSelect(tp,Card.IsAbleToHand,1,1,nil) if #hg==0 or Duel.SendtoHand(hg,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,hg) local dg=g-hg if #dg==0 then return end Duel.HintSelection(dg,true) Duel.SendtoDeck(dg,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 DARK Pendulum Monsters Once per turn, before damage calculation, if this card battles an opponent's monster: You can detach 1 material from this card; until the end of this turn, change the ATK of that face-up opponent's monster to 0, and if you do, this card gains ATK equal to the original ATK of that opponent's monster. During the Battle Phase (Quick Effect): You can return this card to the Extra Deck; Special Summon up to 2 "Supreme King Dragon" and/or "Supreme King Gate" Pendulum Monsters from your face-up Extra Deck in Defense Position.
--覇王眷竜ダーク・リベリオン --Supreme King Dragon Dark Rebellion local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,s.matfilter,4,2) --change atk local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_CONFIRM) e1:SetCountLimit(1) e1:SetCondition(s.atkcon) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetOperation(s.atkop) 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_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_BATTLE_START) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_SUPREME_KING_GATE,SET_SUPREME_KING_DRAGON} function s.matfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_PENDULUM,xyz,sumtype,tp) and c:IsAttribute(ATTRIBUTE_DARK,xyz,sumtype,tp) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return c:IsRelateToBattle() and bc and bc:IsFaceup() and bc:IsRelateToBattle() and bc:GetAttack()>0 end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetBattleTarget() if tc and tc:IsFaceup() and tc:IsRelateToBattle() and not tc:IsImmuneToEffect(e) then local atk=tc:GetBaseAttack() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(0) tc:RegisterEffect(e1) if c:IsRelateToEffect(e) and c:IsFaceup() then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(atk) c:RegisterEffect(e2) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToExtraAsCost() end Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_COST) end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsSetCard({SET_SUPREME_KING_GATE,SET_SUPREME_KING_DRAGON}) and c:IsType(TYPE_PENDULUM) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCountFromEx(tp,tp,e:GetHandler())>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=math.min(Duel.GetLocationCountFromEx(tp),2) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end ft=math.min(ft,aux.CheckSummonGate(tp) or ft) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,ft,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Aqua monster + 1 Level 10 WATER monster Must first be either Fusion Summoned, or Special Summoned from your Extra Deck by Tributing 1 Level 10 Aqua monster with 0 ATK. This card can be treated as 1 or 3 Tributes for the Tribute Summon of a monster. Cannot be destroyed by battle. Your opponent's monsters cannot target for attacks, and your opponent cannot target with card effects, any monsters you control, except "Egyptian God Slime".
--神・スライム --Egyptian God Slime --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --fusion summon c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsRace,RACE_AQUA),s.matfilter) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_EXTRA) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --triple tribute local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRIPLE_TRIBUTE) e2:SetValue(1) c:RegisterEffect(e2) --cannot be destroyed by battle local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetRange(LOCATION_MZONE) e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e3:SetValue(1) c:RegisterEffect(e3) --atk limit local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetTargetRange(0,LOCATION_MZONE) e4:SetValue(s.tglimit) c:RegisterEffect(e4) --cannot target local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e5:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e5:SetRange(LOCATION_MZONE) e5:SetTargetRange(LOCATION_MZONE,0) e5:SetTarget(s.tglimit) e5:SetValue(aux.tgoval) c:RegisterEffect(e5) end s.listed_names={id} function s.matfilter(c,fc,sumtype,tp) return c:IsAttribute(ATTRIBUTE_WATER,fc,sumtype,tp) and c:GetLevel()==10 end function s.hspfilter(c,tp,sc) return c:IsRace(RACE_AQUA) and c:GetLevel()==10 and c:GetAttack()==0 and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0 end function s.hspcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.CheckReleaseGroup(tp,s.hspfilter,1,false,1,true,c,tp,nil,nil,nil,tp,c) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) local g=Duel.SelectReleaseGroup(tp,s.hspfilter,1,1,false,true,true,c,tp,nil,false,nil,tp,c) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.hspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST|REASON_MATERIAL) g:DeleteGroup() end function s.tglimit(e,c) return c:GetCode()~=id end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 2 face-up Attack Position monsters on the field. When any of the selected monsters are removed from the field, destroy this card. When this card is destroyed, destroy the selected monster(s).
--グレイモヤ不発弾 --Widespread Dud local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetLabelObject(e1) e2:SetCondition(aux.PersistentTgCon) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --Destroy1 local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCondition(s.descon1) e3:SetOperation(s.desop1) c:RegisterEffect(e3) --Destroy2 local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_SZONE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCondition(s.descon2) e4:SetOperation(s.desop2) c:RegisterEffect(e4) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsPosition(POS_FACEUP_ATTACK) end if chk==0 then return Duel.IsExistingTarget(Card.IsPosition,tp,LOCATION_MZONE,LOCATION_MZONE,2,nil,POS_FACEUP_ATTACK) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUPATTACK) Duel.SelectTarget(tp,Card.IsPosition,tp,LOCATION_MZONE,LOCATION_MZONE,2,2,nil,POS_FACEUP_ATTACK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(re) then return end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS):Filter(Card.IsRelateToEffect,nil,re) local tc=g:GetFirst() for tc in aux.Next(g) do c:SetCardTarget(tc) end end function s.descon1(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) end function s.desop1(e,tp,eg,ep,ev,re,r,rp) local g=e:GetHandler():GetCardTarget():Filter(Card.IsLocation,nil,LOCATION_MZONE) Duel.Destroy(g,REASON_EFFECT) end function s.descon2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:GetCardTargetCount()==0 then return false end local g=c:GetCardTarget() local tc1=g:GetFirst() local tc2=g:GetNext() return eg:IsContains(tc1) or (tc2 and eg:IsContains(tc2)) end function s.desop2(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "World Legacy" monster from your hand or Deck, but destroy it during the End Phase of the next turn. You can only activate 1 "World Reassembly" per turn.
--創星改帰 --World Reassembly --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "World Legacy" monster from your hand or Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_WORLD_LEGACY} function s.spfilter(c,e,tp) return c:IsSetCard(SET_WORLD_LEGACY) 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.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,2) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetReset(RESET_PHASE|PHASE_END,2) e1:SetCountLimit(1) e1:SetLabel(Duel.GetTurnCount()) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetLabelObject(tc) Duel.RegisterEffect(e1,tp) end Duel.SpecialSummonComplete() end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() return Duel.GetTurnCount()~=e:GetLabel() and tc:GetFlagEffect(id)~=0 end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.Destroy(tc,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is not treated as a "Volcanic" card.) During your End Phase, if you control "Jurassic World": Destroy all cards on the field.
--大噴火 --Volcanic Eruption local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_END_PHASE,0) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={10080320} function s.filter(c) return c:IsFaceup() and c:IsCode(10080320) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_END) and Duel.IsTurnPlayer(tp) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.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:
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 excavate cards from the top of your Deck until you excavate a "Vaalmonica" card, then add that card to your hand, also shuffle the rest into the Deck. ● Take 500 damage, then you can send 1 "Vaalmonica" card from your Deck to the GY, except "Vaalmonica Versare". You can only activate 1 "Vaalmonica Versare" per turn.
--ヴァルモニカ・ヴェルサーレ --Vaalmonica Versare --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_RECOVER+CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DAMAGE+CATEGORY_TOGRAVE) 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_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgfilter(c) return c:IsSetCard(SET_VAALMONICA) and not c:IsCode(id) and c:IsAbleToGrave() 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 excavate cards from the top of your Deck local g=Duel.GetMatchingGroup(Card.IsSetCard,tp,LOCATION_DECK,0,nil,SET_VAALMONICA) if Duel.Recover(tp,500,REASON_EFFECT)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,5)) then local spcard,seq=g:GetMaxGroup(Card.GetSequence) spcard=spcard:GetFirst() if not spcard then return end Duel.BreakEffect() Duel.ConfirmDecktop(tp,Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)-seq) if spcard:IsAbleToHand() then Duel.SendtoHand(spcard,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,spcard) else Duel.SendtoGrave(spcard,REASON_RULE) end end elseif op==2 then --Take 500 damage and send 1 "Vaalmonica" card from your Deck to the GY local g=Duel.GetMatchingGroup(s.tgfilter,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_TOGRAVE) local sg=g:Select(tp,1,1,nil) Duel.BreakEffect() Duel.SendtoGrave(sg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase, if you control no monsters, or control an "Adventurer Token" (Quick Effect): You can Special Summon this card from your hand. If you control an "Adventurer Token" (Quick Effect): You can target up to 2 cards your opponent controls; give control of this card to your opponent, and if you do, return that card(s) to the hand. You can only use each effect of "Illegal Knight" once per turn.
--外法の騎士 --Illegal Knight --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Change control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_CONTROL+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.bravecon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={TOKEN_ADVENTURER} function s.bravecon(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,TOKEN_ADVENTURER),tp,LOCATION_ONFIELD,0,1,nil) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or s.bravecon(e,tp)) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end local c=e:GetHandler() if chk==0 then return c:IsAbleToChangeControler() and Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp,LOCATION_REASON_CONTROL)>0 and Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or not Duel.GetControl(c,1-tp) then return end local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The equipped monster gains 0 ATK. You can target 1 other "Bamboo Sword" card you control; return it to the hand, and if you do, the equipped monster can attack your opponent directly this turn. You can only use this effect of "Cursed Bamboo Sword" once per turn. If this card is sent to the Graveyard: You can add 1 "Bamboo Sword" card from your Deck to your hand, except "Cursed Bamboo Sword".
--妖刀竹光 --Cursed Bamboo Sword local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c) --Gains 0 ATK local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_EQUIP) e0:SetCode(EFFECT_UPDATE_ATTACK) e0:SetValue(0) c:RegisterEffect(e0) --Return to the hand and allow direct attack 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_SZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.dttg) e1:SetOperation(s.dtop) c:RegisterEffect(e1) --Search 1 "Bamboo Sword" card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_BAMBOO_SWORD} s.listed_names={id} function s.tgfilter(c) return c:IsFaceup() and c:IsSetCard(SET_BAMBOO_SWORD) and c:IsAbleToHand() end function s.dttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc~=c and s.tgfilter(chkc) end local ec=c:GetEquipTarget() if chk==0 then return ec and not ec:IsHasEffect(EFFECT_DIRECT_ATTACK) and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.dtop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then local c=e:GetHandler() local ec=c:GetEquipTarget() if not ec then return end --Can attack directly local e1=Effect.CreateEffect(c) e1:SetDescription(3205) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) ec:RegisterEffect(e1) end end function s.thfilter(c) return c:IsSetCard(SET_BAMBOO_SWORD) and not 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:
Reveal 1 "Azamina" Fusion Monster in your Extra Deck, and for every 4 Levels it has (round down), shuffle 1 "Sinful Spoils" card from your GY and/or banishment into the Deck, then Special Summon the revealed monster. (This is treated as a Fusion Summon.) You can banish this card from your GY, then target 1 "Sinful Spoils" Spell/Trap in your GY; Set it, but it cannot be activated this turn. You can only use 1 "Azamina Determination" effect per turn, and only once that turn.
--アザミナ・ハマルティア --Azamina Determination --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Send "Sinful Spoils" cards to the GY and Special Summon 1 "Azamina" Fusion Monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Set 1 "Sinful Spoils" Spell/Trap from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_series={SET_AZAMINA,SET_SINFUL_SPOILS} function s.sinfilter(c) return c:IsSetCard(SET_SINFUL_SPOILS) and c:IsFaceup() and c:IsAbleToDeck() end function s.spfilter(c,e,tp,lv) return c:IsSetCard(SET_AZAMINA) and c:IsType(TYPE_FUSION) and c:IsLevelAbove(4) and c:IsLevelBelow(lv) and not c:IsPublic() and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:CheckFusionMaterial() and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_FUSION,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local ct=Duel.GetMatchingGroupCount(s.sinfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,nil) return ct>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,ct*4+3) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.sinfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,nil) if #sg<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,#sg*4+3):GetFirst() if not tc then return end Duel.ConfirmCards(1-tp,tc) local ct=tc:GetLevel()//4 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local ssg=sg:Select(tp,ct,ct,nil) if #ssg==0 then return end Duel.HintSelection(ssg) if Duel.SendtoDeck(ssg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and ssg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK|LOCATION_EXTRA) then tc:SetMaterial(nil) Duel.BreakEffect() if Duel.SpecialSummon(tc,SUMMON_TYPE_FUSION,tp,tp,false,false,POS_FACEUP)==0 then return end tc:CompleteProcedure() end end function s.setfilter(c) return c:IsSetCard(SET_SINFUL_SPOILS) and c:IsSpellTrap() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.setfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.setfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsSSetable() and Duel.SSet(tp,tc)>0 then --Cannot be activated this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESET_EVENT|RESETS_CANNOT_ACT|RESET_PHASE|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 "Six Samurai" monsters you control gain 600 ATK/DEF during the Battle Phase only. You can only use each of the following effects of "Legendary Lord Six Samurai - Kizan" once per turn. During your opponent's Main Phase (Quick Effect): You can banish 1 "Six Strike" card from your GY, then target 1 card on the field; destroy it. If you control 2 or more "Six Samurai" monsters: You can Special Summon this card from the GY.
--真魔六武衆-キザン --Legendary Lord Six Samurai - Kizan --Scripted by Cybercatman 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) --"Six Samurai" monsters you control gain 600 ATK/DEF during the Battle Phase only local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetCondition(function() return Duel.IsBattlePhase() end) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_SIX_SAMURAI)) e1:SetValue(600) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --Destroy 1 card on the field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() end) e3:SetCost(s.descost) e3:SetTarget(s.destg) e3:SetOperation(s.desop) c:RegisterEffect(e3) --Special Summon this card from your GY local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,{id,1}) e4:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_SIX_SAMURAI),tp,LOCATION_MZONE,0,2,nil) end) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_SIX_SAMURAI,SET_SIX_STRIKE} function s.costfilter(c) return c:IsSetCard(SET_SIX_STRIKE) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.descost(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) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Gains 100 ATK for each of your opponent's banished cards. During the Standby Phase of the next turn after this card was banished: Special Summon this banished card. You can only use this effect of "Angel of Zera" once per turn.
--ゼラの天使 --Angel of Zera local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() -- local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.atkval) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_REMOVE) e2:SetOperation(s.spreg) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_REMOVED) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetCountLimit(1,id) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) e3:SetLabelObject(e2) c:RegisterEffect(e3) end function s.atkval(e,c) return Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_REMOVED)*100 end function s.spreg(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(Duel.GetTurnCount()) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and c:GetFlagEffect(id)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) c:ResetFlagEffect(id) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase 2, if no monsters battled each other this turn: You can discard 1 card; Set 1 "Battlefield Tragedy" directly from your Deck to your Spell & Trap Zone. You can only use this effect of "Battlefield Tragedy" once per turn. Once per turn, during the End Phase, if any monsters battled each other this turn: The turn player sends 5 cards from the top of their Deck to the GY.
--戦場の惨劇 --Battlefield Tragedy --scripted by pyrQ 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) --Set 1 "Battlefield Tragedy" from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.setcon) e2:SetCost(s.setcost) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) --Turn player sends the top 5 cards of their Deck to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DECKDES) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(s.tgcon) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) --Condition check for whether 2 monsters battled each other this turn aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_BATTLED) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_names={id} function s.checkop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsDamageCalculated() then return end if Duel.GetAttackTarget() then Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_MAIN2) and Duel.GetFlagEffect(0,id)==0 end function s.setcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.setfilter(c) return c:IsCode(id) and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #sg>0 then Duel.SSet(tp,sg) end end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(0,id)>0 end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,Duel.GetTurnPlayer(),5) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.DiscardDeck(Duel.GetTurnPlayer(),5,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 1 monsters Cannot be destroyed by battle. At the end of the Damage Step, if this card battled an opponent's monster: You can detach 1 material from this card; double the ATK of all "Numeron" monsters you currently control, until the end of this turn.
--No.2 ゲート・オブ・ヌメロン-ドゥヴェー --Number 2: Numeron Gate Dve local s,id=GetID() function s.initial_effect(c) --Xyz Summon Xyz.AddProcedure(c,nil,1,3) c:EnableReviveLimit() --Cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --Double ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DAMAGE_STEP_END) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.condition) e2:SetCost(Cost.DetachFromSelf(1,1,nil)) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_NUMERON} s.xyz_number=2 function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsStatus(STATUS_OPPO_BATTLE) and c:IsRelateToBattle() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_NUMERON),tp,LOCATION_MZONE,0,1,nil) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_NUMERON),tp,LOCATION_MZONE,0,nil) for tc in g:Iter() do --Double ATK until the end of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetAttack()*2) e1:SetReset(RESETS_STANDARD_PHASE_END,1) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 Warrior monster you control; it gains 1000 ATK. Monsters destroyed by battle with it are returned to the hand instead of going to the GY. When that monster leaves the field, destroy this card.
--バーバリアン・レイジ --Battleguard Rage local s,id=GetID() function s.initial_effect(c) aux.AddPersistentProcedure(c,0,aux.FaceupFilter(Card.IsRace,RACE_WARRIOR),CATEGORY_ATKCHANGE,EFFECT_FLAG_DAMAGE_STEP,TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP,aux.StatChangeDamageStepCondition) --eff local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.PersistentTargetFilter) e1:SetValue(1000) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_BATTLE_DESTROY_REDIRECT) e2:SetValue(LOCATION_HAND) c:RegisterEffect(e2) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCondition(s.descon) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) 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:
Activate this card by targeting any number of Level 4 Machine-Type monsters you control; Special Summon this card as an Effect Monster (Machine-Type/EARTH/Level 4/ATK 0/DEF 0), then equip those face-up monsters to this card. (This card is also still a Trap Card.) If Summoned this way, this card gains ATK equal to the combined ATK of the monsters equipped to it by this effect, monsters your opponent controls cannot target monsters you control for attacks, except this one, also your opponent cannot target monsters you control with card effects, except this one.
--機動要塞 メタル・ホールド --Metalhold the Moving Blockade local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --atk limit local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(0,LOCATION_MZONE) e2:SetCondition(s.con) e2:SetValue(s.atlimit) c:RegisterEffect(e2) --cannot be target local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetCondition(s.con) e3:SetTarget(s.tgtg) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) end function s.con(e,tp,eg,ep,ev,re,r,rp,chk) return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL+1) end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_MACHINE) and c:GetLevel()==4 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,0,4,RACE_MACHINE,ATTRIBUTE_EARTH) end local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,ft,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,#g,0,0) end function s.tgfilter(c,e) return c:IsFaceup() and c:IsRelateToEffect(e) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,0,4,RACE_MACHINE,ATTRIBUTE_EARTH) then return end c:AddMonsterAttribute(TYPE_EFFECT+TYPE_TRAP) Duel.SpecialSummonStep(c,1,tp,tp,true,false,POS_FACEUP) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.atkval) c:RegisterEffect(e1) c:AddMonsterAttributeComplete() Duel.SpecialSummonComplete() local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.tgfilter,nil,e) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e,nil,RESET_EVENT|RESETS_STANDARD_DISABLE) if #g<=0 or ft<=0 then return end local tg=nil if ft<#g then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) tg=g:FilterSelect(tp,s.filter,ft,ft,nil) else tg=g:Clone() end if #tg>0 then Duel.BreakEffect() local tc=tg:GetFirst() for tc in aux.Next(tg) do s.equipop(c,e,tp,tc,true) end Duel.EquipComplete() end end function s.eqval(ec,c,tp) return ec:IsControler(tp) and ec:IsRace(RACE_MACHINE) and ec:GetLevel()==4 end function s.equipop(c,e,tp,tc,chk) local eff=false or chk Duel.Equip(tp,tc,c,false,eff) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(Card.EquipByEffectLimit) e1:SetLabelObject(e:GetLabelObject()) tc:RegisterEffect(e1) tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0) end function s.atkval(e,c) local atk=0 local g=c:GetEquipGroup() local tc=g:GetFirst() for tc in aux.Next(g) do if tc:GetFlagEffect(id)~=0 and tc:GetAttack()>=0 then atk=atk+tc:GetAttack() end end return atk end function s.atlimit(e,c) return c~=e:GetHandler() end function s.tgtg(e,c) return c~=e:GetHandler() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card while "Neo Space" is on the field to Special Summon 1 "Neo-Spacian Grand Mole" from your hand or Deck.
--C・モーグ --Chrysalis Mole local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.spcon) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={80344569,42015635} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsEnvironment(42015635) end function s.spfilter(c,e,tp) return c:IsCode(80344569) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsEnvironment(42015635) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Summoned: Change it to Defense Position. When a face-up monster you control is targeted for an attack: You can change the target to this card. When this card is targeted for an attack: You can choose a number from 1 to 3, then send that many cards from the top of your Deck to the Graveyard; this card gains 500 DEF for each card sent, until the End Phase.
--カードブロッカー --Card Blocker local s,id=GetID() function s.initial_effect(c) --to defense local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.potg) e1:SetOperation(s.poop) 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) --change battle target local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BE_BATTLE_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.cbcon) e4:SetTarget(s.cbtg) e4:SetOperation(s.cbop) c:RegisterEffect(e4) --def local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_DEFCHANGE) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_BE_BATTLE_TARGET) e5:SetCost(s.defcost) e5:SetOperation(s.defop) c:RegisterEffect(e5) end function s.potg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return e:GetHandler():IsAttackPos() end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function s.poop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsAttackPos() and c:IsRelateToEffect(e) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function s.cbcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bt=eg:GetFirst() return r~=REASON_REPLACE and c~=bt and bt:IsFaceup() and bt:GetControler()==c:GetControler() end function s.cbtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetAttacker():GetAttackableTarget():IsContains(e:GetHandler()) end end function s.cbop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and not Duel.GetAttacker():IsImmuneToEffect(e) then Duel.ChangeAttackTarget(c) end end function s.defcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeckAsCost(tp,1) end local ct={} for i=3,1,-1 do if Duel.IsPlayerCanDiscardDeckAsCost(tp,i) then table.insert(ct,i) end end if #ct==1 then Duel.DiscardDeck(tp,ct[1],REASON_COST) e:SetLabel(1) else Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local ac=Duel.AnnounceNumber(tp,table.unpack(ct)) Duel.DiscardDeck(tp,ac,REASON_COST) e:SetLabel(ac) end end function s.defop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local ct=e:GetLabel() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) e1:SetValue(ct*500) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If only your opponent controls a monster, you can Special Summon this card (from your hand). When this card on the field is destroyed and sent to the GY: You can add 1 "Fire Ant Ascator" or "Supay" from your Deck to your hand.
--太陽の神官 --Oracle of the Sun 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) --search 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_DAMAGE_STEP) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.shcon) e2:SetTarget(s.shtg) e2:SetOperation(s.shop) c:RegisterEffect(e2) end function s.spcon(e,c) if c==nil then return true end return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0,nil)==0 and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE,nil)>0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end function s.shcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and e:GetHandler():IsReason(REASON_DESTROY) end function s.filter(c) return c:IsCode(78275321,78552773) and c:IsAbleToHand() end function s.shtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.shop(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:
1 Tuner + 3 non-Tuner monsters Your opponent cannot target "Flower Cardian" monsters you control with card effects, also those monsters cannot be destroyed by card effects. During your opponent's Draw Phase, if they draw a card(s) for their normal draw: Inflict 1500 damage to your opponent. Once per turn, during your opponent's End Phase: Activate 1 of these effects; ● Skip the Draw Phase of your next turn. ● This card has its other effects negated until your opponent's next Standby Phase.
--花札衛-雨四光- --Flower Cardian Lightshower local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),3,3) --indes local e2=Effect.CreateEffect(c) e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_FLOWER_CARDIAN)) e2:SetValue(1) c:RegisterEffect(e2) --cannot be target local e3=e2:Clone() e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) --damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DRAW) e4:SetRange(LOCATION_MZONE) e4:SetCondition(s.damcon) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) --ep effects local e5=Effect.CreateEffect(c) e5:SetCategory(CATEGORY_DISABLE) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetCode(EVENT_PHASE+PHASE_END) e5:SetRange(LOCATION_MZONE) e5:SetCountLimit(1) e5:SetCondition(s.epcon) e5:SetTarget(s.eptg) e5:SetOperation(s.epop) c:RegisterEffect(e5) end s.listed_series={SET_FLOWER_CARDIAN} function s.damcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and r==REASON_RULE end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(1500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1500) 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.epcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.eptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() local op=0 Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EFFECT) if c:IsNegatableMonster() then op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2)) else op=Duel.SelectOption(tp,aux.Stringid(id,1)) end if op==0 then e:SetCategory(0) else e:SetCategory(CATEGORY_DISABLE) Duel.SetOperationInfo(0,CATEGORY_DISABLE,c,1,0,0) end e:SetLabel(op) end function s.epop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if e:GetLabel()==0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_SKIP_DP) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN) Duel.RegisterEffect(e1,tp) elseif c:IsFaceup() and c:IsRelateToEffect(e) then Duel.NegateRelatedChain(c,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(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_OPPO_TURN) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) c:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned, you can select and take control of 1 face-up monster with 0 ATK your opponent controls.
--レプティレス・バイパー --Reptilianne Viper local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_CONTROL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetTarget(s.ctltg) e1:SetOperation(s.ctlop) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsControlerCanBeChanged() and c:GetAttack()==0 end function s.ctltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.ctlop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:GetAttack()==0 then Duel.GetControl(tc,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Insect, Plant, and/or Reptile monsters If a monster(s) is Special Summoned from your opponent's Deck and/or Extra Deck (except during the Damage Step): You can destroy 2 monsters on the field. If this card is in your GY: You can target 1 Insect, Plant, or Reptile monster you control; place it on the bottom of the Deck, and if you do, Special Summon this card, also you cannot Special Summon for the rest of this turn, except Insect, Plant, or Reptile monsters. You can only use each effect of "Ragnaraika Stag Sovereign" once per turn.
--蕾禍ノ大王鬼牙 --Ragnaraika Stag Sovereign --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_INSECT|RACE_PLANT|RACE_REPTILE),2) --Destroy 2 monsters on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Place 1 Insect, Plant, or Reptile monster you control on the bottom of the Deck and Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.selfsptg) e2:SetOperation(s.selfspop) c:RegisterEffect(e2) end function s.desconfilter(c,tp) return c:IsSummonLocation(LOCATION_DECK|LOCATION_EXTRA) and c:IsPreviousControler(1-tp) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.desconfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return #g>=2 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g>=2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local dg=g:Select(tp,2,2,nil) Duel.HintSelection(dg,true) Duel.Destroy(dg,REASON_EFFECT) end end function s.tdfilter(c,tp) return c:IsRace(RACE_INSECT|RACE_PLANT|RACE_REPTILE) and c:IsFaceup() and c:IsAbleToDeck() and Duel.GetMZoneCount(tp,c)>0 end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tdfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) 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() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end --Cannot Special Summon monsters, except Insect, Plant, and Reptile 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 not c:IsRace(RACE_INSECT|RACE_PLANT|RACE_REPTILE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Negate the activation of a Counter Trap Card, and destroy it.
--カウンター・カウンター --Counter Counter 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.condition(e,tp,eg,ep,ev,re,r,rp) return re:GetHandler():IsType(TYPE_COUNTER) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can only be activated at the start of Main Phase 1, and only if you control no face-up Synchro Monsters. Neither player can Special Summon a Synchro Monster until your opponent's next End Phase.
--完全防音壁 --Soundproofed local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_MAIN1) and not Duel.CheckPhaseActivity() and not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetDescription(aux.Stringid(id,1)) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,1) e1:SetTarget(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp) return c:IsType(TYPE_SYNCHRO) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 "Wind-Up" monster in your Graveyard; change this face-up Attack Position card you control to face-up Defense Position, and add that target to your hand. This effect can only be used once while this card is face-up on the field.
--ゼンマイバット --Wind-Up Bat local s,id=GetID() function s.initial_effect(c) --salvage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_NO_TURN_RESET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_series={SET_WIND_UP} function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPosition(POS_FACEUP_ATTACK) end function s.filter(c) return c:IsSetCard(SET_WIND_UP) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.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 c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:IsPosition(POS_FACEUP_ATTACK) and c:IsControler(tp) and tc:IsRelateToEffect(e) then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) 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:
If there are no monsters on the field, you can Special Summon this card (from your hand) as a Level 3 monster. If your opponent controls a monster and you control no cards, you can Special Summon this card (from your hand) as a Level 4 monster. If this face-up card would leave the field, banish it instead.
--こけコッコ --Cockadoodledoo local s,id=GetID() function s.initial_effect(c) --If there are no monsters on the field, you can Special Summon this card (from your hand) as a Level 3 monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.lv3spcon) e1:SetOperation(s.spop(3)) e1:SetLabelObject({function(c) c:AssumeProperty(ASSUME_LEVEL,3) end}) c:RegisterEffect(e1) --If your opponent controls a monster and you control no cards, you can Special Summon this card (from your hand) as a Level 4 monster local e2=e1:Clone() e2:SetDescription(aux.Stringid(id,1)) e2:SetCondition(s.lv4spcon) e2:SetOperation(s.spop(4)) e2:SetLabelObject({function(c) c:AssumeProperty(ASSUME_LEVEL,4) end}) c:RegisterEffect(e2) --If this face-up card would leave the field, banish it instead local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e3:SetCondition(function(e) return e:GetHandler():IsFaceup() end) e3:SetValue(LOCATION_REMOVED) c:RegisterEffect(e3) end function s.lv3spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(0,LOCATION_MZONE,LOCATION_MZONE)==0 end function s.lv4spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 end function s.spop(lv) return function(e,tp,eg,ep,ev,re,r,rp,c) c:AssumeProperty(ASSUME_LEVEL,lv) --Special Summon this card (from your hand) as a Level 3 or 4 monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_DISABLE&~RESET_TOFIELD)) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no cards, except "Numeron Wall(s)" (Quick Effect): You can send this card from your hand or field to the GY; activate 1 "Numeron Network" directly from your hand or Deck. You can only use this effect of "Numeron Wall" once per turn. When you take battle damage: You can Special Summon this card from your hand, and if you do, end the Battle Phase after the Damage Step.
--ヌメロン・ウォール --Numeron Wall --scripted by King Yamato and Naim local s,id=GetID() function s.initial_effect(c) --Activate "Numeron Network" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Special Summon and end Battle Phase 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_BATTLE_DAMAGE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_HAND) e2:SetCondition(s.spcond) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id,CARD_NUMERON_NETWORK} function s.filter(c) return not (c:IsFaceup() and c:IsCode(id)) end function s.field(c,tp) return c:IsCode(CARD_NUMERON_NETWORK) and c:GetActivateEffect():IsActivatable(tp,true,true) and not c:IsForbidden() end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 or not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.field,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,tp) end if not Duel.CheckPhaseActivity() then Duel.RegisterFlagEffect(tp,CARD_MAGICAL_MIDBREAKER,RESET_CHAIN,0,1) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.field,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,tp):GetFirst() return Duel.ActivateFieldSpell(tc,e,tp,eg,ep,ev,re,r,rp) end function s.spcond(e,tp,eg,ep,ev,re,r,rp) return ep==tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.SkipPhase(Duel.GetTurnPlayer(),PHASE_BATTLE,RESET_PHASE|PHASE_BATTLE_STEP,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates "Raigeki": Negate its effect, and if you do, destroy all monsters your opponent controls.
--避雷針 --Anti Raigeki local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE) 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 s.listed_names={12580477} function s.condition(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsCode(12580477) and Duel.IsChainDisablable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateEffect(ev) then local g=Duel.GetFieldGroup(tp,0,LOCATION_MZONE) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no other Insect-Type monsters, this card's ATK and DEF become 1000.
--アーマード・フライ --Arsenal Bug local s,id=GetID() function s.initial_effect(c) --atk def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(1000) e1:SetCondition(s.con) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE) c:RegisterEffect(e2) end function s.con(e) local c=e:GetHandler() return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_INSECT),c:GetControler(),LOCATION_MZONE,0,1,c) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can reveal 1 other "Gunkan" card in your hand; Special Summon this card from your hand, then apply the following effect based on the revealed card. ● "Gunkan Suship Shari": You can Special Summon the revealed monster. ● Other: Place the revealed card on the bottom of the Deck. You can target 1 "Gunkan" monster you control: Change its Level to 4 or 5, then you can add 1 "Gunkan Suship Shari" from your Deck to your hand. You can only use each effect of "Gunkan Suship Uni" once per turn.
--うにの軍貫 --Gunkan Suship Uni --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Change targeted "Gunkan" monster's level to 4 or 5 local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE+CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end --Lists "Gunkan" archetype s.listed_series={SET_GUNKAN} --Specifically lists "Gunkan Suship Shari" s.listed_names={CARD_SUSHIP_SHARI} --Check for a "Gunkan" card to reveal function s.cfilter(c) return c:IsSetCard(SET_GUNKAN) and not c:IsPublic() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,e:GetHandler()) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) g:KeepAlive() e:SetLabelObject(g) Duel.SetTargetCard(g) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) local rc=e:GetLabelObject():GetFirst() if rc:IsCode(CARD_SUSHIP_SHARI) then Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,rc,1,tp,LOCATION_HAND) else Duel.SetOperationInfo(0,CATEGORY_TODECK,rc,1,0,0) end end --Special summon itself from hand function s.spop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and g:GetFirst():IsRelateToEffect(e) then if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and g:GetFirst():IsCode(CARD_SUSHIP_SHARI) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) elseif not g:GetFirst():IsCode(CARD_SUSHIP_SHARI) then Duel.BreakEffect() Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end g:DeleteGroup() end --Check for a "Gunkan" monster with a level function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_GUNKAN) and c:HasLevel() end --Activation legality function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end --Check for "Gunkan Suship Shari" to add function s.thfilter(c) return c:IsCode(CARD_SUSHIP_SHARI) and c:IsAbleToHand() end --Change targeted "Gunkan" monster's level to 4 or 5 function s.lvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local lv=Duel.AnnounceLevel(tp,4,5,tc:GetLevel()) --Change Level local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(lv) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() 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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 card in your Pendulum Zone; Special Summon it. You can target 1 Pendulum Monster in your Monster Zone; place that Pendulum Monster in your Pendulum Zone. You can only use 1 "Pendulum Switch" effect per turn, and only once that turn.
--ペンデュラム・スイッチ --Pendulum Switch 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) --Special Summon 1 card from your Pendulum Zone local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Place 1 Pendulum Monster from your Monster Zone in your Pendulum Zone local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetTarget(s.pentg) e2:SetOperation(s.penop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_PZONE) 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_PZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_PZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsType(TYPE_PENDULUM) and chkc:IsFaceup() end if chk==0 then return Duel.CheckPendulumZones(tp) and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),tp,LOCATION_MZONE,0,1,1,nil) end function s.penop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.MoveToField(tc,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] During the Standby Phase: You can target up to 2 cards in the Pendulum Zones; their Pendulum Scales become 0 until the end of this turn. You can only use this effect of "D/D Scale Surveyor" once per turn. ---------------------------------------- [ Monster Effect ] If you control a "D/D" Pendulum Monster Card: You can Special Summon this card from your hand. If this card is Normal or Special Summoned: You can make this card Level 4. If this card is sent to the GY, or added to the Extra Deck face-up: You can target 1 "D/D" Pendulum Monster Card you control; return it to the hand. You can only use each effect of "D/D Scale Surveyor" once per turn.
--DDスケール・サーベイヤー --D/D Scale Surveyor --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Pendulum Summon procedure Pendulum.AddProcedure(c) --Change up to 2 Pendulum Scales to 0 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.scaletg) e1:SetOperation(s.scaleop) c:RegisterEffect(e1) --Special Summon this card from your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Make this card's Level become 4 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_LVCHANGE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetCountLimit(1,{id,2}) e3:SetTarget(s.lvtg) e3:SetOperation(s.lvop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) --Return 1 "D/D" Pendulum Monster Card you control to the hand local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,3)) e5:SetCategory(CATEGORY_TOHAND) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e5:SetCode(EVENT_TO_GRAVE) e5:SetCountLimit(1,{id,3}) e5:SetTarget(s.thtg) e5:SetOperation(s.thop) c:RegisterEffect(e5) local e6=e5:Clone() e6:SetCode(EVENT_TO_DECK) e6:SetCondition(s.thcon) c:RegisterEffect(e6) end s.listed_series={SET_DD} function s.scaletg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_PZONE) and not chkc:IsScale(0) end if chk==0 then return Duel.IsExistingTarget(aux.NOT(Card.IsScale),tp,LOCATION_PZONE,LOCATION_PZONE,1,nil,0) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,aux.NOT(Card.IsScale),tp,LOCATION_PZONE,LOCATION_PZONE,1,2,nil,0) end function s.scaleop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 then return end local c=e:GetHandler() for tc in tg:Iter() do --Their Scales become 0 until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_LSCALE) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_RSCALE) e2:SetValue(0) tc:RegisterEffect(e2) end end function s.ddpendmonfilter(c) return c:IsSetCard(SET_DD) and c:IsOriginalType(TYPE_PENDULUM) and c:IsMonsterCard() and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.ddpendmonfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsLevel(4) end Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,c,1,tp,4) end function s.lvop(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --This card's Level becomes 4 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(4) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.thfilter(c) return s.ddpendmonfilter(c) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,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.thcon(e) local c=e:GetHandler() return c:IsLocation(LOCATION_EXTRA) and c:IsFaceup() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot attack the turn it is Summoned. If "Toon World" on the field is destroyed, destroy this card. While you control "Toon World" and your opponent controls no Toon monsters, this card can attack your opponent directly. If this card inflicts battle damage to your opponent: You can discard 1 random card from your opponent's hand. * The above text is unofficial and describes the card's functionality in the OCG.
--トゥーン・ヂェミナイ・エルフ --Toon Gemini Elf local s,id=GetID() function s.initial_effect(c) --cannot attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.atklimit) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetRange(LOCATION_MZONE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetCondition(s.sdescon) e4:SetOperation(s.sdesop) c:RegisterEffect(e4) --direct attack local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetCode(EFFECT_DIRECT_ATTACK) e5:SetCondition(s.dircon) c:RegisterEffect(e5) --handes local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,0)) e6:SetCategory(CATEGORY_HANDES) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_BATTLE_DAMAGE) e6:SetCondition(s.condition) e6:SetTarget(s.target) e6:SetOperation(s.operation) c:RegisterEffect(e6) end s.listed_names={15259703} function s.atklimit(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e:GetHandler():RegisterEffect(e1) end function s.sfilter(c) return c:IsReason(REASON_DESTROY) and c:IsPreviousPosition(POS_FACEUP) and c:GetPreviousCodeOnField()==15259703 and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.sdescon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.sfilter,1,nil) end function s.sdesop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end function s.dirfilter1(c) return c:IsFaceup() and c:IsCode(15259703) end function s.dirfilter2(c) return c:IsFaceup() and c:IsType(TYPE_TOON) end function s.dircon(e) return Duel.IsExistingMatchingCard(s.dirfilter1,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) and not Duel.IsExistingMatchingCard(s.dirfilter2,e:GetHandlerPlayer(),0,LOCATION_MZONE,1,nil) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(ep,LOCATION_HAND,0)>0 end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(ep,LOCATION_HAND,0) if #g==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoGrave(sg,REASON_EFFECT|REASON_DISCARD) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can be treated as 2 Tributes for the Tribute Summon of a monster. You can only use each of the following effects of "World Legacy - "World Ark"" once per turn. ● If a Link Monster(s) you control is destroyed by an opponent's card effect and sent to your GY (except during the Damage Step): You can send this card from your hand to the GY, then target 1 of those Link Monsters; Special Summon it. ● If your opponent Special Summons a monster(s) from the Extra Deck, while this Normal Summoned/Set card is on the field (except during the Damage Step): You can send 1 monster from your Deck to the GY.
--星遺物-『星櫃』 --World Legacy - "World Ark" --scripted by Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon link monster, optional trigger effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DESTROYED) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfToGrave) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Treated as double tributes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DOUBLE_TRIBUTE) e2:SetValue(1) c:RegisterEffect(e2) --Send 1 monster from your deck to GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCondition(s.dkcon) e3:SetTarget(s.dktg) e3:SetOperation(s.dkop) c:RegisterEffect(e3) end --Check for link monster that was destroyed due to opponent's card effect function s.cfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:GetPreviousTypeOnField() & TYPE_LINK ~= 0 and c:IsReason(REASON_DESTROY) and ((c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp)) end --Check if ever happened function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end --Cost of sending from hand to GY --Check for link monsters that can be special summoned function s.spfilter(c,e,tp) return c:IsLinkMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and c:IsCanBeEffectTarget(e) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return eg:IsContains(chkc) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and eg:IsExists(s.spfilter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=eg:FilterSelect(tp,s.spfilter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end --Performing the effect of special summoning function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP) end end --If opponent special summons from extra deck function s.edfilter(c,tp) return c:IsSummonPlayer(tp) and c:IsPreviousLocation(LOCATION_EXTRA) end --If this ever happened and monster was normal summoned function s.dkcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.edfilter,1,nil,1-tp) and e:GetHandler():IsNormalSummoned() and rp~=tp end --Check for a monster function s.dkfilter(c) return c:IsMonster() and c:IsAbleToGrave() end --Activation legality function s.dktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.dkfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end --Performing the effect of sending a monster from deck to GY function s.dkop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.dkfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: You can target 1 "Constellar" monster in your Graveyard; add that target to your hand.
--セイクリッド・アンタレス --Constellar Antares local s,id=GetID() function s.initial_effect(c) --Add 1 "Constellar" monster from your GY to your hand local e1a=Effect.CreateEffect(c) e1a:SetDescription(aux.Stringid(id,0)) e1a:SetCategory(CATEGORY_TOHAND) e1a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1a:SetProperty(EFFECT_FLAG_CARD_TARGET) e1a:SetCode(EVENT_SUMMON_SUCCESS) e1a:SetTarget(s.thtg) e1a:SetOperation(s.thop) c:RegisterEffect(e1a) local e1b=e1a:Clone() e1b:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e1b) end s.listed_series={SET_CONSTELLAR} function s.thfilter(c) return c:IsSetCard(SET_CONSTELLAR) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,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:
2 Level 4 monsters This card cannot attack. Once per turn: You can detach 1 Xyz Material from this card; roll a six-sided die and apply the result. 1: Halve your Life Points. 2: Draw 1 card. 3: Your opponent discards 1 card. 4: Negate the effects of 1 face-up card on the field until the end of this turn. 5: Destroy 1 card on the field. 6: Destroy this card.
--No.85 クレイジー・ボックス --Number 85: Crazy Box local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,4,2) c:EnableReviveLimit() --prevent itself from attacking local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) c:RegisterEffect(e1) --roll die local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DICE+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.eftg) e2:SetOperation(s.efop) c:RegisterEffect(e2) end s.roll_dice=true s.xyz_number=85 function s.eftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function s.efop(e,tp,eg,ep,ev,re,r,rp) local dc=Duel.TossDice(tp,1) if dc==1 then Duel.SetLP(tp,Duel.GetLP(tp)/2) elseif dc==2 then Duel.Draw(tp,1,REASON_EFFECT) elseif dc==3 then if Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 then Duel.DiscardHand(1-tp,nil,1,1,REASON_EFFECT|REASON_DISCARD) end elseif dc==4 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) local tc=g:GetFirst() local e1=Effect.CreateEffect(e:GetHandler()) 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(e:GetHandler()) 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 elseif dc==5 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end else if e:GetHandler():IsRelateToEffect(e) then Duel.Destroy(e:GetHandler(),REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can return 1 face-up WIND monster you control to the bottom of the Main Deck to target up to 2 cards in your opponent's Graveyard; banish those targets.
--雷遁封印式 --Sealing Ceremony of Raiton 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,TIMING_END_PHASE) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_REMOVE) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCountLimit(1) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.cfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_WIND) and c:IsAbleToDeckAsCost() end function s.rmfilter(c) return c:IsAbleToRemove() and aux.SpElimFilter(c) end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local cg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SendtoDeck(cg,nil,SEQ_DECKBOTTOM,REASON_COST) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(1-tp) and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,2,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,1-tp,LOCATION_GRAVE) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) if not g or #g==0 then return end local rg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute all face-up "Division(s)" you control: Special Summon up to twice that many "Machine Tokens" (Machine/FIRE/Level 1/ATK 200/DEF 200), and each time 1 is destroyed, your opponent takes 500 damage. If this card is banished: You can target any number of Tokens you control; destroy them. You can only use each effect of "Division" once per turn.
--ディーヴジャン --Division --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon "Machine Tokens" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.tkncost) e1:SetTarget(s.tkntg) e1:SetOperation(s.tknop) c:RegisterEffect(e1) --Destroy any number of Tokens you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_REMOVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_names={id,id+1} --"Division", "Machine Token" function s.tkncost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCode,id),tp,LOCATION_MZONE,0,nil) if chk==0 then return #g==g:FilterCount(Card.IsReleasable,nil) and Duel.GetMZoneCount(tp,g)>0 end g:Filter(Card.IsReleasable,nil) Duel.Release(g,REASON_COST) e:SetLabel(#g*2) end function s.tkntg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,200,200,1,RACE_MACHINE,ATTRIBUTE_FIRE) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.tknop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,200,200,1,RACE_MACHINE,ATTRIBUTE_FIRE) then return end local ft=math.min(e:GetLabel(),Duel.GetLocationCount(tp,LOCATION_MZONE)) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local c=e:GetHandler() local ct=Duel.AnnounceNumberRange(tp,1,ft) for i=1,ct do local token=Duel.CreateToken(tp,id+1) if Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) then --Inflict 500 damage when the tokens are destroyed local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_DESTROYED) e1:SetOperation(function(e) Duel.Damage(1-tp,500,REASON_EFFECT) e:Reset() end) token:RegisterEffect(e1,true) end end Duel.SpecialSummonComplete() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsType(TYPE_TOKEN) end if chk==0 then return Duel.IsExistingTarget(Card.IsType,tp,LOCATION_ONFIELD,0,1,nil,TYPE_TOKEN) end local ct=Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_ONFIELD,0,nil,TYPE_TOKEN) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsType,tp,LOCATION_ONFIELD,0,1,ct,nil,TYPE_TOKEN) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can send 1 "@Ignister" monster from your Deck to the GY. If this card is sent to the GY as material for the Synchro Summon of a Cyberse monster: You can target 1 monster in your GY that was used for that Synchro Summon, except "Bururu @Ignister"; Special Summon that monster. You can only use each effect of "Bururu @Ignister" once per turn.
--ブルル@イグニスター --Bururu @Ignister --Scripted by AlphaKretin, anime version by Larry126 local s,id=GetID() function s.initial_effect(c) --Send to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BE_MATERIAL) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_IGNISTER} function s.tgfilter(c) return c:IsMonster() and c:IsSetCard(SET_IGNISTER) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO and c:GetReasonCard():IsRace(RACE_CYBERSE) end function s.spfilter(c,e,tp) return not c:IsCode(id) and c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local mg=c:GetReasonCard():GetMaterial() if chkc then return mg:IsContains(chkc) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and mg:IsExists(s.spfilter,1,c,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=mg:FilterSelect(tp,s.spfilter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All Level/Rank/Link 2 monsters currently on the field gain 1400 ATK/DEF until the end of this turn. During your Main Phase: You can banish this card from your GY, then target 1 Level/Rank/Link 2 monster you control; it gains 1400 ATK until the end of your opponent's turn. You can only use 1 "Spright Gamma Burst" effect per turn, and only once that turn.
--スプライト・ガンマ・バースト --Spright Gamma Burst --Scripted by Zefile local s,id=GetID() function s.initial_effect(c) --Increase ATK/DEF local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Increase ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.atkfilter(c) return c:IsFaceup() and (c:IsLevel(2) or c:IsRank(2) or c:IsLink(2)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #tg==0 then return end local c=e:GetHandler() for sc in tg:Iter() do --Increase ATK/DEF local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1400) sc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) sc:RegisterEffect(e2) end 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() and s.atkfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Increase ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END|RESET_OPPO_TURN) e1:SetValue(1400) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect, is activated: Reveal 1 Counter Trap in your hand, then discard 1 card and pay 1000 LP; negate the activation, and if you do, shuffle that card into the Deck. Then, you can Special Summon 1 "Parshath" monster from your Deck or Extra Deck.
--輪廻のパーシアス --Rebirth of Parshath local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_PARSHATH} function s.condition(e,tp,eg,ep,ev,re,r,rp) return (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:IsType(TYPE_COUNTER) and not c:IsPublic() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,e:GetHandler()) and (Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) or Duel.IsPlayerAffectedByEffect(tp,EFFECT_DISCARD_COST_CHANGE)) and Duel.CheckLPCost(tp,1000) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local cg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) local tc=cg:GetFirst() Duel.ConfirmCards(1-tp,cg) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_PUBLIC) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CHAIN) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVED) e2:SetRange(LOCATION_HAND) e2:SetOperation(s.clearop) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_CHAIN) e2:SetLabel(Duel.GetCurrentChain()) e2:SetLabelObject(e1) tc:RegisterEffect(e2) if not Duel.IsPlayerAffectedByEffect(tp,EFFECT_DISCARD_COST_CHANGE) then Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end Duel.PayLPCost(tp,1000) 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():IsAbleToDeck() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_TODECK,eg,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end end function s.spfilter(c,e,tp) return c:IsSetCard(SET_PARSHATH) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ((c:IsLocation(LOCATION_DECK) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0) or (c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0)) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ec=re:GetHandler() if Duel.NegateActivation(ev) and ec:IsRelateToEffect(re) then ec:CancelToGrave() if Duel.SendtoDeck(ec,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and ec:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,nil,e,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end end function s.clearop(e,tp,eg,ep,ev,re,r,rp) if ev~=e:GetLabel() then return end e:GetLabelObject():Reset() e:Reset() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All linked monsters on the field gain 500 ATK/DEF. Link Summons of Link Monsters cannot be negated. Once per Chain, if you take 2000 or more battle or effect damage: You can shuffle the face-down cards in your Extra Deck, excavate the top card, and if it is a Cyberse Link Monster, Special Summon it. Otherwise, return it to the Extra Deck.
--サイバネット・ストーム --Cynet Storm local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --atk/def up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsLinked)) e2:SetValue(500) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) --cannot disable summon local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_DISABLE_SPSUMMON) e4:SetRange(LOCATION_FZONE) e4:SetProperty(EFFECT_FLAG_IGNORE_RANGE+EFFECT_FLAG_SET_AVAILABLE) e4:SetTarget(aux.TargetBoolFunction(Card.IsSummonType,SUMMON_TYPE_LINK)) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_DAMAGE) e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e5:SetRange(LOCATION_FZONE) e5:SetCondition(s.spcon) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) c:RegisterEffect(e5) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return ep==tp and ev>=2000 end function s.spfilter(c,e,tp) return c:IsFacedown() and c:IsLinkMonster() and Duel.GetLocationCountFromEx(tp,tp,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetMatchingGroupCount(Card.IsFacedown,tp,LOCATION_EXTRA,0,nil)==0 then return end Duel.ShuffleExtra(tp) Duel.ConfirmExtratop(tp,1) local tc=Duel.GetExtraTopGroup(tp,1):GetFirst() if tc then if tc:IsLinkMonster() and tc:IsRace(RACE_CYBERSE) and Duel.GetLocationCountFromEx(tp,tp,nil,tc)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All Fish, Sea Serpent, and Aqua-Type monsters you control gain 400 ATK.
--ニードル・ギルマン --Spined Gillman local s,id=GetID() function s.initial_effect(c) --atk up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.atktg) e1:SetValue(400) c:RegisterEffect(e1) end function s.atktg(e,c) return c:IsRace(RACE_FISH|RACE_SEASERPENT|RACE_AQUA) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's activation and effect cannot be negated. If you control a monster whose original name is "Slifer the Sky Dragon": Destroy as many face-up monsters your opponent controls as possible, then, if you activated this card during your Main Phase, you can apply the following effect. ● Draw cards equal to the number of monsters destroyed by this effect and sent to your opponent's GY, also you can only attack with 1 monster this turn. You can only activate 1 "Thunderforce Attack" per turn.
--超伝導波サンダーフォース --Thunderforce Attack --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_INACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_SLIFER} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsOriginalCodeRule,CARD_SLIFER),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(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end local sg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) if Duel.IsMainPhase() and Duel.IsTurnPlayer(tp) then e:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,1) else e:SetCategory(CATEGORY_DESTROY) end end function s.filter(c,p) return c:IsControler(p) and c:IsLocation(LOCATION_GRAVE) and c:IsMonster() end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) Duel.Destroy(sg,REASON_EFFECT) local ct=Duel.GetOperatedGroup():FilterCount(s.filter,nil,1-tp) if Duel.IsMainPhase() and Duel.IsTurnPlayer(tp) and ct>0 and Duel.IsPlayerCanDraw(tp,ct) and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Draw(tp,ct,REASON_EFFECT) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetCondition(s.atkcon) e1:SetTarget(s.atktg) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetOperation(s.checkop) e2:SetLabelObject(e1) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end end function s.atkcon(e) return Duel.GetFlagEffect(e:GetHandlerPlayer(),id)>0 end function s.atktg(e,c) return c:GetFieldID()~=e:GetLabel() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local a=eg:GetFirst() if Duel.GetFlagEffect(tp,id)>0 or not a:IsControler(tp) then return end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) e:GetLabelObject():SetLabel(a:GetFieldID()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Noble Arms" Equip Spell, you can Special Summon this card (from your hand). You can only Special Summon "Noble Knight Custennin" once per turn this way. A "Noble Knight" monster that was Synchro, Xyz or Link Summoned using this card on the field as material gains this effect. ● If this card is Special Summoned, you can: During your Main Phase this turn, you can Normal Summon 1 monster in addition to your Normal Summon/Set (you can only gain this effect once per turn), also, you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except "Noble Knight" monsters. * The above text is unofficial and describes the card's functionality in the OCG.
--聖騎士コルネウス --Noble Knight Custennin --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Extra Normal Summon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCondition(s.mtcon) e2:SetOperation(s.mtop) c:RegisterEffect(e2) end s.listed_series={SET_NOBLE_ARMS,SET_NOBLE_KNIGHT} function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_EQUIP) and c:IsSetCard(SET_NOBLE_ARMS) 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.filter,c:GetControler(),LOCATION_ONFIELD,0,1,nil) end function s.mtcon(e,tp,eg,ep,ev,re,r,rp) return r & (REASON_SYNCHRO+REASON_XYZ+REASON_LINK)~=0 and e:GetHandler():IsPreviousLocation(LOCATION_MZONE) end function s.mtop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() if not rc:IsSetCard(SET_NOBLE_KNIGHT) then return end --reg eff local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.effcon) e1:SetOperation(s.effop) e1:SetReset(RESETS_STANDARD_PHASE_END) rc:RegisterEffect(e1,true) if not rc:IsType(TYPE_EFFECT) then local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_ADD_TYPE) e3:SetValue(TYPE_EFFECT) e3:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e3,true) end rc:RegisterFlagEffect(0,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) end function s.effcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPlayerCanAdditionalSummon(tp) end function s.effop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFlagEffect(tp,id)~=0 then return end local c=e:GetHandler() --Cannot Special Summon from the Extra Deck, except "Noble Knight" monsters local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e0:SetDescription(aux.Stringid(id,2)) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e0:SetReset(RESET_PHASE|PHASE_END) e0:SetTargetRange(1,0) e0:SetTarget(s.splimit) Duel.RegisterEffect(e0,tp) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) --Additional Normal Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,3)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_EXTRA_SUMMON_COUNT) e1:SetTargetRange(LOCATION_HAND|LOCATION_MZONE,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return c:IsLocation(LOCATION_EXTRA) and not c:IsSetCard(SET_NOBLE_KNIGHT) end function s.lizfilter(e,c) return not c:IsOriginalSetCard(SET_NOBLE_KNIGHT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can place this card you control and 1 "Centur-Ion" monster from your hand or Deck, except "Centur-Ion Trudea", in your Spell & Trap Zones as face-up Continuous Traps, also you cannot Special Summon "Centur-Ion Trudea" for the rest of this turn. During the Main Phase, if this card is a Continuous Trap: You can Special Summon this card, then you can increase its Level by 4. You can only use each effect of "Centur-Ion Trudea" once per turn.
--従騎士トゥルーデア --Centur-Ion Trudea --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Place this card and 1 "Centurion" monster in the Spell/Trap Zone as Continuous Traps local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.pltg) e1:SetOperation(s.plop) c:RegisterEffect(e1) --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetCondition(function(e) return Duel.IsMainPhase() and e:GetHandler():IsContinuousTrap() end) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_CENTURION} function s.plfilter(c) return c:IsSetCard(SET_CENTURION) and c:IsMonster() and not c:IsForbidden() and not c:IsCode(id) end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not e:GetHandler():IsForbidden() and Duel.GetLocationCount(tp,LOCATION_SZONE)>=2 and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil) end end function s.move_to_stzone(c,hc,tp) if not Duel.MoveToField(c,tp,tp,LOCATION_SZONE,POS_FACEUP,c:IsMonsterCard()) then return end --Treat as Continuous Trap local e1=Effect.CreateEffect(hc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_TRAP|TYPE_CONTINUOUS) e1:SetReset((RESET_EVENT|RESETS_STANDARD)&~RESET_TURN_SET) c:RegisterEffect(e1) return true end function s.plop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Cannot Special Summon "Centurion Trudea" 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:IsCode(id) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) if c:IsForbidden() or not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_SZONE)<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local g=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil) if #g>0 and s.move_to_stzone(c,c,tp) then s.move_to_stzone(g:GetFirst(),c,tp) 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 c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() --Increase its Level by 4 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(4) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Beast monster in your GY; Special Summon that target, and if you do, all face-up monsters your opponent currently controls (if any) lose 200 ATK for each Beast, Plant, and Winged Beast monster currently in your GY (if any), until the end of this turn. You can only activate 1 "Ayers Rock Sunrise" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--エアーズロック・サンライズ --Ayers Rock Sunrise local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsRace(RACE_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) local ct=Duel.GetMatchingGroupCount(Card.IsRace,tp,LOCATION_GRAVE,0,nil,RACE_BEAST|RACE_WINGEDBEAST|RACE_PLANT) tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*-200) 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 a face-up monster you control is changed to face-down Defense Position: You can target 1 card on the field; destroy it. If a Flip monster(s) you control is flipped face-up, even during the Damage Step: You can target 1 of them; inflict damage to your opponent equal to its Level x 200. You can only use each effect of "Sunset Beat" once per turn.
--サンセット・ビート --Sunset Beat --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --Destroy 1 card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_CHANGE_POS) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Inflict damage equal to the ATK of a monster that was flipped face-up local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetCode(EVENT_FLIP) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.damcond) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.cfilter(c,tp) return c:IsControler(tp) and not c:IsStatus(STATUS_CONTINUOUS_POS) and c:IsPosition(POS_FACEDOWN_DEFENSE) and c:IsPreviousPosition(POS_FACEUP) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.damfilter(c,tp,e) return c:IsControler(tp) and c:HasLevel() and c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_FLIP) and c:IsCanBeEffectTarget(e) end function s.damcond(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.damfilter,1,nil,tp,e) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and s.damfilter(chkc,tp,e) end if chk==0 then return eg:IsExists(s.damfilter,1,nil,tp,e) end local tc=nil if #eg==1 then tc=eg:GetFirst() else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) tc=eg:Select(tp,1,1,nil):GetFirst() end Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,tc:GetLevel()) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Damage(1-tp,tc:GetLevel()*200,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 FIRE monster in your GY; send 1 card from your hand to the GY, and if you do, Special Summon the targeted monster. You can banish this card from your GY, then target 3 of your FIRE monsters that are banished and/or in your GY; shuffle them into the Deck, then draw 1 card. You can only use this effect of "Fire Recovery" once per turn.
--ファイヤー・バック --Fire Recovery --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_TOGRAVE+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) --Shuffle 3 of your FIRE monsters that are banished and/or in your GY into the Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_FIRE) 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.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_HAND,0,1,1,nil) if not (#g>0 and Duel.SendtoGrave(g,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_GRAVE)) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.tdfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsFaceup() and c:IsAbleToDeck() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED|LOCATION_GRAVE,0,3,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED|LOCATION_GRAVE,0,3,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,3,tp,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if not (#tg>0 and Duel.SendtoDeck(tg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK|LOCATION_EXTRA)) then return end if tg:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent from the hand or field to the GY: You can activate this effect; each player draws 1 card, then each player discards 1 card, then, if you discarded an "Ojama" card, you can choose 1 opponent's unused Monster Zone, and it cannot be used until the end of your opponent's turn. You can only use this effect of "Ojama Pink" once per turn.
--ジャマ・ピンク --Ojama Pink --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Draw and discard local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_OJAMA} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) or e:GetHandler():IsPreviousLocation(LOCATION_HAND) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,PLAYER_ALL,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local h1=Duel.Draw(tp,1,REASON_EFFECT) local h2=Duel.Draw(1-tp,1,REASON_EFFECT) if h1>0 or h2>0 then Duel.BreakEffect() end local sealbool=false if h1>0 then Duel.ShuffleHand(tp) if Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD)>0 then local dc=Duel.GetOperatedGroup():GetFirst() if dc:IsSetCard(SET_OJAMA) then sealbool=true end end end if h2>0 then Duel.ShuffleHand(1-tp) Duel.DiscardHand(1-tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD) end if sealbool and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() local zone=Duel.SelectDisableField(tp,1,0,LOCATION_MZONE,0) if tp==1 then zone=((zone&0xffff)<<16)|((zone>>16)&0xffff) end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE_FIELD) e1:SetValue(zone) e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN) Duel.RegisterEffect(e1,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Normal Monster in your GY; Special Summon it in face-up Defense Position, but it cannot attack.
--黙する死者 --Silent Doom local s,id=GetID() function s.initial_effect(c) --Special summon 1 normal monster from GY, it cannot attack local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsType(TYPE_NORMAL) 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_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.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 and tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then --Cannot attack local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While this card is face-up on your side of the field, you can return 1 Normal Monster Card in your hand to the bottom of your Deck during your End Phase to draw 1 card from your Deck. You can only use this effect once per turn.
--鬼ゴブリン --Coach Goblin local s,id=GetID() function s.initial_effect(c) --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.drcon) e1:SetCost(s.drcost) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.cfilter(c) return c:IsType(TYPE_NORMAL) and c:IsAbleToDeckAsCost() 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.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_COST) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) 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.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only control 1 "Dakki, the Graceful Mayakashi". When a "Mayakashi" monster(s) is Special Summoned to your field from the Extra Deck, while this card is in the GY (except during the Damage Step): You can Special Summon this card. You cannot Special Summon monsters from the Extra Deck the turn you activate this effect, except "Mayakashi" monsters.
--麗の魔妖(まやかし)-妲姫 --Dakki, the Graceful Mayakashi 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:SetCode(EVENT_SPSUMMON_SUCCESS) 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:IsSetCard(SET_MAYAKASHI) and c:IsSummonLocation(LOCATION_EXTRA) and c:IsControler(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:
You can discard this card, then activate 1 of these effects; ● Add 1 "Magistus" monster from your Deck to your hand, except "Spoon, the Seal of Magistus". ● Halve the ATK of 1 face-up monster your opponent controls until the end of this turn. You can banish this card from your GY, then target 1 face-up monster you control; equip it with 1 "Magistus" monster from your Extra Deck or GY. You can only use each effect of "Spoon, the Seal of Magistus" once per turn.
--封印の魔道士スプーン --Spoon, the Seal of Magistus --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) --Equip 1 "Magistus" monster from your Extra Deck or GY to 1 face-up monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) end s.listed_series={SET_MAGISTUS} s.listed_names={id} function s.thfilter(c) return c:IsSetCard(SET_MAGISTUS) and c:IsMonster() and not c:IsCode(id) and c:IsAbleToHand() end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) elseif op==2 then e:SetCategory(CATEGORY_ATKCHANGE) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Add 1 "Magistus" monster from your Deck to your hand, except "Spoon, the Seal of Magistus" 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 elseif op==2 then --Halve the ATK of 1 face-up monster your opponent controls until the end of this turn Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() if sc then Duel.HintSelection(sc) --Halve its 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_SET_ATTACK_FINAL) e1:SetValue(sc:GetAttack()/2) e1:SetReset(RESETS_STANDARD_PHASE_END) sc:RegisterEffect(e1) end end end function s.eqfilter(c,tp) return c:IsSetCard(SET_MAGISTUS) and c:IsMonster() and c:CheckUniqueOnField(tp) and not c:IsForbidden() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_EXTRA|LOCATION_GRAVE,0,1,e:GetHandler(),tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_EXTRA|LOCATION_GRAVE) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_EXTRA|LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() if ec and Duel.Equip(tp,ec,tc) then --Equip limit local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetValue(function(e,c) return c==tc end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) ec:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 2 face-up "Wind-Up" monsters you control with different Levels; your opponent chooses 1 of them, and the Level of the other monster becomes the same as the chosen monster's, until the End Phase. Then, if your opponent chose the monster with a lower Level, you can draw 1 card.
--揺れる発条秤 --Weights & Zenmaisures local s,id=GetID() function s.initial_effect(c) --Change the level of 1 "Wind-up" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE+CATEGORY_DRAW) 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 s.listed_series={SET_WIND_UP} function s.filter(c,e) return c:IsFaceup() and c:IsSetCard(SET_WIND_UP) and c:HasLevel() and c:IsCanBeEffectTarget(e) end function s.rescon(sg) return sg:GetClassCount(Card.GetLevel)==#sg end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil,e) if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TARGET) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,tg,1,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e):Match(Card.IsFaceup,nil) if #g==2 and g:GetClassCount(Card.GetLevel)==2 then Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(id,1)) local tc1=g:Select(1-tp,1,1,nil):GetFirst() local tc2=g:RemoveCard(tc1):GetFirst() local lv1=tc1:GetLevel() local lv2=tc2:GetLevel() --Change the other monsters level to match the selected monster's local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv1) e1:SetReset(RESETS_STANDARD_PHASE_END) tc2:RegisterEffect(e1) if lv1<lv2 and Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Bujin" monster: You can banish this card from your Graveyard, then target 1 face-up Attack Position monster your opponent controls; change it to face-up Defense Position, and if you do, its DEF becomes 0 until the end of this turn.
--武神器-イクタ --Bujingi Boar local s,id=GetID() function s.initial_effect(c) --position local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE) e1:SetCondition(s.poscon) e1:SetCost(Cost.SelfBanish) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) end s.listed_series={SET_BUJIN} function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_BUJIN) end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.filter(c) return c:IsPosition(POS_FACEUP_ATTACK) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)~=0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_DEFENSE_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster you control; return that face-up monster to the hand, and if you do, for the rest of this turn, neither player can activate the effects of cards with the returned card's name.
--夜の逃飛行 --Night Flight --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Return face-up monster to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsFaceup() and chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsAbleToHand),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsAbleToHand),tp,LOCATION_MZONE,0,1,1,nil,tp) 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) and tc:IsFaceup() and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then --Cannot activate cards/effects with the same name local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,1) e1:SetValue(s.aclimit) e1:SetLabelObject(tc) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.aclimit(e,re,tp) return re:GetHandler():IsCode(e:GetLabelObject():GetCode()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this face-up Attack Position card is targeted for an attack: You can change this card to face-up Defense Position, and if you do, negate that attack.
--EMアメンボート --Performapal Skeeter Skimmer local s,id=GetID() function s.initial_effect(c) --negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BE_BATTLE_TARGET) 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():IsAttackPos() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_POSITION,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.ChangePosition(c,POS_FACEUP_DEFENSE)~=0 then Duel.NegateAttack() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Once per turn: You can discard 1 card, then target 1 card your opponent controls; destroy it. If this Synchro Summoned card is sent from the field to the GY: You can draw 1 card. You can only use this effect of "Coral Dragon" once per turn.
--瑚之龍 --Coral Dragon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --draw local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.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.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSynchroSummoned() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Fusion Summon 1 "Myutant" Fusion Monster from your Extra Deck, by banishing Fusion Materials listed on it from your hand or field. If your opponent has activated a card or effect this turn, you can use up to 1 monster each from your Deck and GY as Fusion Material. You can only activate 1 "Myutant Fusion" per turn.
--フュージョン・ミュートリアス --Myutant Fusion --Scripted by edo9300 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff({handler=c,fusfilter=aux.FilterBoolFunction(Card.IsSetCard,SET_MYUTANT), matfilter=Card.IsAbleToRemove,extrafil=s.extrafil, extraop=Fusion.BanishMaterial,extratg=s.extrtarget}) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,aux.FALSE) end s.listed_series={SET_MYUTANT} function s.check(g1,g2) return function(tp,sg,fc) local c1=#(sg&g1) local c2=#(sg&g2) return c1<=1 and c2<=1,c1>1 or c2>1 end end function s.extrafil(e,tp,mg) if Duel.GetCustomActivityCount(id,1-e:GetHandlerPlayer(),ACTIVITY_CHAIN)==0 then return nil end local loc=LOCATION_DECK if not Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) then loc=loc|LOCATION_GRAVE end local g=Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToRemove),tp,loc,0,mg) return g,s.check(g:Split(Card.IsLocation,nil,LOCATION_GRAVE)) end function s.extrtarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_HAND|LOCATION_MZONE) Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,0,tp,LOCATION_GRAVE|LOCATION_DECK) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If the ATK of a monster summoned by your opponent (excluding Special Summon) is 500 points or less, the monster is destroyed.
--ねずみ取り --Eatgaboon local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tc=eg:GetFirst() if chkc then return chkc==tc end if chk==0 then return ep~=tp and tc:IsFaceup() and tc:GetAttack()<=500 and tc:IsOnField() and tc:IsCanBeEffectTarget(e) end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,tc,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()<=500 then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 4 "tellarknight" monsters During the turn you Xyz Summon this card, you cannot Special Summon monsters, except "tellarknight" monsters. If this card is Xyz Summoned: Return all other cards on the field to the hand. Once per turn: You can detach 1 Xyz Material from this card; send 1 random card from your opponent's hand to the Graveyard. If this card with Xyz Material is sent to the Graveyard: You can target 1 "tellarknight" monster in your Graveyard; Special Summon it.
--星輝士 トライヴェール --Stellarknight Triverr local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,s.xyzfilter,4,3) c:EnableReviveLimit() --summon limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.regcon) e1:SetOperation(s.regop) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_CONDITION) e2:SetValue(s.splimit) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCategory(CATEGORY_TOHAND) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --handes local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOGRAVE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCost(Cost.DetachFromSelf(1)) e4:SetTarget(s.hdtg) e4:SetOperation(s.hdop) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetCode(EVENT_TO_GRAVE) e5:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e5:SetCondition(s.spcon) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) c:RegisterEffect(e5) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SPSUMMON_SUCCESS) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_series={SET_TELLARKNIGHT} function s.checkop(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() local p1=false local p2=false for tc in aux.Next(eg) do if not tc:IsSetCard(SET_TELLARKNIGHT) then if tc:GetSummonPlayer()==0 then p1=true else p2=true end end end if p1 then Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end if p2 then Duel.RegisterFlagEffect(1,id,RESET_PHASE|PHASE_END,0,1) end end function s.xyzfilter(c,lc,SUMMON_TYPE_XYZ,tp) return Duel.GetFlagEffect(c:GetControler(),id)==0 and c:IsSetCard(SET_TELLARKNIGHT,lc,SUMMON_TYPE_XYZ,tp) end function s.regcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsXyzSummoned() end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,3)) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(s.sumlimit) Duel.RegisterEffect(e1,tp) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsSetCard(SET_TELLARKNIGHT) end function s.splimit(e,se,sp,st,spos,tgp) return (st&SUMMON_TYPE_XYZ)~=SUMMON_TYPE_XYZ or Duel.GetFlagEffect(tgp,id)==0 end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsXyzSummoned() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler()) Duel.SendtoHand(g,nil,REASON_EFFECT) end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(1-tp,LOCATION_HAND,0)~=0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,1-tp,LOCATION_HAND) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0) if #g==0 then return end local sg=g:RandomSelect(1-tp,1) Duel.SendtoGrave(sg,REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetOverlayCount()>0 and e:GetHandler():GetPreviousLocation()==LOCATION_MZONE end function s.spfilter(c,e,tp) return c:IsSetCard(SET_TELLARKNIGHT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned by a card effect, except the effect of "Gladiator Beast Dimacari". This Special Summoned card is unaffected by Spell effects. At the end of the Battle Phase, if this card battled: You can shuffle this card into the Deck; Special Summon 1 "Gladiator Beast" monster from your Deck, except "Gladiator Beast Alexander". * The above text is unofficial and describes the card's functionality in the OCG.
--剣闘獣アレクサンデル --Gladiator Beast Alexander local s,id=GetID() function s.initial_effect(c) --immune spell local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.imcon) e1:SetValue(s.imfilter) 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_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) --spsummon limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetCode(EFFECT_SPSUMMON_CONDITION) e3:SetValue(s.splimit) c:RegisterEffect(e3) end s.listed_series={SET_GLADIATOR} s.listed_names={id} function s.splimit(e,se,sp,st) return st==(SUMMON_TYPE_SPECIAL+107) or st&SUMMON_TYPE_PENDULUM==SUMMON_TYPE_PENDULUM end function s.imcon(e) return e:GetHandler():GetFlagEffect(id)>0 end function s.imfilter(e,te) return te:IsSpellEffect() 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,111,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 and Duel.SpecialSummon(tc,111,tp,tp,false,false,POS_FACEUP)>0 then 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:
Once per turn (Quick Effect): You can discard 1 Wyrm monster; this card gains 1000 DEF until the end of this turn. Once per battle, during damage calculation, if this Attack Position card battles an Attack Position monster (Quick Effect): You can apply each card's DEF for damage calculation.
--龍狸燈 --Dracoon Lamp --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Increase DEF local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.defcost) e1:SetOperation(s.defop) c:RegisterEffect(e1) --Change stats local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.con) e2:SetCost(s.cost) e2:SetOperation(s.op) c:RegisterEffect(e2) end function s.defcfilter(c) return c:IsRace(RACE_WYRM) and c:IsDiscardable() end function s.defcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.defcfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.defcfilter,1,1,REASON_COST|REASON_DISCARD) end function s.defop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_DEFENSE) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.con(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc~=nil and c:IsAttackPos() and bc:IsAttackPos() and not bc:IsType(TYPE_LINK) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_CHAIN,0,1) end function s.op(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if c:IsRelateToBattle() and bc and bc:IsRelateToBattle() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CHANGE_BATTLE_STAT) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(function(e2,c2) return c2==c or c2==bc end) e1:SetValue(function(e3,c3) return c3:GetDefense() end) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Discard 1 card from your hand. Destroy all Special Summoned monsters on the field.
--スペシャルハリケーン --Special Hurricane local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsSpecialSummoned() 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,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by Tributing 1 Warrior or Fairy-Type monster from your hand or field. If this card is Tributed for a Ritual Summon: You can target 1 Ritual Spell Card in your Graveyard; add it to your hand.
--サイバー・チュチュボン --Cyber Tutubon local s,id=GetID() function s.initial_effect(c) --spsummon from hand local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_HAND) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_RELEASE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.hspcon(e,c) if c==nil then return true end return Duel.CheckReleaseGroup(c:GetControler(),Card.IsRace,1,true,1,true,c,c:GetControler(),nil,false,e:GetHandler(),RACE_WARRIOR|RACE_FAIRY) end function s.hsptg(e,tp,eg,ep,ev,re,r,rp,c) local g=Duel.SelectReleaseGroup(tp,Card.IsRace,1,1,true,true,true,c,nil,nil,false,e:GetHandler(),RACE_WARRIOR|RACE_FAIRY) if g then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.hspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Release(g,REASON_COST) g:DeleteGroup() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_RITUAL) end function s.thfilter(c) return c:IsRitualSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card as a Normal Monster (Psychic/DARK/Level 4/ATK 1900/DEF 2500) (this card is also still a Trap), then you can Special Summon 1 Machine "Time Thief" monster from your hand, Deck, or GY. If you control an Xyz Monster(s) that has both a Spell and a Trap as material: You can banish this card from your GY; banish 1 card on the field. You can only use each effect of "Time Thief Power Reserve" once per turn.
--クロノダイバー・パワーリザーブ --Time Thief Power Reserve --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself as a monster then Special Summon 1 Machine "Time Thief" 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Banish 1 card on the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.rmvcond) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.rmvtg) e2:SetOperation(s.rmvop) c:RegisterEffect(e2) end local LOCATION_HAND_DECK_GRAVE=LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE s.listed_series={SET_TIME_THIEF} 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 Duel.IsPlayerCanSpecialSummonMonster(tp,id,SET_TIME_THIEF,TYPE_MONSTER|TYPE_NORMAL,1900,2500,4,RACE_PSYCHIC,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND_DECK_GRAVE) end function s.spfilter(c,e,tp) return c:IsRace(RACE_MACHINE) and c:IsSetCard(SET_TIME_THIEF) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,SET_TIME_THIEF,TYPE_MONSTER|TYPE_NORMAL,1900,2500,4,RACE_PSYCHIC,ATTRIBUTE_DARK) then return end c:AddMonsterAttribute(TYPE_NORMAL|TYPE_TRAP) Duel.SpecialSummonStep(c,1,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() if Duel.SpecialSummonComplete()==0 then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND_DECK_GRAVE,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND_DECK_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end function s.xyzmatfilter(c) if not (c:IsFaceup() and c:IsType(TYPE_XYZ)) then return false end local og=c:GetOverlayGroup() return og:IsExists(Card.IsSpell,1,nil) and og:IsExists(Card.IsTrap,1,nil) end function s.rmvcond(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.xyzmatfilter,tp,LOCATION_MZONE,0,1,nil) end function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,LOCATION_ONFIELD) end function s.rmvop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g,true) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end