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:
2 Beast, Beast-Warrior, and/or Winged Beast monsters During your Main Phase: You can Special Summon 1 Level 4 or lower Beast, Beast-Warrior, or Winged Beast monster from your hand, also you cannot use monsters as Link Material for the rest of this turn, except Beast, Beast-Warrior, or Winged Beast monsters. If this card is sent to the GY: You can draw 1 card, then place 1 card from your hand on the bottom of the Deck. You can only use each effect of "Tri-Brigade Ferrijit the Barren Blossom" once per turn.
--鉄獣戦線 徒花のフェリジット --Tri-Brigade Ferrijit the Barren Blossom --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Link Summon Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACES_BEAST_BWARRIOR_WINGB),2,2) c:EnableReviveLimit() --Special Summon 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_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Draw 1 card and return 1 card to the Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp) end function s.sptg(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) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) --Cannot use monsters as link material, except Beast, Beast-Warrior and Winged-Beast local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_IGNORE_IMMUNE) e1:SetTargetRange(0xff,0xff) e1:SetTarget(s.matlimit) e1:SetValue(s.sumlimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --client hint aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) if 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 function s.matlimit(e,c) return not c:IsRace(RACES_BEAST_BWARRIOR_WINGB) end function s.sumlimit(e,c) if not c then return false end return c:IsControler(e:GetHandlerPlayer()) end 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) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)==0 then return end Duel.ShuffleHand(tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is destroyed by battle or card effect and sent to the GY: You can target 1 face-up monster your opponent controls; it loses 400 ATK until the end of this turn. You can only use each of the following effects of "Cursed Fire King Doom Burst" once per turn. If you control a Fiend Tuner: You can Special Summon this card from your hand. If this card is Special Summoned: You can target 1 face-up monster your opponent controls; it loses 600 ATK until the end of this turn.
--呪炎王バースト・カースド --Cursed Fire King Doom Burst --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Make 1 monster your opponent controls lose 400 ATK until the end of the turn 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_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_DESTROYED) e1:SetLabel(400) e1:SetCondition(s.atkcon) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) 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) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Make 1 monster your opponent controls lose 600 ATK until the end of the turn local e3=e1:Clone() e3:SetDescription(aux.Stringid(id,2)) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetCountLimit(1,{id,1}) e3:SetLabel(600) e3:SetCondition(aux.TRUE) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then --It loses 400 or 600 ATK until the end of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-e:GetLabel()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.tunerfilter(c) return c:IsRace(RACE_FIEND) and c:IsType(TYPE_TUNER) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.tunerfilter,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,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:
Target 2 face-up monsters you control with the same Type and Attribute; change one of their Levels to the current Level of the other, until the End Phase.
--共振装置 --Resonance Device local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) 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.filter1(c,tp) local lv1=c:GetLevel() return lv1>0 and c:IsFaceup() and Duel.IsExistingTarget(s.filter2,tp,LOCATION_MZONE,0,1,c,c:GetRace(),c:GetAttribute(),lv1) end function s.filter2(c,rc,at,lv1) local lv2=c:GetLevel() return lv2>0 and lv2~=lv1 and c:IsFaceup() and c:IsRace(rc) and c:IsAttribute(at) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g1=Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,tp) local tc1=g1:GetFirst() e:SetLabelObject(tc1) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) local g2=Duel.SelectTarget(tp,s.filter2,tp,LOCATION_MZONE,0,1,1,tc1,tc1:GetRace(),tc1:GetAttribute(),tc1:GetLevel()) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tc1=e:GetLabelObject() local tc2=g:GetFirst() if tc1==tc2 then tc2=g:GetNext() end local lv1=tc1:GetLevel() local lv2=tc2:GetLevel() if lv1==lv2 then return end if tc1:IsFaceup() and tc1:IsRelateToEffect(e) and tc2:IsFaceup() and tc2:IsRelateToEffect(e) then 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) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase, if this card is in your hand or GY (Quick Effect): You can Tribute up to 3 Fairy monsters; Special Summon this card (but banish it when it leaves the field), then, you can apply the following effect(s) in sequence, depending on the number of Tributed monsters. ● 2+: Destroy 1 card your opponent controls. ● 3: Draw 2 cards. You can only use this effect of "Trias Hierarchia" once per turn.
--トリアス・ヒエラルキア --Trias Hierarchia --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon itself from hand or GY, then you can apply extra effects 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|LOCATION_GRAVE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcheck(sg,tp) return Duel.GetMZoneCount(tp,sg)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsRace,1,false,s.spcheck,nil,RACE_FAIRY) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsRace,1,3,false,s.spcheck,nil,RACE_FAIRY) local ct=Duel.Release(g,REASON_COST) e:SetLabel(ct) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) local ct=e:GetLabel() if ct>=2 then Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,1-tp,LOCATION_ONFIELD) end if ct==3 then Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,2) end end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) local ct=e:GetLabel() if ct==1 then return end --If you Tributed 2+ monsters, you can destroy 1 card the opponent controls local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 and ct>=2 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local sg=g:Select(tp,1,1,nil) Duel.HintSelection(sg,true) Duel.BreakEffect() Duel.Destroy(sg,REASON_EFFECT) end --If you Tributed 3 monsters, you can draw 2 cards if ct==3 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Draw(tp,2,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) by banishing 1 LIGHT and 1 DARK monster from your GY. While a Field Spell is face-up on the field, your opponent cannot target LIGHT or DARK monsters you control with card effects. You can target cards on the field, up to the number of face-up Field Spells on the field; banish them. You can only use this effect of "Chaos Daedalus" once per turn.
--カオス・ダイダロス --Chaos Daedalus --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Special summon procedure (from hand) 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.spcond) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Opponent cannot target your LIGHT/DARK monsters with card effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetCondition(s.tgcond) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttribute,ATTRIBUTE_LIGHT+ATTRIBUTE_DARK)) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --Banish cards on the field, up to the numbers of face-up field spells local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetCategory(CATEGORY_REMOVE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,id) e3:SetTarget(s.rmvtg) e3:SetOperation(s.rmvop) c:RegisterEffect(e3) end function s.rescon(sg,e,tp,mg) return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:IsExists(s.atchk1,1,nil,sg) end function s.atchk1(c,sg) return c:IsAttribute(ATTRIBUTE_LIGHT) and sg:FilterCount(Card.IsAttribute,c,ATTRIBUTE_DARK)==1 end function s.spfilter1(c,att) return c:IsAttribute(att) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.spcond(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() local rg1=Duel.GetMatchingGroup(s.spfilter1,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_LIGHT) local rg2=Duel.GetMatchingGroup(s.spfilter1,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_DARK) local rg=rg1:Clone() rg:Merge(rg2) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return ft>-2 and #rg1>0 and #rg2>0 and aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local g=nil local rg=Duel.GetMatchingGroup(s.spfilter1,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_LIGHT+ATTRIBUTE_DARK) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.fspfilter(c) return c:IsFaceup() and c:IsSpell() and c:IsType(TYPE_FIELD) end function s.tgcond(e,c) return Duel.IsExistingMatchingCard(s.fspfilter,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingMatchingCard(s.fspfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end local ct=Duel.GetMatchingGroupCount(s.fspfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmvop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can equip the destroyed monster to this card. (You can only equip 1 monster at a time to this card with this effect.) This card gains ATK equal to that equipped monster's ATK.
--H・C ウォー・ハンマー --Heroic Challenger - War Hammer local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,s.eqconc,function(ec,_,tp) return ec:IsControler(1-tp) end,s.equipop,e1) end function s.eqconc(e) local g=e:GetHandler():GetEquipGroup():Filter(s.eqfilter,nil) return #g==0 end function s.eqfilter(c) return c:GetFlagEffect(id)~=0 end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetBattleTarget() return aux.bdogcon(e,tp,eg,ep,ev,re,r,rp) and not tc:IsForbidden() and s.eqconc(e) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end local tc=e:GetHandler():GetBattleTarget() Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,tc,1,0,0) end function s.equipop(c,e,tp,tc) local atk=tc:GetBaseAttack() if atk<0 then atk=0 end if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end if atk>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(atk) tc:RegisterEffect(e2) end end function s.eqop(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 and tc:IsRelateToEffect(e) then s.equipop(c,e,tp,tc) end end function s.eqlimit(e,c) return e:GetOwner()==c end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Salamangreat" monster is sent to your GY, except "Salamangreat Gazelle" (except during the Damage Step): You can Special Summon this card from your hand. If this card is Normal or Special Summoned: You can send 1 "Salamangreat" card from your Deck to the GY, except "Salamangreat Gazelle". You can only use each effect of "Salamangreat Gazelle" once per turn.
--転生炎獣ガゼル --Salamangreat Gazelle --scripted by Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon from hand, optional trigger effect 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_TO_GRAVE) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --If normal summoned, send to GY, optional trigger effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.tgtg) e2:SetOperation(s.tgop) c:RegisterEffect(e2) --If special summoned, send to GY, optional trigger effect local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_SALAMANGREAT} s.listed_names={id} --If a "Salamangreat" monster, besides itself, is sent to GY function s.cfilter(c,tp) return c:IsSetCard(SET_SALAMANGREAT) and c:IsMonster() and not c:IsCode(id) and c:IsControler(tp) end --If it ever happened function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end --Performing the effect of special summoning this card from hand function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end --Check for a "Salamangreat" card to send to GY, besides itself function s.tgfilter(c) return c:IsSetCard(SET_SALAMANGREAT) and c:IsAbleToGrave() and not c:IsCode(id) end --Activation legality 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 --Performing the effect of sending a "Salamangreat" monster function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Polymerization" from your Deck to your hand.
--融合賢者 --Fusion Sage local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_POLYMERIZATION} function s.filter(c) return c:IsCode(CARD_POLYMERIZATION) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card in Defense Position as an Effect Monster (Aqua/WATER/Level 10/ATK 0/DEF 3000). (This card is also still a Trap.) If Summoned this way, this card cannot attack.
--メタル・リフレクト・スライム --Metal Reflect Slime local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,3000,10,RACE_AQUA,ATTRIBUTE_WATER) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,3000,10,RACE_AQUA,ATTRIBUTE_WATER) then return end c:AddMonsterAttribute(TYPE_EFFECT|TYPE_TRAP) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP_DEFENSE) c:AddMonsterAttributeComplete() --cannot attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only Special Summon "Geistgrinder Golem" once per turn. You can reveal 1 "Yubel" monster in your hand; Special Summon this card from your hand to your opponent's field, then you can Special Summon the revealed monster to your field. Once per turn, during damage calculation, if this card battles a "Yubel" monster: Your opponent gains 3000 LP. If you Special Summon "Yubel" while this card is in your GY (except during the Damage Step): You can Special Summon this card to your opponent's field.
--ガイストーチ・ゴーレム --Geistgrinder Golem --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Can only Special Summon "Geist Grinder Golem" once per turn c:SetSPSummonOnce(id) --Special Summon this card to your opponent's field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Opponent gains 3000 LP local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_RECOVER) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e2:SetCountLimit(1) e2:SetCondition(s.lpcon) e2:SetTarget(s.lptg) e2:SetOperation(s.lpop) c:RegisterEffect(e2) --Special Summon this card to your opponent's field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(s.gspcon) e3:SetTarget(s.gsptg) e3:SetOperation(s.gspop) c:RegisterEffect(e3) end s.listed_names={id,CARD_YUBEL} s.listed_series={SET_YUBEL} function s.spcostfilter(c) return c:IsSetCard(SET_YUBEL) and c:IsMonster() and not c:IsPublic() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,c):GetFirst() Duel.SetTargetCard(rc) Duel.ConfirmCards(1-tp,rc) Duel.ShuffleHand(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(1-tp,LOCATION_MZONE,tp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,1-tp,false,false,POS_FACEUP)==0 then return end local rc=Duel.GetFirstTarget() if rc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and rc:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() Duel.SpecialSummon(rc,0,tp,tp,false,false,POS_FACEUP) end end function s.lpcon(e,tp,eg,ep,ev,re,r,rp) local bc=e:GetHandler():GetBattleTarget() return bc and bc:IsSetCard(SET_YUBEL) end function s.lptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,1-tp,3000) end function s.lpop(e,tp,eg,ep,ev,re,r,rp) Duel.Recover(1-tp,3000,REASON_EFFECT) end function s.gspconfilter(c,tp) return c:IsFaceup() and c:IsCode(CARD_YUBEL) and c:IsSummonPlayer(tp) end function s.gspcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.gspconfilter,1,nil,tp) end function s.gsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.gspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,1-tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase: You can return this face-up card to the hand. During the Damage Step, when your DARK monster battles an opponent's monster (Quick Effect): You can send this card from your hand to the GY; that opponent's monster loses ATK equal to its own ATK, until the end of this turn.
--ダーク・オネスト --Dark Honest --scripted by Rundas local s,id=GetID() function s.initial_effect(c) --Return to hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.rtg) e1:SetOperation(s.rop) c:RegisterEffect(e1) --ATK down local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetRange(LOCATION_HAND) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCondition(s.con) e2:SetCost(Cost.SelfToGrave) e2:SetOperation(s.aop) c:RegisterEffect(e2) end --Return to hand function s.rtg(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,LOCATION_MZONE) end function s.rop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end --ATK down function s.con(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() return d~=nil and d:IsFaceup() and ((a:IsControler(tp) and a:IsAttribute(ATTRIBUTE_DARK) and a:IsRelateToBattle()) or (d:IsControler(tp) and d:IsAttribute(ATTRIBUTE_DARK) and d:IsRelateToBattle())) end function s.aop(e,tp,eg,ep,ev,re,r,rp,chk) local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not a:IsRelateToBattle() or not d:IsRelateToBattle() then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetOwnerPlayer(tp) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) if a:IsControler(tp) then e1:SetValue(-d:GetAttack()) d:RegisterEffect(e1) else e1:SetValue(-a:GetAttack()) a:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can activate these effects depending on the monster card types on the field. ● Fusion: Once per turn, if a monster(s) is sent from your hand or field to the GY by a card effect (except during the Damage Step): You can draw 1 card. ● Synchro: When a monster(s) is Normal or Special Summoned (except during the Damage Step): You can increase their Levels by 1. ● Xyz: Once per turn, during your End Phase: Destroy the monster(s) on the field with the highest Level. You can only activate 1 "Dreamland" per turn.
--幻夢境 --Dreamland 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:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) --Draw 1 card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) --Increase the level of monsters by 1 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_LVCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetRange(LOCATION_FZONE) e3:SetTarget(s.lvtg) e3:SetOperation(s.lvop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) --Destroy the monster with the highest level local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_DESTROY) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetRange(LOCATION_FZONE) e5:SetCode(EVENT_PHASE+PHASE_END) e5:SetCountLimit(1) e5:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) e5:SetTarget(s.destg) e5:SetOperation(s.desop) c:RegisterEffect(e5) end function s.cfilter(c,type) return c:IsFaceup() and c:IsType(type) end function s.drcfilter(c,tp) return c:IsPreviousLocation(LOCATION_HAND|LOCATION_MZONE) and c:IsMonster() and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.drcfilter,1,nil,tp) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and e:GetHandler():IsRelateToEffect(e) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,TYPE_FUSION) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.lvfilter(c) return c:IsFaceup() and c:HasLevel() end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.lvfilter,1,nil) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,TYPE_SYNCHRO) end Duel.SetTargetCard(eg) Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.lvfilter,nil):Filter(Card.IsRelateToEffect,nil,e) if #g==0 then return end for tc in g:Iter() do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(1) tc:RegisterEffect(e1) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,TYPE_XYZ) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g==0 then return end local mg,lv=g:GetMaxGroup(Card.GetLevel) if lv==0 then return end Duel.SetOperationInfo(0,CATEGORY_DESTROY,mg,#mg,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g==0 then return end local mg,lv=g:GetMaxGroup(Card.GetLevel) if lv==0 then return end if #mg>0 then Duel.Destroy(mg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate 1 of these effects; ● Target 2 monsters you control (1 Union monster, and 1 appropriate monster for it to be equipped to); equip the first target to the second target. ● Target 1 equipped Union Monster Card in your Spell & Trap Zone; Special Summon it in Attack Position. * The above text is unofficial and describes the card's functionality in the OCG.
--フォーメーション・ユニオン --Formation Union local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_card_types={TYPE_UNION} function s.unioneqfilter(c,tp) return c:IsType(TYPE_UNION) and c:IsFaceup() and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_MZONE,0,1,c,c) end function s.eqfilter(c,ec) return ec:CheckUnionTarget(c) and aux.CheckUnionEquip(ec,c) and c:IsFaceup() end function s.spfilter(c,e,tp) return c:IsHasEffect(EFFECT_UNION_STATUS) and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_ATTACK) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return e:GetLabel()==2 and chkc:IsControler(tp) and chkc:IsLocation(LOCATION_STZONE) and s.spfilter(chkc,e,tp) end local b1=Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.unioneqfilter,tp,LOCATION_MZONE,0,1,nil,tp) local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_STZONE,0,1,nil,e,tp) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_EQUIP) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectTarget(tp,s.unioneqfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,ec,ec) e:SetLabelObject(ec) Duel.SetOperationInfo(0,CATEGORY_EQUIP,ec,1,tp,0) elseif op==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_STZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() if op==1 then --Equip 1 Union monster you control to 1 appropriate monster you control local ec=e:GetLabelObject() if not (ec:IsRelateToEffect(e) and ec:IsControler(tp)) then return end local tc=(Duel.GetTargetCards(e)-ec):GetFirst() if not (tc and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then Duel.SendtoGrave(ec,REASON_RULE,PLAYER_NONE,PLAYER_NONE) elseif aux.CheckUnionEquip(ec,tc) and Duel.Equip(tp,ec,tc) then aux.SetUnionState(ec) end elseif op==2 then --Special Summon 1 equipped Union Monster Card from your Spell & Trap Zone in Attack Position local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can only be Ritual Summoned with the Ritual Spell Card, "Javelin Beetle Pact".
--ジャベリンビートル --Javelin Beetle local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() end s.listed_names={41182875}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Mecha Phantom Beast" Tuner + 1+ non-Tuner "Mecha Phantom Beast" monsters When this card is Synchro Summoned: You can Tribute "Mecha Phantom Beast Tokens" up to the number of cards in your opponent's hand; randomly discard cards from your opponent's hand, equal to the number of Tributed monsters. Other "Mecha Phantom Beast" monsters you control cannot be destroyed by battle or card effects. If this card in its owner's possession is destroyed by your opponent: You can Set 1 Quick-Play Spell directly from your Deck.
--幻獣機ヤクルスラーン --Mecha Phantom Beast Jaculuslan local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_MECHA_PHANTOM_BEAST),1,1,Synchro.NonTunerEx(Card.IsSetCard,SET_MECHA_PHANTOM_BEAST),1,99) c:EnableReviveLimit() --handes local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.hdcon) e1:SetCost(s.hdcost) e1:SetTarget(s.hdtg) e1:SetOperation(s.hdop) c:RegisterEffect(e1) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_MZONE,0) e2:SetTarget(s.indtg) e2:SetValue(1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e3) --set local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(s.setcon) e4:SetTarget(s.settg) e4:SetOperation(s.setop) c:RegisterEffect(e4) end s.listed_series={SET_MECHA_PHANTOM_BEAST} s.listed_names={TOKEN_MECHA_PHANTOM_BEAST} function s.hdcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.hdcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsCode,1,false,nil,nil,TOKEN_MECHA_PHANTOM_BEAST) and Duel.GetFieldGroupCount(tp,0,LOCATION_HAND)>0 end local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_HAND) local g=Duel.SelectReleaseGroupCost(tp,Card.IsCode,1,ct,false,nil,nil,TOKEN_MECHA_PHANTOM_BEAST) e:SetLabel(#g) Duel.Release(g,REASON_COST) end function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,e:GetLabel()) end function s.hdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g>0 then local sg=g:RandomSelect(1-tp,e:GetLabel()) Duel.SendtoGrave(sg,REASON_DISCARD|REASON_EFFECT) end end function s.indtg(e,c) return c:IsSetCard(SET_MECHA_PHANTOM_BEAST) and c~=e:GetHandler() end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and e:GetHandler():IsPreviousControler(tp) end function s.filter(c) return c:IsQuickPlaySpell() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SSet(tp,g:GetFirst()) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 of your removed from play Rock-Type monsters, and Special Summon it. When this card is removed from the field, destroy that monster. When that monster is destroyed, destroy this card.
--化石岩の解放 --Release from Stone local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Destroy2 local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetCondition(s.descon2) e3:SetOperation(s.desop2) c:RegisterEffect(e3) end function s.filter(c,e,tp) return c:IsFaceup() and c:IsRace(RACE_ROCK) 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_REMOVED) 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_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then c:SetCardTarget(tc) end Duel.SpecialSummonComplete() end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end function s.descon2(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY) 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:
If you have 3 or more "Destiny HERO" monsters in your GY: You can discard this card, then target 1 "Destiny HERO" monster in your GY; Special Summon it to your opponent's field in Defense Position. When a Spell Card or effect you activate resolves, negate that effect, and if you do, or if it did not have an effect, destroy that card. During your Standby Phase: You can banish this card and 1 "Destiny HERO" monster from your GY; each player chooses 1 Normal Spell from their Deck, and places it on top of their Deck.
--D-HERO ダークエンジェル --Destiny HERO - Dark Angel 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetCost(Cost.SelfDiscard) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --disable and destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_MZONE) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetOperation(s.disop) c:RegisterEffect(e2) --deck top local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_GRAVE) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetCountLimit(1) e3:SetCondition(s.deckcon) e3:SetCost(s.deckcost) e3:SetTarget(s.decktg) e3:SetOperation(s.deckop) c:RegisterEffect(e3) end s.listed_series={SET_DESTINY_HERO} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,3,nil,SET_DESTINY_HERO) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_DESTINY_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,1-tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(1-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 and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if rp==tp and re:IsSpellEffect() then local rc=re:GetHandler() if Duel.NegateEffect(ev) and rc:IsRelateToEffect(re) then Duel.Destroy(rc,REASON_EFFECT) end end end function s.deckcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.cfilter(c) return c:IsSetCard(SET_DESTINY_HERO) and c:IsAbleToRemoveAsCost() end function s.deckcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,c) g:AddCard(c) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.filter(c) return c:IsNormalSpell() end function s.decktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_DECK)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end end function s.deckop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) local g1=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,1-tp,aux.Stringid(id,3)) local g2=Duel.SelectMatchingCard(1-tp,s.filter,1-tp,LOCATION_DECK,0,1,1,nil) local tc1=g1:GetFirst() local tc2=g2:GetFirst() if tc1 then Duel.ShuffleDeck(tp) Duel.MoveSequence(tc1,0) Duel.ConfirmDecktop(tp,1) end if tc2 then Duel.ShuffleDeck(1-tp) Duel.MoveSequence(tc2,0) Duel.ConfirmDecktop(1-tp,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Xyz Monsters with the same Rank, except "Number" monsters (This card's original Rank is always treated as 1. This card is always treated as a "Utopic Future" card.) You can also Xyz Summon this card by using "Number F0: Utopic Future" you control as material. (Transfer its materials to this card.) Cannot be destroyed by battle or card effects. Once per turn, when your opponent activates a monster effect (Quick Effect): You can detach 1 material from this card; negate the activation, then, if that monster is on the field, gain control of it.
--FNo.0 未来龍皇ホープ --Number F0: Utopic Draco Future --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Xyz summon procedure Xyz.AddProcedure(c,s.xyzfilter,nil,3,s.ovfilter,aux.Stringid(id,0),nil,nil,false,s.xyzcheck) --Must be properly summoned before reviving c:EnableReviveLimit() --Cannot be destroyed by battle or card effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e3) --Negate the activation of opponent's monster effect and take control of that monster local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_NEGATE+CATEGORY_CONTROL) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.discon) e4:SetCost(Cost.DetachFromSelf(1,1,nil)) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end s.listed_series={SET_NUMBER} s.xyz_number=0 s.listed_names={65305468} function s.ovfilter(c,tp,lc) return c:IsFaceup() and c:IsSummonCode(lc,SUMMON_TYPE_XYZ,tp,65305468) end function s.xyzfilter(c,xyz,sumtype,tp) return c:IsType(TYPE_XYZ,xyz,sumtype,tp) and not c:IsSetCard(SET_NUMBER) end function s.xyzcheck(g,tp,xyz) return g:GetClassCount(Card.GetRank)==1 end function s.discon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsMonsterEffect() and Duel.IsChainNegatable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local rc=re:GetHandler() if rc:IsOnField() and rc:IsRelateToEffect(re) and rc:IsAbleToChangeControler() then Duel.SetOperationInfo(0,CATEGORY_CONTROL,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if Duel.NegateActivation(ev) and rc:IsOnField() and rc:IsRelateToEffect(re) and rc:IsAbleToChangeControler() then Duel.BreakEffect() Duel.GetControl(rc,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "King's Sarcophagus" while in the Field Zone. During your Main Phase: You can add 1 "Horus" monster from your Deck to your hand, then place 1 card from your hand on the bottom of the Deck. You can only use this effect of "Walls of the Imperial Tomb" once per turn. If you activate the effect of "Horus the Black Flame Deity": You can draw 1 card.
--王墓の石壁 --Walls of the Imperial Tomb --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) --Name becomes "King's Sarcophagus" while in the Field Zone local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_CHANGE_CODE) e2:SetRange(LOCATION_FZONE) e2:SetValue(CARD_KING_SARCOPHAGUS) c:RegisterEffect(e2) --Search 1 "Horus" monster then place 1 card from your hand on the bottom of the Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,id) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --Draw 1 card local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_FZONE) e4:SetCondition(s.drcon) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end s.listed_names={CARD_KING_SARCOPHAGUS,99307040} --Horus the Black Flame Deity s.listed_series={SET_HORUS} function s.thfilter(c) return c:IsSetCard(SET_HORUS) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local hg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #hg==0 or Duel.SendtoHand(hg,nil,REASON_EFFECT)==0 then return end Duel.ConfirmCards(1-tp,hg) Duel.ShuffleHand(tp) Duel.ShuffleDeck(tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local dg=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil) if #dg>0 then Duel.BreakEffect() Duel.SendtoDeck(dg,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local code1,code2=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_CODE,CHAININFO_TRIGGERING_CODE2) return ep==tp and (code1==99307040 or code2==99307040) 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:
2 Level 8 monsters Once per turn, when your Normal Monster or "Magikey" monster destroys an opponent's monster by battle: You can detach 1 material from this card; inflict damage to your opponent equal to the destroyed monster's original ATK. Once per turn, during your opponent's Main Phase (Quick Effect): You can target 1 monster your opponent controls with the same Attribute as a Normal Monster or "Magikey" monster you control or is in your GY; detach 1 material from this card, and if you do, banish that monster.
--魔鍵憑神-アシュタルトゥ --Magikey Deity - Ashtartu --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon Procedure Xyz.AddProcedure(c,nil,8,2) --Inflict damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.damcon) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Detach 1 material and banish 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetCountLimit(1) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() end) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end s.listed_series={SET_MAGIKEY} function s.damcon(e,tp,eg,ep,ev,re,r,rp) local rc,bc=Duel.GetBattleMonster(tp) return rc and bc and bc:GetBaseAttack()>0 and (rc:IsType(TYPE_NORMAL) or rc:IsSetCard(SET_MAGIKEY)) and rc:IsControler(tp) and bc:IsPreviousControler(1-tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) local _,bc=Duel.GetBattleMonster(tp) local dam=bc:GetBaseAttack() if chk==0 then return dam>0 end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.attrfilter(c) return c:IsMonster() and (c:IsType(TYPE_NORMAL) or c:IsSetCard(SET_MAGIKEY)) and c:IsFaceup() end function s.rmfilter(c,ag) if not (c:IsFaceup() and c:IsAbleToRemove()) then return false end return ag:IsExists(Card.IsAttribute,1,nil,c:GetAttribute()) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ag=Duel.GetMatchingGroup(s.attrfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.rmfilter(chkc,ag) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,0,LOCATION_MZONE,1,nil,ag) and e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_EFFECT) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,0,LOCATION_MZONE,1,1,nil,ag) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and c:RemoveOverlayCard(tp,1,1,REASON_EFFECT)>0 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:
When this card destroys an opponent's monster by battle and sends it to the Graveyard, you can Tribute this card to return the destroyed card to the top of its owner's Deck.
--X-セイバー ウルズ --X-Saber Uruz local s,id=GetID() function s.initial_effect(c) --to deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCondition(s.tdcon) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) local t=e:GetHandler():GetBattleTarget() e:SetLabelObject(t) return aux.bdogcon(e,tp,eg,ep,ev,re,r,rp) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) local t=e:GetLabelObject() if chk==0 then return t:IsAbleToDeck() end t:CreateEffectRelation(e) Duel.SetOperationInfo(0,CATEGORY_TODECK,t,1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a Normal Monster: Target up to 3 of your banished Normal Monsters; shuffle them into the Deck.
--農園からの配送 --Farm Delivery --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.tdcon) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_NORMAL),tp,LOCATION_MZONE,0,1,nil) end function s.tdfilter(c) return c:IsType(TYPE_NORMAL) and c:IsFaceup() and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.tdfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local tg=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,tg,#tg,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 then return end Duel.SendtoDeck(tg,tp,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can add 1 "Gem-Knight" monster from your Deck to your hand.
--ジェムレシス --Gem-Armadillo local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GEM_KNIGHT} function s.filter(c) return c:IsSetCard(SET_GEM_KNIGHT) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All other monsters on the field lose 500 ATK. Once per turn, during your Main Phase: You can destroy all monsters on the field with less ATK than this card.
--猛虎モンフー --Fierce Tiger Monghu --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Decrease ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(function(e,c) return c~=e:GetHandler() end) e1:SetValue(-500) c:RegisterEffect(e1) --Destroy all monsters with less ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.desfilter(c,atk) return c:IsFaceup() and c:GetAttack()<atk end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,e:GetHandler():GetAttack()) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup()) then return end local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c:GetAttack()) if #g==0 then return end Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish any number of "Marincess" Link Monsters you control (until your next Standby Phase), then target 1 face-up monster on the field; it gains ATK equal to the total Link Rating of the monsters banished to activate this card x 300, until the end of this turn. If you control a Link-3 or higher "Marincess" monster, you can activate this card from your hand.
--海晶乙女瀑布 --Marincess Cascade --scripted by Larry126 and AlphaKretin local s,id=GetID() function s.initial_effect(c) --Increase the ATK 1 face-up monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(s.atkcost) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Can be activated from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRAP_ACT_IN_HAND) e2:SetCondition(s.actcon) c:RegisterEffect(e2) end s.listed_series={SET_MARINCESS} function s.cfilter(c,tp) return c:IsFaceup() and c:IsLinkMonster() and c:IsSetCard(SET_MARINCESS) and c:IsAbleToRemoveAsCost() and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,c) end function s.rescon(sg,e,tp,mg) return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,sg) end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,tp) end local ct=99 local tgct=Duel.GetTargetCount(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,nil) local mg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil,tp) if tgct==#mg then ct=#mg-1 end if ct==0 then ct=1 end local g=aux.SelectUnselectGroup(mg,e,tp,1,ct,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil) if Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_TEMPORARY)==#g then g:KeepAlive() e:SetLabelObject(g) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) if Duel.IsPhase(PHASE_STANDBY) then e1:SetLabel(Duel.GetTurnCount()) end e1:SetLabelObject(g) e1:SetCountLimit(1) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) if Duel.IsTurnPlayer(tp) and Duel.IsPhase(PHASE_STANDBY) then e1:SetReset(RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,2) else e1:SetReset(RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN) end Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) and Duel.GetTurnCount()~=e:GetLabel() end function s.retop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() for c in g:Iter() do Duel.ReturnToField(c) end g:DeleteGroup() end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACK) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,1,0,e:GetLabelObject():GetSum(Card.GetLink)*300) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabelObject():GetSum(Card.GetLink)*300) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.actfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MARINCESS) and c:IsLinkMonster() and c:IsLinkAbove(3) end function s.actcon(e) return Duel.IsExistingMatchingCard(s.actfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a card(s) on the field is destroyed by card effect, and "Visas Starfrost" is on the field (except during the Damage Step): You can Special Summon this card from your hand, then you can add 1 "Clear New World" from your Deck or GY to your hand. If another monster(s) in your possession is destroyed by card effect (except during the Damage Step): You can target 1 monster your opponent controls; destroy it, and if you do, this card gains ATK equal to that monster's original ATK, until the end of this turn. You can only use each effect of "Veda Kalanta" once per turn.
--ヴェーダ=カーランタ --Veda Kalanta --Scripted by Satella local s,id=GetID() function s.initial_effect(c) --Special Summon itself from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Destroy 1 monster your opponent controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_names={CARD_VISAS_STARFROST,21570001} --Clear New World function s.spconfilter(c) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_VISAS_STARFROST),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.thfilter(c) return c:IsCode(21570001) and c:IsAbleToHand() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.BreakEffect() Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end function s.cfilter(c,tp) return c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and (c:IsPreviousLocation(LOCATION_MZONE) or c:IsMonster()) and not c:IsPreviousLocation(LOCATION_SZONE) 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:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(tc:GetBaseAttack()) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If only this card is banished by the effect of a "Nordic" Link Monster: You can send to the GY, 1 "Nordic" monster you control and 2 "Nordic" monsters from your Deck, whose total Levels equal 10, then Special Summon 1 "Aesir" monster from your Extra Deck. If an "Aesir" monster(s) in your possession is sent to your GY by your opponent, except by battle: You can banish this card from your GY; Special Summon 1 "Aesir" monster from your Extra Deck, with a different name from the cards in your GY. You can only use this effect of "Alviss of the Nordic Alfar" once per Duel. * The above text is unofficial and describes the card's functionality in the OCG.
--極星霊アルヴィース --Alviss of the Nordic Alfar --Scripted by ahtelel and Eerie Code 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+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_REMOVE) e1:SetRange(LOCATION_REMOVED) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Special Summon when an "Aesir" leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_DUEL) e2:SetCondition(s.spcon2) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) end s.listed_series={SET_NORDIC,SET_AESIR} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return #eg==1 and eg:IsContains(e:GetHandler()) and r&REASON_EFFECT>0 and re and re:IsActiveType(TYPE_LINK) and re:GetHandler():IsSetCard(SET_NORDIC) end function s.matfilter(c) return c:IsSetCard(SET_NORDIC) and c:IsMonster() and (c:IsFaceup() or c:IsLocation(LOCATION_DECK)) and c:IsLevelAbove(1) end function s.spcheck(sg,e,tp,mg) return #sg==3 and sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)==2 and sg:GetSum(Card.GetLevel)==10 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg) end function s.spfilter(c,e,tp,mg) return c:IsSetCard(SET_AESIR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (not mg or Duel.GetLocationCountFromEx(tp,tp,mg,c)>0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local g=Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_DECK|LOCATION_MZONE,0,nil) return aux.SelectUnselectGroup(g,e,tp,3,3,s.spcheck,0) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,3,tp,LOCATION_DECK|LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_DECK|LOCATION_MZONE,0,nil) local rg=aux.SelectUnselectGroup(g,e,tp,3,3,s.spcheck,1,tp,HINTMSG_TOGRAVE) if #rg==3 and Duel.SendtoGrave(rg,REASON_EFFECT)==3 then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end function s.cfilter(c,tp) return c:IsPreviousSetCard(SET_AESIR) and c:IsSetCard(SET_AESIR) and c:IsPreviousControler(tp) end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and eg:IsExists(s.cfilter,1,nil,tp) end function s.spfilter2(c,e,tp,rp) return c:IsSetCard(SET_AESIR) and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,c:GetCode()) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,rp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rp) 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 in your hand: You can return 1 "Starry Knight" monster or 1 Level 7 LIGHT Dragon monster you control to the hand, except "Starry Knight Ciel"; Special Summon this card. If you control no monsters: You can banish this card from your GY; Special Summon 1 Level 7 LIGHT Dragon monster from your hand. You can only use each effect of "Starry Knight Ciel" once per turn.
--ホーリーナイツ・シエル --Starry Knight Ciel --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spselfcost) e1:SetTarget(s.spselftg) e1:SetOperation(s.spselfop) c:RegisterEffect(e1) --Special Summon 1 LIGHT Level 7 Dragon monster 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_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_STARRY_KNIGHT} function s.ldlv7filter(c) return c:IsLevel(7) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) end function s.spcfilter(c,tp) return (s.ldlv7filter(c) or c:IsSetCard(SET_STARRY_KNIGHT)) and c:IsFaceup() and c:IsAbleToHandAsCost() and not c:IsCode(id) and Duel.GetMZoneCount(tp,c)>0 end function s.spselfcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SendtoHand(g,nil,REASON_COST) end function s.spselftg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spselfop(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.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.spfilter(c,e,tp) return s.ldlv7filter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Inflict 200 damage to your opponent for each card in their hand and for each card they control.
--仕込みマシンガン --Secret Barrel local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,0,LOCATION_HAND|LOCATION_ONFIELD,1,nil) end Duel.SetTargetPlayer(1-tp) local dam=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND|LOCATION_ONFIELD,0)*200 Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local dam=Duel.GetFieldGroupCount(1-tp,LOCATION_HAND|LOCATION_ONFIELD,0)*200 Duel.Damage(p,dam,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can activate this card when an opponent's monster declares a direct attack. When this card's activation resolves, negate the attack, then Special Summon this card as an Effect Monster (Fiend/LIGHT/Level 1/ATK 0/DEF 0). (This card is also still a Trap Card.) During your Standby Phase, while this card is treated as a monster: You can banish any number of "Utopia" monsters with different names from your GY; inflict 500 damage to your opponent for each of those banished monsters, and if you do, this card gains ATK equal to the damage they took. * The above text is unofficial and describes the card's functionality in the OCG.
--運命の扉 --The Door of Destiny local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_UTOPIA} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==nil end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,0,1,RACE_FIEND,ATTRIBUTE_LIGHT) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not Duel.NegateAttack() then return end Duel.BreakEffect() if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local c=e:GetHandler() if not c:IsRelateToEffect(e) or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_MONSTER|TYPE_EFFECT,0,0,1,RACE_FIEND,ATTRIBUTE_LIGHT) then return end c:AddMonsterAttribute(TYPE_EFFECT+TYPE_TRAP) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCondition(s.damcon) e1:SetCost(s.damcost) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) Duel.SpecialSummonComplete() end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.cfilter(c) return c:IsSetCard(SET_UTOPIA) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.damcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,e:GetHandler()) end local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,e:GetHandler()) local rg=Group.CreateGroup() repeat Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local sg=g:Select(tp,1,1,nil) g:Remove(Card.IsCode,nil,sg:GetFirst():GetCode()) rg:Merge(sg) until #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) local ct=Duel.Remove(rg,POS_FACEUP,REASON_COST) e:SetLabel(ct) 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(e:GetLabel()*500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,e:GetLabel()*500) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) local val=Duel.Damage(p,d,REASON_EFFECT) 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(val) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up Xyz Monster on the field; attach this card to it as material.
--オーバーレイ・リジェネレート --Overlay Regen local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsImmuneToEffect(e) and c:IsRelateToEffect(e) then c:CancelToGrave() Duel.Overlay(tc,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Level 6 monsters Once per turn: You can detach 2 materials from this card, then target 1 face-up card your opponent controls and 1 card in either GY; banish them. If this Xyz Summoned card is destroyed by battle with an opponent's attacking monster, or by an opponent's card effect while in its owner's Monster Zone: You can Special Summon 2 "Virtual World" monsters with the same Type and Attribute as each other from your Deck. You can only use this effect of "Virtual World Phoenix - Fanfan" once per turn.
--電脳堺凰-凰々 --Virtual World Phoenix - Fanfan --Scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,nil,6,2,nil,nil,Xyz.InfiniteMats) --Banish 2 targets local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(2)) e1:SetTarget(s.rmvtg) e1:SetOperation(s.rmvop) c:RegisterEffect(e1) --Special Summon 2 "Datascape" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_VIRTUAL_WORLD} function s.rmvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_ONFIELD,1,nil) and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g1=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_ONFIELD,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g1,2,0,LOCATION_ONFIELD|LOCATION_GRAVE) end function s.rmvop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if tg and #tg>0 then Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and (c:IsReason(REASON_EFFECT) or (c:IsReason(REASON_BATTLE) and Duel.GetAttacker():IsControler(1-tp))) and c:IsXyzSummoned() and rp==1-tp end function s.spfilter(c,e,tp) return c:IsSetCard(SET_VIRTUAL_WORLD) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetRace)==1 and sg:GetClassCount(Card.GetAttribute)==1 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return false end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return false end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK,0,nil,e,tp) local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_SPSUMMON) if sg and #sg==2 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you have 5 or more cards in your hand, you can Normal Summon this card without Tributing. When this card is destroyed by battle and sent to the GY: You can Special Summon this card in Defense Position, and if you do, it is treated as a Tuner. You can only use this effect of "Wicked Acolyte Chilam Sabak" once per turn.
--邪神官チラム・サバク --Wicked Acolyte Chilam Sabak 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:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCondition(s.sumcon) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_BATTLE_DESTROYED) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.sumcon(e,c,minc) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_HAND,0)>=5 end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) 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) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_ADD_TYPE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(TYPE_TUNER) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per Chain, if a Link-4 monster is Link Summoned: You can place 1 counter on this card (max. 3), then you can apply the following effect based on the number of counters on it. ● 1: Declare 1 card name, and if you do, the activated effects and effects on the field of cards with that original name, are negated this turn. ● 2: Special Summon 1 Level 4 or lower monster from your GY. ● 3: Send this card to the GY, and if you do, Special Summon 1 Link-4 monster from your Extra Deck. You can only activate 1 "Forge a New Future" per turn.
--運命の囚人 --Forge a New Future --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Allow counter placement and limit it to 3 c:EnableCounterPermit(0x20b) c:SetCounterLimit(0x20b,3) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) e0:SetHintTiming(TIMING_SPSUMMON) e0:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e0) --Place counter and apply effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COUNTER+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.ctcon) e1:SetTarget(s.cttg) e1:SetOperation(s.ctop) c:RegisterEffect(e1) end s.counter_place_list={0x20b} function s.ctconfilter(c) return c:IsType(TYPE_LINK) and c:IsLinkSummoned() and c:IsLink(4) end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.ctconfilter,1,nil) end function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanAddCounter(0x20b,1) and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_CHAIN,0,1) Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,1,0,0x20b) Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,e:GetHandler(),1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_EXTRA) end function s.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsRelateToEffect(e) and c:IsFaceup() and c:AddCounter(0x20b,1)) then return end local ct=c:GetCounter(0x20b) --Declare card name and negate effects if ct==1 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CODE) local ac=Duel.AnnounceCard(tp) Duel.BreakEffect() --Negate effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE) e1:SetTargetRange(LOCATION_ONFIELD,LOCATION_ONFIELD) e1:SetTarget(s.distg) e1:SetLabel(ac) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetCondition(s.discon) e2:SetOperation(s.disop) e2:SetLabel(ac) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) local e3=e1:Clone() e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) Duel.RegisterEffect(e3,tp) --Special Summon from the GY elseif ct==2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spgyfilter),tp,LOCATION_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.spgyfilter),tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g==0 then return end Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) --Send self to the GY and Special Summon a Link monster elseif ct==3 and c:IsAbleToGrave() and Duel.GetLocationCountFromEx(tp)>0 and Duel.IsExistingMatchingCard(s.spexfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() if Duel.SendtoGrave(c,REASON_EFFECT)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spexfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g==0 then return end Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.distg(e,c) local code=e:GetLabel() local code1,code2=c:GetOriginalCodeRule() return code1==code or code2==code end function s.discon(e,tp,eg,ep,ev,re,r,rp) local code=e:GetLabel() local code1,code2=re:GetHandler():GetOriginalCodeRule() return code1==code or code2==code end function s.disop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.NegateEffect(ev) end function s.spgyfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spexfilter(c,e,tp) return c:IsLink(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, you can Special Summon this card (from your hand). This card can be treated as 2 Tributes for the Tribute Summon of a "Timelord" monster. You can Tribute this card; add 1 "Timelord" monster with 0 ATK from your Deck to your hand. You can banish this card from your GY; Special Summon 1 "Timelord" monster with 0 ATK from your Deck, ignoring its Summoning conditions. You cannot Special Summon other monsters during the turn you activate this effect.
--時械巫女 --Time Maiden local s,id=GetID() function s.initial_effect(c) --special summon rule 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.sprcon) c:RegisterEffect(e1) --double tribute local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DOUBLE_TRIBUTE) e2:SetValue(s.dtcon) c:RegisterEffect(e2) --search local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCost(Cost.SelfTribute) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) --special summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_GRAVE) e4:SetCost(s.spcost) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end s.listed_series={SET_TIMELORD} function s.sprcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end function s.dtcon(e,c) return c:IsSetCard(SET_TIMELORD) end function s.thfilter(c) return c:IsSetCard(SET_TIMELORD) and c:IsMonster() and c:GetAttack()==0 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.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.GetActivityCount(tp,ACTIVITY_SPSUMMON)==0 end Duel.Remove(c,POS_FACEUP,REASON_COST) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetLabelObject(e) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return se~=e:GetLabelObject() end function s.spfilter(c,e,tp) return c:IsSetCard(SET_TIMELORD) and c:IsMonster() and c:GetAttack()==0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Randomly select 2 cards from your hand and remove them from play to inflict 800 points of Direct Damage to your opponent's Life Points.
--ファイヤーソーサラー --Fire Sorcerer local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,2,nil) end local g=Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_HAND,0,nil) local rg=g:RandomSelect(tp,2) Duel.Remove(rg,POS_FACEUP,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(800) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is added to your hand, except by drawing it: You can Special Summon it. If this card is Normal or Special Summoned: You can target 1 "Altergeist" monster in your GY, except "Altergeist Malwisp"; Special Summon it in Defense Position, but for the rest of this turn, it cannot activate its effects. You can only use each effect of "Altergeist Malwisp" once per turn.
--オルターガイスト・マルウィスプ --Altergeist Malwisp --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself when added to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_HAND) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return not e:GetHandler():IsReason(REASON_DRAW) end) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Special Summon 1 "Altergeist" monst from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_series={SET_ALTERGEIST} s.listed_names={id} function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ALTERGEIST) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return 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 tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then --Cannot activate its effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3302) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand or GY) by banishing 3 Insect and/or Plant monsters from your hand and/or GY. You can only Special Summon "Beargram, Shelled Emperor of the Forest Crown" once per turn. Your opponent cannot activate monster effects in response to your Spell/Trap Card or effect activation. Once per turn, during your Main Phase: You can destroy all face-up monsters on the field, except Insect and Plant monsters, also this card cannot attack directly for the rest of this turn.
--樹冠の甲帝ベアグラム --Beargram, Shelled Emperor of the Forest Crown --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableUnsummonable() --Can only be Special Summoned once per turn c:SetSPSummonOnce(id) --Must be Special Summoned by its own procedure local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.FALSE) c:RegisterEffect(e1) --Special Summon procedure local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetCode(EFFECT_SPSUMMON_PROC) e2:SetRange(LOCATION_HAND|LOCATION_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Prevent response to the activation of your Spell/Traps local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetOperation(s.chainop) c:RegisterEffect(e3) --Destroy non-Plant/Insect monsters local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end function s.costfilter(c) return c:IsRace(RACE_PLANT|RACE_INSECT) and c:IsAbleToRemoveAsCost() and (c:IsLocation(LOCATION_HAND) or aux.SpElimFilter(c,true,true)) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local c=e:GetHandler() local g=nil local rg1=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,c) local rg2=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_GRAVE|LOCATION_HAND,0,c) local rg=Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and rg1 or rg2 return aux.SelectUnselectGroup(rg,e,tp,3,3,aux.ChkfMMZ(1),0) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() local rg1=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_MZONE|LOCATION_HAND,0,c) local rg2=Duel.GetMatchingGroup(s.costfilter,tp,LOCATION_GRAVE|LOCATION_HAND,0,c) local rg=Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and rg1 or rg2 local g=aux.SelectUnselectGroup(rg,e,tp,3,3,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.Remove(g,POS_FACEUP,REASON_COST) g:DeleteGroup() end function s.chainop(e,tp,eg,ep,ev,re,r,rp) if re:IsSpellTrapEffect() and re:GetOwnerPlayer()==tp then Duel.SetChainLimit(s.chainlm) end end function s.chainlm(e,ep,tp) return ep==tp or not e:IsMonsterEffect() end function s.desfilter(c) return c:IsFaceup() and not c:IsRace(RACE_PLANT|RACE_INSECT) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then --Cannot attack directly this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3207) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Big Koala" + "Des Kangaroo"
--マスター・オブ・OZ --Master of Oz local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,42129512,78613627) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be destroyed by battle. If this card is targeted for an attack: This card gains 1000 ATK and DEF. If this card attacked, after damage calculation: The ATK and DEF gained from this effect returns to 0.
--ダイナソーイング --Dino-Sewing local s,id=GetID() function s.initial_effect(c) --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --atk/def up local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetOperation(s.operation) c:RegisterEffect(e2) --atk clear local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_BATTLED) e3:SetCondition(s.retcon) e3:SetOperation(s.retop) c:RegisterEffect(e3) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker()==e:GetHandler() end function s.retop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():ResetEffect(RESET_DISABLE,RESET_EVENT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon this card as an Effect Monster (Machine/EARTH/Level 4/ATK 0/DEF 2000) with the following effects (this card is also still a Trap). ● Gains 1000 ATK for each "Shining Sarcophagus", and monster that mentions it, that you control. ● Once per turn, when an opponent's monster declares an attack, while you control "Shining Sarcophagus": You can destroy that monster.
--隠し砦 ストロング・ホールド --Stronghold the Hidden Fortress --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_BATTLE_START|TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_SHINING_SARCOPHAGUS} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_EFFECT|TYPE_MONSTER,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,TYPE_EFFECT|TYPE_MONSTER,0,2000,4,RACE_MACHINE,ATTRIBUTE_EARTH) then return end c:AddMonsterAttribute(TYPE_EFFECT|TYPE_TRAP) Duel.SpecialSummonStep(c,0,tp,tp,true,false,POS_FACEUP) c:AddMonsterAttributeComplete() --Gains 1000 ATK for each card you control that is "Shining Sarcophagus" or a monster that mentions it local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1,true) --Destroy an opponent's attacking monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2,true) Duel.SpecialSummonComplete() end function s.atkfilter(c) return c:IsFaceup() and (c:IsCode(CARD_SHINING_SARCOPHAGUS) or (c:IsMonster() and c:ListsCode(CARD_SHINING_SARCOPHAGUS))) end function s.atkval(e,c) return Duel.GetFieldGroup(e:GetHandlerPlayer(),LOCATION_ONFIELD,0):FilterCount(s.atkfilter,nil)*1000 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_SHINING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local at=Duel.GetAttacker() if chk==0 then return at:IsRelateToBattle() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,at,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttacker() if at:IsRelateToBattle() then Duel.Destroy(at,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Banish as many "Appliancer" Link Monsters from your Main Monster Zone as possible, then you can Special Summon your banished "Appliancer" Link Monsters up to the number banished by this effect. During your Main Phase, if this card is in your GY, except the turn it was sent there: You can banish 1 other "Appliancer" Spell/Trap from your GY; add this card to your hand. You can only use each effect of "Appliancer Conversion" once per turn.
--機塊コンバート --Appliancer Conversion --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_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Return to 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) e1:SetCountLimit(1,{id,1}) e2:SetCondition(aux.exccon) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_APPLIANCER} function s.rmfilter(c) return c:IsType(TYPE_LINK) and c:IsAbleToRemove() and c:IsSetCard(SET_APPLIANCER) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MMZONE,0,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,LOCATION_MZONE) end function s.spfilter(c,e,tp) return c:IsType(TYPE_LINK) and c:IsSetCard(SET_APPLIANCER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) local rg=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MMZONE,0,nil) if #rg==0 or Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)==0 then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end local og=Duel.GetOperatedGroup():Match(Card.IsLocation,nil,LOCATION_REMOVED) if #og==0 then return end local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_REMOVED,0,nil,e,tp) if #sg==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end ft=math.min(ft,#og,#sg) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=sg:Select(tp,1,ft,nil) if #g==0 then return end Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end function s.cfilter(c,tp) return c:IsSetCard(SET_APPLIANCER) and c:IsAbleToRemoveAsCost() and c:IsSpellTrap() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,c,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,c,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,LOCATION_GRAVE) 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 then Duel.ConfirmCards(1-tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Ghostrick" Field Spell or a "Ghostrick" Link Monster: You can target 1 face-up monster your opponent controls; your opponent can pay 2000 LP to make this card's effect "Set this card instead of sending it to the GY after activation", otherwise, for the rest of this turn, that face-up monster cannot attack, its effects are negated, also it is changed to face-down Defense Position during the End Phase. You can only activate 1 "Ghostrick or Treat" per turn.
--ゴーストリック・オア・トリート --Ghostrick or Treat --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:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GHOSTRICK} function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_GHOSTRICK) and (c:IsLinkMonster() or c:IsFieldSpell()) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_ONFIELD,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not (tc:IsFaceup() and tc:IsRelateToEffect(e)) then return end if Duel.CheckLPCost(1-tp,2000) and c:IsSSetable(true) and e:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.SelectYesNo(1-tp,aux.Stringid(id,1)) then Duel.PayLPCost(1-tp,2000) c:CancelToGrave() Duel.ChangePosition(c,POS_FACEDOWN) Duel.RaiseEvent(c,EVENT_SSET,e,REASON_EFFECT,tp,tp,0) else Duel.NegateRelatedChain(tc,RESET_TURN_SET) --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) --Cannot attack local e3=Effect.CreateEffect(c) e3:SetDescription(3206) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_ATTACK) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) if not tc:IsImmuneToEffect(e) then --Change Position during the End Phase local fid=c:GetFieldID() tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1,fid) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetCountLimit(1) e4:SetLabel(fid) e4:SetLabelObject(tc) e4:SetCondition(s.flipcon) e4:SetOperation(s.flipop) Duel.RegisterEffect(e4,tp) end end end function s.flipcon(e,tp,eg,ep,ev,re,r,rp) if e:GetLabelObject():GetFlagEffectLabel(id)~=e:GetLabel() then e:Reset() return false else return true end end function s.flipop(e,tp,eg,ep,ev,re,r,rp) Duel.ChangePosition(e:GetLabelObject(),POS_FACEDOWN_DEFENSE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay half your Life Points; Special Summon as many of your banished monsters as possible. During the End Phase, banish all monsters that were Special Summoned by this effect.
--異次元からの帰還 --Return from the Different Dimension local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.filter(c,e,tp) return c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.PayLPCost(tp,math.floor(Duel.GetLP(tp)/2)) end function s.tg(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_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) end function s.op(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_REMOVED,0,ft,ft,nil,e,tp) if #g>0 then local fid=e:GetHandler():GetFieldID() local tc=g:GetFirst() for tc in aux.Next(g) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1,fid) end Duel.SpecialSummonComplete() g:KeepAlive() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(g) e1:SetCondition(s.rmcon) e1:SetOperation(s.rmop) Duel.RegisterEffect(e1,tp) end end function s.rmfilter(c,fid) return c:GetFlagEffectLabel(id)==fid end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() if not g:IsExists(s.rmfilter,1,nil,e:GetLabel()) then g:DeleteGroup() e:Reset() return false else return true end end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local tg=g:Filter(s.rmfilter,nil,e:GetLabel()) Duel.Remove(tg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 face-up "Six Samurai" monster you control to the Graveyard, then target 1 "Six Samurai" monster in either player's Graveyard; Special Summon that target.
--六武衆の理 --Cunning of the Six Samurai 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:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SIX_SAMURAI} function s.costfilter(c,ft) return c:IsFaceup() and c:IsSetCard(SET_SIX_SAMURAI) and c:IsAbleToGraveAsCost() and (ft>0 or c:GetSequence()<5) end function s.cost(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.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE,0,1,nil,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE,0,1,1,nil,ft) Duel.SendtoGrave(g,REASON_COST) end function s.filter(c,e,tp) return c:IsSetCard(SET_SIX_SAMURAI) 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 s.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,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:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters in the Extra Monster Zone, while this card is in your hand or GY: You can Special Summon this card, but banish it when it leaves the field, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Cyberse monsters. You can only use this effect of "Mathmech Sigma" once per turn. If this card you control is used as Synchro Material for a "Mathmech" monster, you can treat it as a non-Tuner.
--斬機シグマ --Mathmech Sigma --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special summon itself from hand or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Can be treated as a non-tuner local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_NONTUNER) e2:SetValue(function(e,sc) return sc:IsSetCard(SET_MATHMECH) end) c:RegisterEffect(e2) end s.listed_series={SET_MATHMECH} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_EMZONE,0)==0 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() --Cannot Special Summon from Extra Deck, except Cyberse local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetTarget(function(_,_c) return _c:IsLocation(LOCATION_EXTRA) and not _c:IsRace(RACE_CYBERSE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(_,_c) return not _c:IsOriginalRace(RACE_CYBERSE) end) if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it if it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(3300) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e2:SetReset(RESET_EVENT|RESETS_REDIRECT) e2:SetValue(LOCATION_REMOVED) c:RegisterEffect(e2,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Medius the Pure" + 1 "Artmage" monster You can target 1 monster on the field; change its battle position. When your opponent activates a card or effect on the field, if you have 3 or more different Monster Types on your field (Quick Effect): You can negate the activation, and if you do, destroy that card. If this Fusion Summoned card is destroyed: You can Special Summon 1 "Medius the Pure" from your hand, Deck, or banishment. You can only use each effect of "Artmage Diactorus" once per turn.
--神芸獄徒 ディアクトロス --Artmage Diactorus --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Fusion Materials: 1 "Medius the Pure" + 1 "Artmage" monster Fusion.AddProcMix(c,true,true,CARD_MEDIUS_THE_PURE,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_ARTMAGE)) --Change the battle position of 1 monster on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,{id,0}) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) --Negate the activation of an opponent's card or effect on the field, and if you do, destroy that card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.negcon) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Special Summon 1 "Medius the Pure" from your hand, Deck, or banishment local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={CARD_MEDIUS_THE_PURE} s.listed_series={SET_ARTMAGE} function s.postg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsCanChangePosition() end if chk==0 then return Duel.IsExistingTarget(Card.IsCanChangePosition,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,Card.IsCanChangePosition,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK) end end function s.negcon(e,tp,eg,ep,ev,re,r,rp) local loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) return rp==1-tp and loc&LOCATION_ONFIELD>0 and Duel.IsChainNegatable(ev) and Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil):GetClassCount(Card.GetRace)>=3 end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFusionSummoned() end function s.spfilter(c,e,tp) return c:IsCode(CARD_MEDIUS_THE_PURE) and (not c:IsLocation(LOCATION_REMOVED) or c:IsFaceup()) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_REMOVED) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|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:
FLIP: You can Special Summon 1 Level 5 or higher Tuner monster from your Deck.
--ぴよコッコ --Cheepcheepcheep local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return 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.filter(c,e,tp) return c:IsLevelAbove(5) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil,e,tp) if #g>0 then 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a face-up "Elemental HERO Burstinatrix": Return all face-up "Elemental HERO" monsters on the field to the hand, except "Elemental HERO Burstinatrix".
--バースト・リターン --Burst Return local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_ELEMENTAL_HERO} s.listed_names={58932615} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,58932615),tp,LOCATION_ONFIELD,0,1,nil) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_ELEMENTAL_HERO) and not c:IsCode(58932615) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SendtoHand(g,nil,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Stardust" monster in your GY; Special Summon it.
--星屑の残光 --Stardust Flash 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_STARDUST} function s.filter(c,e,tp) return c:IsSetCard(SET_STARDUST) 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) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand or GY: You can Tribute 2 monsters; Special Summon this card. You can only use this effect of "Nine-Tailed Fox" once per turn. If this card that was Special Summoned from the GY attacks a Defense Position monster, inflict piercing battle damage. If this card is destroyed by battle or card effect and sent to the GY: You can Special Summon 2 "Fox Tokens" (Zombie/FIRE/Level 2/ATK 500/DEF 500).
--九尾の狐 --Nine-Tailed Fox local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_GRAVE|LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --pierce local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_PIERCE) e2:SetCondition(s.pcon) c:RegisterEffect(e2) --token local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_names={27198002} function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,2,false,aux.ReleaseCheckMMZ,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,2,2,false,aux.ReleaseCheckMMZ,nil) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return 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) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.pcon(e) return e:GetHandler():GetPreviousLocation()==LOCATION_GRAVE end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,500,500,2,RACE_ZOMBIE,ATTRIBUTE_FIRE)end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end if ft<2 then return end if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,500,500,2,RACE_ZOMBIE,ATTRIBUTE_FIRE) then return end for i=1,2 do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase, if your opponent Normal or Special Summoned 5 or more monsters this turn (Quick Effect): You can Tribute as many face-up monsters on the field as possible, and if you do, Special Summon this card from your hand, then Special Summon 1 "Primal Being Token" (Rock/LIGHT/Level 11/ATK ?/DEF ?) to your opponent's field. (This Token's ATK/DEF become the combined original ATK/DEF of the Tributed monsters.) You can only use this effect of "Nibiru, the Primal Being" once per turn.
--原始生命態ニビル --Nibiru, the Primal Being --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Tribute all monsters, Special Summon this card from the hand and 1 "Primal Being Token" local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND) e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_SUMMON|TIMING_SPSUMMON) e1:SetCountLimit(1,id) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Count summons 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) local ge2=ge1:Clone() ge2:SetCode(EVENT_SUMMON_SUCCESS) Duel.RegisterEffect(ge2,0) end) end s.listed_names={27204312} function s.checkop(e,tp,eg,ep,ev,re,r,rp) local tc=eg:GetFirst() for tc in aux.Next(eg) do Duel.RegisterFlagEffect(tc:GetSummonPlayer(),id,RESET_PHASE|PHASE_END,0,1) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(1-tp,id)>=5 and Duel.IsMainPhase() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsReleasableByEffect),tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return #g>0 and Duel.GetMZoneCount(tp,g,tp)>0 and Duel.GetMZoneCount(1-tp,g,tp)>0 and Duel.IsPlayerCanSpecialSummonCount(tp,2) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,g:GetSum(Card.GetBaseAttack),g:GetSum(Card.GetBaseDefense),11,RACE_ROCK,ATTRIBUTE_LIGHT,POS_FACEUP,1-tp) end Duel.SetOperationInfo(0,CATEGORY_RELEASE,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) end function s.operationvalueatk(c) return math.max(c:GetBaseAttack(),0) end function s.operationvaluedef(c) return math.max(c:GetBaseDefense(),0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsReleasableByEffect),tp,LOCATION_MZONE,LOCATION_MZONE,nil) if Duel.Release(g,REASON_EFFECT)==0 then return end if not c:IsRelateToEffect(e) then return end local og=Duel.GetOperatedGroup() if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetMZoneCount(1-tp,nil,tp)>0 then local atk=og:GetSum(s.operationvalueatk) local def=og:GetSum(s.operationvaluedef) if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,atk,def,11,RACE_ROCK,ATTRIBUTE_LIGHT,POS_FACEUP,1-tp) then return end Duel.BreakEffect() local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_SET_DEFENSE) e2:SetValue(def) e2:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e2) Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send 1 "Steelswarm" monster from your Deck to the Graveyard to target 1 face-up "Steelswarm" monster you control; it gains 800 ATK until the End Phase.
--侵略の手段 --Infestation Tool local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_STEELSWARM} function s.cfilter(c) return c:IsSetCard(SET_STEELSWARM) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_DECK,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_STEELSWARM) 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.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(800) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can add 1 Level 4 LIGHT Thunder-Type monster from your Deck to your hand, except "Brohunder".
--ONiサンダー --Brohunder local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_names={id} function s.thfilter(c) return c:IsRace(RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==4 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:
2 Level 1 monsters Unaffected by other cards' effects. Once per turn (Quick Effect): You can detach 2 materials from this card; for the rest of this turn, this card cannot be destroyed by battle, also you take no battle damage from attacks involving this card.
--キキナガシ風鳥 --Kikinagashi Fucho local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Xyz summon procedure Xyz.AddProcedure(c,nil,1,2) --Unaffected by other card effects 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:SetValue(s.efilter) c:RegisterEffect(e1) --Make itself unable to be destroyed by battle, also take no battle damage involving this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(2)) e2:SetOperation(s.indop) e2:SetHintTiming(0,TIMING_BATTLE_START) c:RegisterEffect(e2) end function s.efilter(e,te) return te:GetOwner()~=e:GetOwner() end function s.indop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then --Cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetDescription(3000) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) --Take no battle damage involving this card local e2=e1:Clone() e2:SetDescription(3210) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) c:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up monster on the field; until the end of this turn, that target loses 800 ATK, but is unaffected by the effects of other Spells/Traps.
--禁じられた聖槍 --Forbidden Lance local s,id=GetID() function s.initial_effect(c) --Targeted monster becomes unaffected by spells/traps local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Loses 800 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(-800) tc:RegisterEffect(e1) --Unaffected by spells/traps local e2=Effect.CreateEffect(c) e2:SetDescription(3104) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_IMMUNE_EFFECT) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetValue(s.efilter) tc:RegisterEffect(e2) end end function s.efilter(e,te) return te:IsSpellTrapEffect() and te:GetOwner()~=e:GetOwner() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an attack is declared involving this card and an opponent's monster: You can place this card from the field, and that opponent's monster, face-up in their owners' Spell & Trap Zones as Continuous Spells. While this card is a Continuous Spell: You can target 1 FIRE monster in your GY, except "Snake-Eyes Diabellstar"; place it face-up in its owner's Spell & Trap Zone as a Continuous Spell, and if you do, Special Summon this card. You can only use each effect of "Snake-Eyes Diabellstar" once per turn.
--蛇眼の大炎魔 --Snake-Eyes Diabellstar --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Place battling monsters in the Spell/Trap Zone as Continuous Spells 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,id) e1:SetCondition(s.btplcon) e1:SetOperation(s.btplop) c:RegisterEffect(e1) --Place 1 monster from the GY in the Spell/Trap Zone as a Continuous Spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LEAVE_GRAVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e) return e:GetHandler():IsContinuousSpell() end) e2:SetTarget(s.gypltg) e2:SetOperation(s.gyplop) c:RegisterEffect(e2) end s.listed_names={id} function s.checkzones(c0,c1) local p0,p1=c0:GetOwner(),c1:GetOwner() if p0==p1 then return Duel.GetLocationCount(p0,LOCATION_SZONE)>1 end return Duel.GetLocationCount(p0,LOCATION_SZONE)>0 and Duel.GetLocationCount(p1,LOCATION_SZONE)>0 end function s.btplcon(e,tp,eg,ep,ev,re,r,rp) local bc0,bc1=Duel.GetBattleMonster(tp) return bc0 and bc1 and bc0==e:GetHandler() and s.checkzones(bc0,bc1) end function s.stplace(c,tp,rc) if not Duel.MoveToField(c,tp,c:GetOwner(),LOCATION_SZONE,POS_FACEUP,c:IsMonsterCard()) then return end --Treated as a Continuous Spell local e1=Effect.CreateEffect(rc) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_CHANGE_TYPE) e1:SetValue(TYPE_SPELL|TYPE_CONTINUOUS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)) c:RegisterEffect(e1) return true end function s.btplop(e,tp,eg,ep,ev,re,r,rp) local bc0,bc1=Duel.GetBattleMonster(tp) if bc0 and bc1 and bc0:IsRelateToBattle() and not bc0:IsImmuneToEffect(e) and bc1:IsRelateToBattle() and not bc1:IsImmuneToEffect(e) and s.checkzones(bc0,bc1) and s.stplace(bc0,tp,bc0) then s.stplace(bc1,tp,bc0) end end function s.gyplfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and not c:IsCode(id) and not c:IsForbidden() end function s.gypltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.gyplfilter(chkc) end local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.gyplfilter,tp,LOCATION_GRAVE,0,1,nil) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.gyplfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.gyplop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and s.stplace(tc,tp,c) and 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:
Cannot be Normal Summoned/Set. Must first be Special Summoned with "Max Metalmorph" that was activated by Tributing a Level 5 or higher Fiend monster. You can reveal this card in your hand; Set 1 "Metalmorph" Trap from your Deck, and if you do, shuffle this card into the Deck. You can only use this effect of "Metalzoa X" once per turn. Twice per turn, when your opponent activates a monster effect, or Spell Card or effect (Quick Effect): You can target 1 face-up monster your opponent controls; destroy it.
--メタル・デビルゾアX --Metalzoa X --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Set 1 "Metalmorph" Trap from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfReveal) e1:SetTarget(s.settg) e1:SetOperation(s.setop) c:RegisterEffect(e1) --Destroy 1 face-up monster your opponent controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(2) e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and (re:IsMonsterEffect() or re:IsSpellEffect()) end) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.max_metalmorph_stats={5,RACE_FIEND} s.listed_names={CARD_MAX_METALMORPH} s.listed_series={SET_METALMORPH} function s.setfilter(c) return c:IsSetCard(SET_METALMORPH) and c:IsTrap() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToDeck() and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,c,1,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SSet(tp,g)>0 and c:IsRelateToEffect(e) then Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Gold Pride" monster you control; until the end of this turn, it gains 500 ATK, it cannot be destroyed by battle or card effects, and it cannot activate its effects. During the End Phase, if a face-up "Gold Pride" monster(s) you control was destroyed by battle or card effect this turn: You can Set this card from your GY. You can only use this effect of "Gold Pride - Pedal to the Metal!" once per turn.
--GP-ペダル・トゥ・メタル --Gold Pride - Pedal to the Metal! --scripted by fiftyfour local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMINGS_CHECK_MONSTER_E) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Set this card from your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(function(_,tp) return Duel.HasFlagEffect(tp,id) end) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) --Check if a "Gold Pride" monster is destroyed aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROYED) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_series={SET_GOLD_PRIDE} function s.cfilter(c) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousSetCard(SET_GOLD_PRIDE) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.cfilter,nil) for tc in g:Iter() do Duel.RegisterFlagEffect(tc:GetPreviousControler(),id,RESET_PHASE|PHASE_END,0,1) end 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 chkc:IsFaceup() and chkc:IsSetCard(SET_GOLD_PRIDE) end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_GOLD_PRIDE),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_GOLD_PRIDE),tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsImmuneToEffect(e) then local c=e:GetHandler() --Gains 500 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) --Cannot be destroyed by battle or card effects local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetValue(1) tc:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e3) --Cannot activate its effects local e4=e1:Clone() e4:SetDescription(aux.Stringid(id,2)) e4:SetProperty(EFFECT_FLAG_CLIENT_HINT) e4:SetCode(EFFECT_CANNOT_TRIGGER) tc:RegisterEffect(e4) end end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Special Summoned. Requires 3 "Qli" Tributes to Normal Summon/Set. If this card is Normal Summoned/Set, it is unaffected by Spell/Trap effects and by activated effects from any monster whose original Level/Rank is lower than this card's current Level. All Special Summoned monsters lose 500 ATK and DEF. Once per turn: You can make your opponent send 1 monster from their hand or their side of the field to the Graveyard (their choice).
--アポクリフォート・キラー --Apoqliphort Towers local s,id=GetID() function s.initial_effect(c) --Cannot be Special Summoned local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e1) --Must be Tribute Summoned by using "Qli" monsters local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRIBUTE_LIMIT) e2:SetValue(s.tlimit) c:RegisterEffect(e2) --Summon with 3 tribute local e3=aux.AddNormalSummonProcedure(c,true,false,3,3,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0)) local e4=aux.AddNormalSetProcedure(c,true,false,3,3,SUMMON_TYPE_TRIBUTE,aux.Stringid(id,0)) --Unaffected by cards' effects local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE) e5:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_UNCOPYABLE) e5:SetRange(LOCATION_MZONE) e5:SetCode(EFFECT_IMMUNE_EFFECT) e5:SetCondition(function(e) return e:GetHandler():IsNormalSummoned() end) e5:SetValue(s.efilter) c:RegisterEffect(e5) --Decrease the ATK/DEF of Special Summoned monsters by 500 local e6=Effect.CreateEffect(c) e6:SetType(EFFECT_TYPE_FIELD) e6:SetCode(EFFECT_UPDATE_ATTACK) e6:SetRange(LOCATION_MZONE) e6:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e6:SetTarget(s.adtg) e6:SetValue(-500) c:RegisterEffect(e6) local e7=e6:Clone() e7:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e7) --Make the opponent send 1 monster to the GY local e8=Effect.CreateEffect(c) e8:SetDescription(aux.Stringid(id,1)) e8:SetCategory(CATEGORY_TOGRAVE) e8:SetType(EFFECT_TYPE_IGNITION) e8:SetRange(LOCATION_MZONE) e8:SetCountLimit(1) e8:SetTarget(s.tgtg) e8:SetOperation(s.tgop) c:RegisterEffect(e8) end s.listed_series={SET_QLI} function s.tlimit(e,c) return not c:IsSetCard(SET_QLI) end function s.efilter(e,te) if te:IsSpellTrapEffect() then return true else return aux.qlifilter(e,te) end end function s.adtg(e,c) return c:IsSpecialSummoned() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE|LOCATION_HAND)>0 end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,0,LOCATION_MZONE|LOCATION_HAND) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsMonster,1-tp,LOCATION_MZONE|LOCATION_HAND,0,nil) if #g>0 then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_TOGRAVE) local sg=g:Select(1-tp,1,1,nil) Duel.HintSelection(sg) Duel.SendtoGrave(sg,REASON_RULE,PLAYER_NONE,1-tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "K9" Xyz Monster or 1 Rank 5 Xyz Monster you control; Special Summon from your Extra Deck, 1 "K9" Xyz Monster with a different name, by using that monster you control (this is treated as an Xyz Summon, transfer its materials to the Summoned monster). At the end of the Battle Phase, if your "K9" monster battled this turn: You can Set this card from your GY. You can only use each effect of "K9-LC Release Restraint" once per turn.
--K9-LC拘束解除 --K9-LC Release Restraint --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_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Set this card from your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp) return Duel.HasFlagEffect(tp,id) end) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) --Check if a "K9" monster has battled 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_series={SET_K9} function s.checkop(e,tp,eg,ep,ev,re,r,rp) local bc0,bc1=Duel.GetBattleMonster(0) if bc0 and bc0:IsSetCard(SET_K9) then Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_END,0,1) end if bc1 and bc1:IsSetCard(SET_K9) then Duel.RegisterFlagEffect(1,id,RESET_PHASE|PHASE_END,0,1) end end function s.tgfilter(c,e,tp) local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and (c:IsSetCard(SET_K9) or c:IsRank(5)) and c:IsType(TYPE_XYZ) and c:IsFaceup() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,c:GetCode()) end function s.spfilter(c,e,tp,mc,code) return mc:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsSetCard(SET_K9) and not c:IsCode(code) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and mc:IsCanBeXyzMaterial(c,tp) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(tc),tp,nil,nil,REASON_XYZ) if tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) or #pg>1 or (#pg==1 and not pg:IsContains(tc)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetCode()):GetFirst() if sc then sc:SetMaterial(tc) Duel.Overlay(sc,tc) if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)==0 then return end sc:CompleteProcedure() end 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,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 2+ non-Tuner monsters If this card is Synchro Summoned: Target up to 3 cards your opponent controls; return those targets to the hand.
--ミスト・ウォーム --Mist Wurm local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),2,99) c:EnableReviveLimit() --return hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() 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 if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,3,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.GetChainInfo(0,CHAININFO_TARGET_CARDS) local tg=g:Filter(Card.IsRelateToEffect,nil,e) if #tg>0 then Duel.SendtoHand(tg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 "Cyber Angel" Ritual Monster from your hand or field, then target 1 LIGHT Fairy monster you control; it gains ATK/DEF equal to the Level the monster had when Tributed x 200, until the end of this turn. This turn, if it battles an opponent's monster that was Special Summoned from the Extra Deck, that opponent's monster's effects are negated during that Battle Phase only. You can only activate 1 "Magnificent Machine Angel" per turn.
--荘厳なる機械天使 --Magnificent Machine Angel --scripted by Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_CYBER_ANGEL} function s.condition(e,tp,eg,ep,ev,re,r,rp) if Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated() then return false end return true end --Defining cost function s.costfilter(c,tp) return c:IsRitualMonster() and c:IsReleasable() and c:IsSetCard(SET_CYBER_ANGEL) and Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,0,1,c) end --Check for LIGHT fairy monster function s.atkfilter(c) return c:IsFaceup() and c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) end --Cost of tribute "Cyber Angel" ritual monster from hand or field function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,true,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,true,nil,nil,tp) e:SetLabel(g:GetFirst():GetLevel()) Duel.Release(g,REASON_COST) end --Activation legality function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.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 --Performing the effect of ATK/DEF change function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabel()*200) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BATTLE_START) e3:SetCondition(s.discon) e3:SetOperation(s.disop) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end --Check if battling monster is special summoned from extra deck function s.discon(e) local c=e:GetHandler() local bc=c:GetBattleTarget() return (c==Duel.GetAttacker() or c==Duel.GetAttackTarget()) and bc and bc:IsSummonLocation(LOCATION_EXTRA) end --Negate the battling monster's effect during battle phase function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetBattleTarget() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_BATTLE) tc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 Dragon monsters Once per turn: You can detach 1 material from this card; Special Summon 1 Dragon monster from your Deck, and make its ATK/DEF 0. This card cannot attack during the turn you activate this effect.
--聖刻龍王-アトゥムス --Hieratic Dragon King of Atum local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 6 Dragon monsters Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),6,2) --Special Summon 1 Dragon monster from your Deck, and make its ATK/DEF 0 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) e1:SetCost(Cost.AND(Cost.DetachFromSelf(1),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) local c=e:GetHandler() if chk==0 then return c:GetAttackAnnouncedCount()==0 end --This card cannot attack during the turn you activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end function s.spfilter(c,e,tp) return 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) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then --Make its ATK/DEF 0 local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(0) e1:SetReset(RESET_EVENT|RESETS_STANDARD) sc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE) sc:RegisterEffect(e2) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 face-down monster you control. Your opponent declares 2 Attributes. Reveal the selected monster. If its Attribute is one of the declared Attributes, your opponent draws 2 cards. If not, you draw 2 cards.
--DNA定期健診 --DNA Checkup local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFacedown() and c:GetRace()~=0 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_FACEDOWN) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATTRIBUTE) local rc=Duel.AnnounceAttribute(1-tp,2,ATTRIBUTE_ALL) e:SetLabel(rc) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFacedown() then Duel.ConfirmCards(1-tp,tc) if tc:IsAttribute(e:GetLabel()) then Duel.Draw(1-tp,2,REASON_EFFECT) else Duel.Draw(tp,2,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay 500 LP, then target 1 "Vanquish Soul" monster in your GY; either add it to your hand or Special Summon it in Defense Position. You can only activate 1 "Vanquish Soul - Continue?" per turn.
--VSコンティニュー --Vanquish Soul - Continue? --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(Cost.PayLP(500)) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_VANQUISH_SOUL} function s.tgfilter(c,e,tp,ft) return c:IsSetCard(SET_VANQUISH_SOUL) and c:IsMonster() and (c:IsAbleToHand() or (ft>0 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) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tgfilter(chkc,e,tp,ft) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,ft) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end aux.ToHandOrElse(tc,tp, function() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end, function() Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end, aux.Stringid(id,1) ) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Gladiator Beast Laquari" + 2 "Gladiator Beast" monsters Must first be Special Summoned (from your Extra Deck) by shuffling the above cards you control into the Deck. (You do not use "Polymerization".) When a Spell/Trap Card is activated (Quick Effect): You can discard 1 card; negate the activation, and if you do, destroy it. This card must be face-up on the field to activate and to resolve this effect.
--剣闘獣ヘラクレイノス --Gladiator Beast Heraklinos local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMixN(c,true,true,78868776,1,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GLADIATOR),2) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit) --negate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.discon) e1:SetCost(s.discost) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.listed_series={SET_GLADIATOR} s.material_setcode={SET_GLADIATOR} function s.contactfil(tp) return Duel.GetMatchingGroup(function(c) return c:IsMonster() and c:IsAbleToDeckOrExtraAsCost() end,tp,LOCATION_ONFIELD,0,nil) end function s.contactop(g,tp) Duel.ConfirmCards(1-tp,g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST|REASON_MATERIAL) end function s.splimit(e,se,sp,st) return e:GetHandler():GetLocation()~=LOCATION_EXTRA end function s.discon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.discost(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.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsFaceup() or not c:IsRelateToEffect(e) then return end 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:
When an opponent's monster declares a direct attack: You can Special Summon this card from your hand in Attack Position, and if you do, for the rest of this turn, it cannot be destroyed by battle and the battle damage you take from battles involving this card is halved. If this card is sent to the GY as Link Material: You can target 1 other DARK monster in your GY; add it to your hand, also your opponent can add 1 monster from their GY to their hand. You can only use this effect of "Chobham Armor Dragon" once per turn.
--チョバムアーマー・ドラゴン --Chobham Armor Dragon --Scripted by Eerie Code 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_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add 1 other DARK monster from your GY to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,id) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker():IsControler(1-tp) and Duel.GetAttackTarget()==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,POS_FACEUP_ATTACK) 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_ATTACK)>0 then --Cannot be destroyed by battle local e1=Effect.CreateEffect(c) e1:SetDescription(3000) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) --Halve battle damage involving this card local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e2:SetValue(aux.ChangeBattleDamage(0,HALF_DAMAGE)) e2:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e2) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsLocation(LOCATION_GRAVE) and r&REASON_LINK==REASON_LINK end function s.thfilter1(c) return c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter1(chkc) and chkc~=c end if chk==0 then return Duel.IsExistingTarget(s.thfilter1,tp,LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter1,tp,LOCATION_GRAVE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,1-tp,LOCATION_GRAVE) end function s.thfilter2(c) return c:IsMonster() and c:IsAbleToHand() 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 local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.thfilter2),tp,0,LOCATION_GRAVE,nil) if #g>0 and Duel.SelectYesNo(1-tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_ATOHAND) local sg=g:Select(1-tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(tp,sg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If you have no card in your other Pendulum Zone: You can destroy this card, and if you do, Special Summon 1 face-up "Mythical Beast" Pendulum Monster from your Extra Deck, except "Mythical Beast Jackal King". You can only use this effect of "Mythical Beast Jackal King" once per turn. ---------------------------------------- [ Monster Effect ] Each time a Spell Card is activated, place 2 Spell Counters on this card when that Spell resolves. Once per turn, when an opponent activates a monster effect (Quick Effect): You can remove 2 Spell Counters from your field; negate the activation, and if you do, destroy that card.
--魔導獣 キングジャッカル --Mythical Beast Jackal King --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) c:EnableCounterPermit(COUNTER_SPELL) --destroy & summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --add counter local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetOperation(aux.chainreg) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EVENT_CHAIN_SOLVING) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetRange(LOCATION_MZONE) e3:SetOperation(s.acop) c:RegisterEffect(e3) --negate local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.condition) e4:SetCost(s.cost) e4:SetTarget(s.target) e4:SetOperation(s.operation) c:RegisterEffect(e4) end s.counter_place_list={COUNTER_SPELL} s.listed_series={SET_MYTHICAL_BEAST} s.listed_names={id} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_PZONE,0) == 1 end function s.spfilter(c,e,tp,rp) return c:IsSetCard(SET_MYTHICAL_BEAST) and c:IsFaceup() and c:IsType(TYPE_PENDULUM) and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsDestructable() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,rp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)~=0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,rp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end function s.acop(e,tp,eg,ep,ev,re,r,rp) if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() and e:GetHandler():GetFlagEffect(1)>0 then e:GetHandler():AddCounter(COUNTER_SPELL,2) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=re:GetHandler() return rp~=tp and re:IsMonsterEffect() and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,COUNTER_SPELL,2,REASON_COST) end Duel.RemoveCounter(tp,1,0,COUNTER_SPELL,2,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 monsters, including a Level/Rank/Link 2 monster Cannot be used as Link Material the turn it is Link Summoned. Your opponent cannot target monsters this card points to with card effects. During the Main Phase (Quick Effect): You can target 1 Level 2 monster in your GY, or, if your opponent controls a monster, you can target 1 Rank/Link 2 monster instead; Special Summon it. You can only use this effect of "Spright Elf" once per turn.
--スプライト・エルフ --Spright Elf --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,nil,2,2,s.lcheck) --Cannot be Link Material the turn it's Link Summoned local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetCondition(s.lkcon) e1:SetValue(1) c:RegisterEffect(e1) --Cards this points to cannot be targeted local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetRange(LOCATION_MZONE) e2:SetTarget(function(e,c) return e:GetHandler():GetLinkedGroup():IsContains(c) end) e2:SetValue(aux.tgoval) c:RegisterEffect(e2) --Special Summon 1 Level/Rank/Link-2 from your GY local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e3:SetCountLimit(1,id) e3:SetCondition(function() return Duel.IsMainPhase() end) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.lfilter(c) return c:IsLevel(2) or c:IsRank(2) or c:IsLink(2) end function s.lcheck(g,lc,sumtype,tp) return g:IsExists(s.lfilter,1,nil) end function s.lkcon(e) local c=e:GetHandler() return c:IsStatus(STATUS_SPSUMMON_TURN) and c:IsLinkSummoned() end function s.spfilter(c,e,tp,ex) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (c:IsLevel(2) or (ex and (c:IsRank(2) or c:IsLink(2)))) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ex=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp,ex) 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,ex) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,ex) 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:
This card is used to Ritual Summon "Herald of Perfection". You must also Tribute monsters from your hand or field whose total Levels equal exactly 6. When "Herald of Perfection" is Ritual Summoned by this card's effect: You can banish this card from your Graveyard, then target 1 of the monsters in your Graveyard that was Tributed for that Ritual Summon; return that target to your hand.
--宣告者の預言 --Dawn of the Herald local s,id=GetID() function s.initial_effect(c) local e1=Ritual.AddProcEqual(c,s.ritualfil,6,nil,nil,nil,nil,s.stage2) --salvage local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND) e2:SetDescription(aux.Stringid(id,0)) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CUSTOM+id) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.thcon) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --event local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_CHAIN_END) e3:SetRange(LOCATION_GRAVE) e3:SetCondition(s.evcon) e3:SetOperation(s.evop) c:RegisterEffect(e3) e1:SetLabelObject(e3) end s.listed_names={44665365} s.fit_monster={44665365} function s.ritualfil(c) return c:IsCode(44665365) and c:IsRitualMonster() end function s.stage2(mg,e,tp,eg,ep,ev,re,r,rp,tc) e:GetLabelObject():SetLabelObject(tc) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return re:GetHandler()==e:GetHandler() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsAbleToRemove() end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) end function s.thfilter(c,e,tp) return c:IsLocation(LOCATION_GRAVE) and c:IsControler(tp) and c:IsAbleToHand() and c:IsCanBeEffectTarget(e) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tc=eg:GetFirst() local mat=tc:GetMaterial() if chkc then return mat:IsContains(chkc) and s.thfilter(chkc,e,tp) end if chk==0 then return mat:IsExists(s.thfilter,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=mat:FilterSelect(tp,s.thfilter,1,1,nil,e,tp) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,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) Duel.ConfirmCards(1-tp,tc) end end function s.evcon(e,tp,eg,ep,ev,re,r,rp) return e:GetLabelObject()~=nil end function s.evop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() Duel.RaiseEvent(tc,EVENT_CUSTOM+id,e,0,tp,tp,0) e:SetLabelObject(nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can target 1 "S-Force" monster in your GY, except "S-Force Lapcewell"; Special Summon it. You can banish 1 "S-Force" card from your hand; destroy all of your opponent's monsters in the same columns as your "S-Force" monsters. You can only use each effect of "S-Force Lapcewell" once per turn.
--S-Force ラプスウェル --S-Force Lapcewell --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "S-Force" monster from the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Destroy all monsters in the same column as your "S-Force" monsters local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(aux.SForceCost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_S_FORCE} function s.spfilter(c,e,tp) return c:IsSetCard(SET_S_FORCE) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.desfilter(c,e) return aux.SForceTarget(e,c) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil,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:
You can Special Summon this card (from your hand) by discarding 1 Level 5 or higher LIGHT monster. Once per turn: You can discard 1 LIGHT monster; banish 1 LIGHT monster from your Deck.
--ライトレイ グレファー --Lightray Grepher local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.spfilter(c) return c:GetLevel()>=5 and c:IsAttribute(ATTRIBUTE_LIGHT) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil) return aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),0,c) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil) local g=aux.SelectUnselectGroup(rg,e,tp,1,1,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end Duel.SendtoGrave(g,REASON_DISCARD|REASON_COST) g:DeleteGroup() end function s.costfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsDiscardable() end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.costfilter,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsAbleToRemove() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Gains 300 ATK/DEF for each of your banished cards.
--黄金のホムンクルス --Golden Homunculus local s,id=GetID() function s.initial_effect(c) 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.value) c:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetValue(s.value) c:RegisterEffect(e2) end function s.value(e,c) return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_REMOVED,0)*300 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Add 1 "Unchained" card from your Deck to your hand. If this Set card is destroyed by card effect: You can Special Summon 1 "Unchained" monster from your Deck. You can only use each effect of "Abomination's Prison" once per turn.
--雙王の械 --Abomination's Prison --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_UNCHAINED} function s.thfilter(c) return c:IsSetCard(SET_UNCHAINED) 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) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousPosition(POS_FACEDOWN) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_UNCHAINED) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard this card AND 1 Dragon-Type or WATER monster; Special Summon 1 "Tidal, Dragon Ruler of Waterfalls" from your Deck. It cannot attack this turn. You can only use the effect of "Stream, Dragon Ruler of Droplets" once per turn.
--水征竜-ストリーム --Stream, Dragon Ruler of Droplets local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Tidal, Dragon Ruler of Waterfalls" from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(DragonRuler.SelfDiscardCost(ATTRIBUTE_WATER)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={26400609} --"Tidal, Dragon Ruler of Waterfalls" function s.spfilter(c,e,tp) return c:IsCode(26400609) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Cannot attack this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card cannot be destroyed by battle. When a card on the field is destroyed by battle or by a card effect, return this face-up card to its owner's hand.
--柴戦士タロ --Shiba-Warrior Taro local s,id=GetID() function s.initial_effect(c) --battle indestructable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_DESTROYED) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.filter(c) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.filter,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,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 c:IsFaceup() then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 5 monsters You can detach 1 material from this card; add 1 "K9" card from your Deck to your hand, then if your opponent has activated a monster effect this turn, you can Set 1 "K9" Quick-Play Spell from your Deck or GY. When your opponent activates a monster effect in the hand or GY (Quick Effect): You can detach 1 material from this card; negate that effect. You can only use each effect of "K9-17 "Ripper"" once per turn.
--K9-17号 “Ripper” --K9-17 "Ripper" --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 2 Level 5 monsters Xyz.AddProcedure(c,nil,5,2) --Add 1 "K9" card from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_CHAIN,function(re,tp,cid) return not re:IsMonsterEffect() end) --Negate an opponent's monster effect activated in the hand or GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.discon) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.distg) e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end) c:RegisterEffect(e2) end s.listed_series={SET_K9} function s.thfilter(c) return c:IsSetCard(SET_K9) 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.setfilter(c) return c:IsSetCard(SET_K9) and c:IsQuickPlaySpell() and c:IsSSetable() end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) if Duel.GetCustomActivityCount(id,1-tp,ACTIVITY_CHAIN)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.setfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.setfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SSet(tp,sg) end end end end function s.discon(e,tp,eg,ep,ev,re,r,rp,chk) local trig_loc=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) return ep==1-tp and re:IsMonsterEffect() and trig_loc&(LOCATION_HAND|LOCATION_GRAVE)>0 and Duel.IsChainDisablable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,tp,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card; Special Summon 1 "Uria, Lord of Searing Flames", "Hamon, Lord of Striking Thunder", or "Raviel, Lord of Phantasms", from your hand, ignoring its Summoning conditions. You can banish this card from your GY; add 1 "Fallen Paradise" from your Deck to your hand. You can only use each effect of "Chaos Summoning Beast" once per turn.
--混沌の召喚神 --Chaos Summoning Beast --scripted by pyrQ 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(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_names={6007213,32491822,69890967,13301895} function s.spfilter(c,e,tp) return c:IsCode(6007213,32491822,69890967) and c:IsCanBeSpecialSummoned(e,0,tp,true,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,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end function s.thfilter(c) return c:IsCode(13301895) 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:
When this card is Normal Summoned: You can Special Summon a number of "Compass Tokens" (Machine/EARTH/Level 1/ATK 0/DEF 0) up to the number of monsters your opponent controls.
--クラスター・ペンデュラム --Cosmic Compass local s,id=GetID() function s.initial_effect(c) --token local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_names={27450401} 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.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_MACHINE,ATTRIBUTE_EARTH) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE) if ft>ct then ft=ct end if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_MACHINE,ATTRIBUTE_EARTH) then return end local ctn=true while ft>0 and ctn do local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP) ft=ft-1 if ft<=0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then ctn=false end end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(This card is always treated as an "Armored Xyz" card.) You can send 1 WATER Xyz Monster from your Extra Deck to the GY, then target 1 Fish monster in your GY with the same Level as the Rank of that monster; Special Summon it. During your opponent's turn, if this card is in your GY (Quick Effect): You can target 1 WATER Xyz Monster you control; equip this card to that monster as an Equip Spell that gives it 500 ATK. You can only use each effect of "Armored Shark" once per turn.
--アーマード・シャーク --Armored Shark --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Fish monster from your GY with a Level equal to the Rank of the Xyz Monster sent to the GY to activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Equip this card to 1 WATER Xyz Monster you control as an Equip Spell that gives it 500 ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_EQUIP) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) end s.listed_series={SET_ARMORED_XYZ} function s.spcostfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_XYZ) and c:IsAbleToGraveAsCost() and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetRank()) end function s.spfilter(c,e,tp,rank) return c:IsRace(RACE_FISH) and c:IsLevel(rank) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) e:SetLabel(g:GetFirst():GetRank()) Duel.SendtoGrave(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp,e:GetLabel()) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,e:GetLabel()) 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.eqfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsType(TYPE_XYZ) and c:IsFaceup() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqfilter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(s.eqfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.eqfilter,tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,tp,0) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Equip(tp,c,tc) then --Equip limit local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EFFECT_EQUIP_LIMIT) e0:SetValue(function(e,c) return c==tc end) e0:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e0) --The equipped monster gains 500 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can send 1 "Ancient Gear Golem" from your hand, Deck, or face-up Monster Zone to the GY; immediately after this effect resolves, Normal Summon 1 "Ancient Gear" monster. If you Normal or Special Summon "Ancient Gear Golem" (except during the Damage Step): You can Special Summon 1 "Ancient Gear Golem" from your hand or GY, ignoring its Summoning conditions. You can banish this card from your GY; place 1 "Ancient Gear" Continuous Trap from your hand face-up on your field. You can only use each effect of "Ancient Gear Commander" once per turn.
--古代の機械司令 --Ancient Gear Commander --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Normal Summon 1 "Ancient Gear" monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.nscost) e1:SetTarget(s.nstg) e1:SetOperation(s.nsop) c:RegisterEffect(e1) --Workaround so that the card to be sent as cost for "e1" isn't considered for the potential Tributes --"e1" currently won't work when trying to summon a monster without Tributes while all the player's MMZs are full local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_FIELD) e1a:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1a:SetCode(EFFECT_UNRELEASABLE_SUM) e1a:SetRange(LOCATION_MZONE) e1a:SetTargetRange(LOCATION_MZONE,0) e1a:SetTarget(function(e,c) return c==e:GetLabelObject() end) e1a:SetValue(1) c:RegisterEffect(e1a) e1:SetLabelObject(e1a) --Special Summon 1 "Ancient Gear Golem" from your hand or GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Place 1 "Ancient Gear" Continuous Trap face-up on your field local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,{id,2}) e4:SetCost(Cost.SelfBanish) e4:SetTarget(s.pltg) e4:SetOperation(s.plop) c:RegisterEffect(e4) end s.listed_names={CARD_ANCIENT_GEAR_GOLEM} s.listed_series={SET_ANCIENT_GEAR} function s.costfilter(c,tp,eff) if not (c:IsCode(CARD_ANCIENT_GEAR_GOLEM) and c:IsAbleToGraveAsCost() and (c:IsFaceup() or not c:IsLocation(LOCATION_MZONE))) then return false end eff:SetLabelObject(c) local res=Duel.IsExistingMatchingCard(s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,c) eff:SetLabelObject(nil) return res end function s.nsfilter(c) return c:IsSetCard(SET_ANCIENT_GEAR) and c:IsSummonable(true,nil) end function s.nscost(e,tp,eg,ep,ev,re,r,rp,chk) local eff=e:GetLabelObject() if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE,0,1,nil,tp,eff) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE,0,1,1,nil,tp,eff) Duel.SendtoGrave(g,REASON_COST) end function s.nstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_MZONE) end function s.nsop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Summon(tp,tc,true,nil) end end function s.aggfilter(c,tp) return c:IsFaceup() and c:IsCode(CARD_ANCIENT_GEAR_GOLEM) and c:IsSummonPlayer(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.aggfilter,1,nil,tp) end function s.spfilter(c,e,tp) return c:IsCode(CARD_ANCIENT_GEAR_GOLEM) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|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 g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end function s.plfilter(c,tp) return c:IsSetCard(SET_ANCIENT_GEAR) and c:IsContinuousTrap() and not c:IsForbidden() and c:CheckUniqueOnField(tp) end function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_HAND,0,1,nil,tp) end end function s.plop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst() if tc then Duel.MoveToField(tc,tp,tp,LOCATION_SZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned, unless you control a "Ghostrick" monster. Once per turn: You can change this card to face-down Defense Position. Once per turn: You can target 1 face-up monster your opponent controls; change it to face-down Defense Position.
--ゴーストリックの魔女 --Ghostrick Witch local s,id=GetID() function s.initial_effect(c) --summon limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetCondition(s.sumcon) c:RegisterEffect(e1) --turn set local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) --change pos local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.postg2) e3:SetOperation(s.posop2) c:RegisterEffect(e3) end s.listed_series={SET_GHOSTRICK} function s.sumcon(e) return not Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_GHOSTRICK),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end function s.filter(c) return c:IsFaceup() and c:IsCanTurnSet() end function s.postg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_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.posop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent's monster declares an attack on a Synchro Monster you control: Negate the attack, then you can apply the rest of this card's effect. Banish that Synchro Monster you control and 1 Tuner from your GY, and if you do, Special Summon from your Extra Deck 1 Synchro Monster whose Level equals the total Levels the banished monsters had. (This is treated as a Synchro Summon.)
--王者の調和 --King's Synchro local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttackTarget() return tc and tc:IsFaceup() and tc:IsControler(tp) and tc:IsType(TYPE_SYNCHRO) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_MZONE|LOCATION_GRAVE) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.filter1(c,e,tp,tc,lv) local rlv=c:GetLevel()-lv return rlv>0 and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,tc,c)>0 and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,c,tp,rlv) end function s.filter2(c,tp,lv) local rlv=lv-c:GetLevel() return rlv==0 and c:IsType(TYPE_TUNER) and c:IsAbleToRemove() and aux.SpElimFilter(c,true) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttackTarget() local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,nil,nil,REASON_SYNCHRO) if Duel.NegateAttack() and Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_EXTRA,0,1,nil,e,tp,tc,tc:GetLevel()) and tc:IsAbleToRemove() and #pg<=0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetLevel()) local lv=g1:GetFirst():GetLevel()-tc:GetLevel() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g2=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp,lv) g2:AddCard(tc) if Duel.Remove(g2,POS_FACEUP,REASON_EFFECT)==2 then Duel.SpecialSummon(g1,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP) g1:GetFirst():CompleteProcedure() end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target "Ice Barrier" monsters you control with monster effects.
--氷結界の御庭番 --Secret Guards of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --untargetable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(aux.TargetBoolFunction(Card.IsSetCard,SET_ICE_BARRIER)) e1:SetValue(s.tgval) c:RegisterEffect(e1) end s.listed_series={SET_ICE_BARRIER} function s.tgval(e,re,rp) return rp~=e:GetHandlerPlayer() and re:IsMonsterEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All face-up "lswarm" monsters you currently control are unaffected by other Spell/Trap effects this turn.
--侵略の汎発感染 --Infestation Pandemic local s,id=GetID() function s.initial_effect(c) --All your "lswarm" monsters are unaffected by other card effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.operation) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_END_PHASE) c:RegisterEffect(e1) end s.listed_series={SET_LSWARM} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_LSWARM) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() for tc in aux.Next(g) do --Unaffected by other card effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3100) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(s.efilter) tc:RegisterEffect(e1) end end function s.efilter(e,te) return te:IsSpellTrapEffect() and te:GetOwner()~=e:GetOwner() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The activation and effects of "Altergeist" cards activated on your field cannot be negated. When your opponent activates a monster effect: You can send 1 other face-up "Altergeist" card you control to the GY; negate the activation, and if you do, destroy it. You can only use this effect of "Altergeist Protocol" once per turn.
--オルターガイスト・プロトコル --Altergeist Protocol local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(aux.StatChangeDamageStepCondition) c:RegisterEffect(e1) --negate local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_ACTIVATE) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCountLimit(1,id) e2:SetCondition(s.discon) e2:SetCost(s.discost) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetRange(LOCATION_SZONE) c:RegisterEffect(e3) --inactivatable local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD) e4:SetCode(EFFECT_CANNOT_INACTIVATE) e4:SetRange(LOCATION_SZONE) e4:SetValue(s.effectfilter) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_FIELD) e5:SetCode(EFFECT_CANNOT_DISEFFECT) e5:SetRange(LOCATION_SZONE) e5:SetValue(s.effectfilter) c:RegisterEffect(e5) end s.listed_series={SET_ALTERGEIST} function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return ep==1-tp and re:IsMonsterEffect() and Duel.IsChainNegatable(ev) end function s.discfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ALTERGEIST) and c:IsAbleToGraveAsCost() and not c:IsStatus(STATUS_BATTLE_DESTROYED) end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.discfilter,tp,LOCATION_ONFIELD,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.discfilter,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SendtoGrave(g,REASON_COST) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsRelateToEffect(re) and re:GetHandler():IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.disop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.effectfilter(e,ct) local p=e:GetHandler():GetControler() local te,tp,loc=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT,CHAININFO_TRIGGERING_PLAYER,CHAININFO_TRIGGERING_LOCATION) return p==tp and te:GetHandler():IsSetCard(SET_ALTERGEIST) and loc&LOCATION_ONFIELD~=0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters If this card is Synchro Summoned: You can equip 1 Link Monster from your GY to this card, and if you do, place Borrel Counters on this card equal to that Link Monster's Link Rating. This card gains ATK equal to half the ATK of the monster equipped to it by its effect. When your opponent activates a card or effect (Quick Effect): You can remove 1 Borrel Counter from this card; negate the activation. You can only use this effect of "Borreload Savage Dragon" once per turn.
--ヴァレルロード・S・ドラゴン --Borreload Savage Dragon --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:EnableCounterPermit(0x147) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --Equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCategory(CATEGORY_EQUIP) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e1) --Negate activation local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.discon) e2:SetCost(s.discost) e2:SetTarget(s.distg) e2:SetOperation(s.disop) c:RegisterEffect(e2) end s.counter_place_list={0x147} function s.eqval(ec,c,tp) return ec:IsControler(tp) and (ec:GetOriginalType()&TYPE_LINK==TYPE_LINK) end function s.filter(c) return c:IsLinkMonster() and not c:IsForbidden() end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE) end function s.equipop(c,e,tp,tc) if not c:EquipByEffectAndLimitRegister(e,tp,tc,id,true) then return end local lk=tc:GetLink() local atk=tc:GetTextAttack()/2 if atk<0 then atk=0 end if lk>0 then c:AddCounter(0x147,lk) end if atk>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(atk) tc:RegisterEffect(e2) end end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end if c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE,0,1,1,nil) local tc=g:GetFirst() if tc then s.equipop(c,e,tp,tc) end end function s.eqfilter(c) return c:GetFlagEffect(id)~=0 end function s.discon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function s.discost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsCanRemoveCounter(tp,0x147,1,REASON_COST) end e:GetHandler():RemoveCounter(tp,0x147,1,REASON_COST) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 6 monsters You can also Xyz Summon this card by sending 1 "Burning Abyss" monster from your hand to the GY, then using 1 "Dante" monster you control as material. (Transfer its materials to this card.) If Summoned this way, the following effect cannot be activated this turn. Once per turn (Quick Effect): You can detach 1 material from this card; send 1 card from your Deck to the GY. If this card in your possession is destroyed by your opponent's card and sent to your GY: You can Special Summon 1 "Burning Abyss" monster from your Extra Deck, ignoring its Summoning conditions.
--永遠の淑女 ベアトリーチェ --Beatrice, Lady of the Eternal local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,6,2,s.ovfilter,aux.Stringid(id,0),2,s.xyzop) c:EnableReviveLimit() --send to grave local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_BURNING_ABYSS,SET_DANTE} function s.cfilter(c) return c:IsSetCard(SET_BURNING_ABYSS) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.ovfilter(c,tp,lc) return c:IsFaceup() and c:IsSetCard(SET_DANTE,lc,SUMMON_TYPE_XYZ,tp) end function s.xyzop(e,tp,chk,mc) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_HAND,0,nil):SelectUnselect(Group.CreateGroup(),tp,false,Xyz.ProcCancellable) if tc then Duel.SendtoGrave(tc,REASON_COST) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TOFIELD),0,1) return true else return false end end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.IsExistingMatchingCard(Card.IsAbleToGrave,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,Card.IsAbleToGrave,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:IsPreviousControler(tp) and rp==1-tp and c:IsReason(REASON_DESTROY) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_BURNING_ABYSS) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent would Normal or Special Summons a monster(s), while you control a Normal Monster or a Level 5 or higher "Primite" monster, except a Token: Negate the Summon, and if you do, banish that monster(s). During your Standby Phase, if you control a "Primite" monster: You can Set this card from your GY, but banish it when it leaves the field. You can only use each effect of "Primite Scream" once per turn.
--原石の反叫 --Primite Scream --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Negate a Normal or Special Summon and banish that monster(s) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON) e1:SetCountLimit(1,id) e1:SetCondition(s.negsumcon) e1:SetTarget(s.negsumtg) e1:SetOperation(s.negsumop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON) c:RegisterEffect(e2) --Set this card from the GY but banish it when it leaves the field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_LEAVE_GRAVE) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetCode(EVENT_FREE_CHAIN) e3:SetRange(LOCATION_GRAVE) e3:SetHintTiming(TIMING_STANDBY_PHASE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.setcon) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) end s.listed_series={SET_PRIMITE} function s.negsumconfilter(c) return (c:IsType(TYPE_NORMAL) or (c:IsSetCard(SET_PRIMITE) and c:IsLevelAbove(5))) and c:IsFaceup() and not c:IsType(TYPE_TOKEN) end function s.negsumcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain(true)==0 and eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) and Duel.IsExistingMatchingCard(s.negsumconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.negsumtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(Card.IsAbleToRemove,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,eg,#eg,0,0) end function s.negsumop(e,tp,eg,ep,ev,re,r,rp) Duel.NegateSummon(eg) Duel.Remove(eg,POS_FACEUP,REASON_EFFECT) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_STANDBY) and Duel.IsTurnPlayer(tp) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_PRIMITE),tp,LOCATION_MZONE,0,1,nil) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() and Duel.SSet(tp,c)>0 then --Banish it when it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"The Weather" Effect Monsters in your Main Monster Zones of this card's column and its adjacent columns gain this effect. ● You can banish this card, then target 1 Spell/Trap your opponent controls (Quick Effect); return it to the hand. You can only control 1 "The Weather Rainy Canvas".
--雨の天気模様 --The Weather Rainy Canvas local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --effect gain local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.announcecost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(s.eftg) e3:SetLabelObject(e2) c:RegisterEffect(e3) end s.listed_series={SET_THE_WEATHER} function s.eftg(e,c) local g=e:GetHandler():GetColumnGroup(1,1) return c:IsType(TYPE_EFFECT) and c:IsSetCard(SET_THE_WEATHER) and c:GetSequence()<5 and g:IsContains(c) end function s.thfilter(c) return c:IsSpellTrap() and c:IsAbleToHand() end function s.announcecost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk) 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 s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_ONFIELD,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:
During your Draw Phase, instead of conducting your normal draw: You can reveal 3 "Malefic" cards from your Deck, then your opponent randomly adds 1 of them to your hand, and you shuffle the rest back into your Deck.
--Sin World --Malefic World 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) --search local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PREDRAW) e2:SetRange(LOCATION_FZONE) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_MALEFIC} function s.condition(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.GetDrawCount(tp)>0 end function s.filter(c) return c:IsSetCard(SET_MALEFIC) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,3,nil) end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) _replace_count=_replace_count+1 if _replace_count>_replace_max or not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g>=3 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,3,3,nil) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleDeck(tp) local tg=sg:RandomSelect(1-tp,1) Duel.SendtoHand(tg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters When your opponent takes effect damage from another "Battlewasp" monster: You can inflict damage to your opponent equal to the original ATK of that monster. You can only use this effect of "Battlewasp - Azusa the Ghost Bow" once per turn. When a monster is destroyed by battle with your "Battlewasp" monster, while this card is in your GY: You can Special Summon this card in Defense Position, but banish it when it leaves the field.
--B・F-霊弓のアズサ --Battlewasp - Azusa the Ghost Bow local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Synchro summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Inflict damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DAMAGE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Special summon itself from GY 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_DESTROYED) e2:SetRange(LOCATION_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_BATTLEWASP} function s.damcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp and (r&REASON_BATTLE)==0 and re and re:GetHandler():IsSetCard(SET_BATTLEWASP) and not (re:GetHandler()==e:GetHandler()) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) end local dam=re:GetHandler():GetBaseAttack() Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end function s.filter(c,tp) local rc=c:GetReasonCard() return (rc:IsSetCard(SET_BATTLEWASP) and rc:IsControler(tp)) or (c:IsSetCard(SET_BATTLEWASP) and c:IsControler(tp)) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.filter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) 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 Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner Dragon monsters You can target 1 banished LIGHT or DARK monster; Special Summon it to your field. When your opponent activates a monster effect (Quick Effect): You can target 1 banished card; shuffle it into the Deck, then if you shuffled it into your Deck, destroy that monster, or if you shuffled it into your opponent's Deck, negate that activated effect. You can only use each effect of "Bystial Dis Pater" once per turn.
--深淵の神獣ディス・パテル --Bystial Dis Pater --scripted by Naim local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_DRAGON),1,99) --Special Summon 1 banished LIGHT or DARK monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Shuffle 1 banished card into the Deck, and destroy or negate a monster's effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DESTROY+CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,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 function s.descon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsMonsterEffect() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local tc=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil):GetFirst() Duel.SetOperationInfo(0,CATEGORY_TODECK,tc,1,0,0) local rc=re:GetHandler() if tc:GetOwner()==tp and rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) elseif tc:GetOwner()==1-tp then Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA)) then return end if tc:GetOwner()==tp and re:GetHandler():IsRelateToEffect(re) then Duel.BreakEffect() Duel.Destroy(eg,REASON_EFFECT) elseif tc:GetOwner()==1-tp then Duel.BreakEffect() Duel.NegateEffect(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Neither player can Fusion Summon.
--融合禁止エリア --Non-Fusion Area 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) --disable spsummon local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,1) e2:SetTarget(s.splimit) c:RegisterEffect(e2) end function s.splimit(e,c,tp,sumtp,sumpos) return (sumtp&SUMMON_TYPE_FUSION)==SUMMON_TYPE_FUSION end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While this card is in face-up Attack Position on the field, this card is not destroyed as a result of battle. (Damage calculation is applied normally.) A monster that battled with this card cannot change its battle position, except with a card effect, or attack while this card is in face-up Attack Position on the field.
--薄幸の乙女 --The Unhappy Girl local s,id=GetID() function s.initial_effect(c) --battle indestructable local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetCondition(s.indcon) c:RegisterEffect(e1) --battled local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BATTLED) e2:SetOperation(s.atop) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --atk limit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_ATTACK) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(0,LOCATION_MZONE) e3:SetCondition(s.atlcon) e3:SetTarget(s.atltg) e3:SetLabelObject(g) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e4:SetLabelObject(g) c:RegisterEffect(e4) -- local e5=Effect.CreateEffect(c) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e5:SetCode(EVENT_CHANGE_POS) e5:SetOperation(s.posop) c:RegisterEffect(e5) end function s.indcon(e) return e:GetHandler():IsPosition(POS_FACEUP_ATTACK) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() if bc and c:IsPosition(POS_FACEUP_ATTACK) then if c:GetFlagEffect(id)==0 then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) e:GetLabelObject():Clear() end e:GetLabelObject():AddCard(bc) bc:RegisterFlagEffect(id+1,RESET_EVENT|RESETS_STANDARD,0,1) end end function s.atlcon(e) return e:GetHandler():GetFlagEffect(id)~=0 end function s.atltg(e,c) return e:GetLabelObject():IsContains(c) and c:GetFlagEffect(id+1)~=0 end function s.posop(e,tp,eg,ep,ev,re,r,rp) e:GetHandler():ResetFlagEffect(id) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control an "Adventurer Token": You can target 1 monster you control equipped with an Equip Card that mentions "Adventurer Token"; destroy as many monsters your opponent controls as possible with ATK less than or equal to that monster, then you can equip 1 Equip Spell that mentions "Adventurer Token" from your hand or GY to 1 monster you control. You can only activate 1 "Thunder Discharge" per turn.
--サンダー・ディスチャージ --Thunder Discharge --scripted by Rundas local s,id=GetID() function s.initial_effect(c) --Destroy monsters your opponent controls and equip a card to 1 monster you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_EQUIP) 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:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCondition(s.con) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end s.listed_names={TOKEN_ADVENTURER} function s.con(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,TOKEN_ADVENTURER),tp,LOCATION_ONFIELD,0,1,nil) end function s.tgfilter(c,tp) return c:IsFaceup() and c:GetEquipGroup():IsExists(Card.ListsCode,1,nil,TOKEN_ADVENTURER) and Duel.IsExistingMatchingCard(s.desfilter,tp,0,LOCATION_MZONE,1,nil,c:GetAttack()) end function s.desfilter(c,atk) return c:IsFaceup() and c:IsAttackBelow(atk) end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tc=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst() local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil,tc:GetAttack()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,1-tp,LOCATION_MZONE) Duel.SetPossibleOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE) end function s.eqfilter(c,tp) return c:IsEquipSpell() and c:CheckUniqueOnField(tp) and c:ListsCode(TOKEN_ADVENTURER) and not c:IsForbidden() and Duel.IsExistingMatchingCard(s.eqfilter2,tp,LOCATION_MZONE,0,1,nil,c) end function s.eqfilter2(c,tc) return c:IsFaceup() and tc:CheckEquipTarget(c) end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil,tc:GetAttack()) if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() if not ec then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local tg=Duel.SelectMatchingCard(tp,s.eqfilter2,tp,LOCATION_MZONE,0,1,1,nil,ec) if #tg==0 then return end Duel.HintSelection(tg,true) local ectg=tg:GetFirst() Duel.BreakEffect() Duel.Equip(tp,ec,ectg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, if another monster on the field returns to the hand or Main Deck: Send 1 WIND monster from your Deck to the Graveyard.
--虚空の騎士 --Altitude Knight 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_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e1:SetCode(EVENT_TO_HAND) e1:SetCondition(s.tgcon1) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_TO_DECK) e2:SetCondition(s.tgcon2) c:RegisterEffect(e2) end function s.cfilter1(c) return c:IsPreviousLocation(LOCATION_MZONE) end function s.tgcon1(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter1,1,nil) end function s.cfilter2(c) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsLocation(LOCATION_DECK) end function s.tgcon2(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter2,1,nil) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.tgfilter(c) return c:IsMonster() and c:IsAttribute(ATTRIBUTE_WIND) and c:IsAbleToGrave() end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Destroy this card during your 3rd End Phase after activation. Once per turn, if a "SPYRAL" monster you control destroys a monster by battle, or if you destroy a card(s) on the field with a "SPYRAL" monster's effect you control: You can draw 1 card. You can banish this card from your Graveyard; Special Summon 1 "SPYRAL" monster from your hand.
--SPYRAL MISSION-強襲 --SPYRAL MISSION - Assault local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) c:RegisterEffect(e1) --Draw 1 card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCondition(s.drcon) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) -- Special Summon 1 "SPYRAL" monster from your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_SPYRAL} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() --Destroy this card during your 3rd End Phase after activation local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESETS_STANDARD_PHASE_END|RESET_SELF_TURN,3) c:SetTurnCounter(0) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() ct=ct+1 c:SetTurnCounter(ct) if ct==3 then Duel.Destroy(c,REASON_EFFECT) end end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsReason(REASON_EFFECT) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local des=eg:GetFirst() if des:IsReason(REASON_BATTLE) then local rc=des:GetReasonCard() return rc and rc:IsSetCard(SET_SPYRAL) and rc:IsControler(tp) and rc:IsRelateToBattle() elseif re then local rc=re:GetHandler() return eg:IsExists(s.cfilter,1,nil,tp) and rc and rc:IsSetCard(SET_SPYRAL) and rc:IsControler(tp) and re:IsMonsterEffect() end return false end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_SPYRAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is destroyed by battle: Send 2 WATER monsters from your Deck to the GY.
--スクリーチ --Skreech local s,id=GetID() function s.initial_effect(c) --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_F) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,2,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_DECK,0,nil) if #g>1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local sg=g:Select(tp,2,2,nil) Duel.SendtoGrave(sg,REASON_EFFECT) end end