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:
|
Pay 500 Life Points. Look at your opponent's hand and all Set cards on their side of the field.
|
--マインド・ハック
--Mind Haxorz
local s,id=GetID()
function s.initial_effect(c)
--confirm
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(Cost.PayLP(500))
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.filter(c)
return (c:IsOnField() and c:IsFacedown()) or (c:IsLocation(LOCATION_HAND) and not c:IsPublic())
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_HAND|LOCATION_ONFIELD,1,nil) end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_HAND|LOCATION_ONFIELD,nil)
Duel.ConfirmCards(tp,g)
Duel.ShuffleHand(1-tp)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
3 Level 5 monsters (This card is always treated as "Number C39: Utopia Ray".) Once per turn, when a card or effect is activated that targets this card, or when this card is targeted for an attack (Quick Effect): You can equip 1 "ZW -" monster from your hand or Deck to this card as if it were equipped by that monster's effect. Once per turn: You can detach 1 material from this card, then target face-up cards your opponent controls up to the number of "ZW -" Monster Cards equipped to this card; negate their effects.
|
--竜装合体 ドラゴニック・ホープレイ
--Ultimate Dragonic Utopia Ray
--Scripted by Larry126
Duel.LoadCardScript("c56840427.lua")
local s,id=GetID()
function s.initial_effect(c)
--Xyz summon
Xyz.AddProcedure(c,nil,5,3)
--Must be properly summoned before reviving
c:EnableReviveLimit()
--Equip 1 "ZW -" monster from hand or deck to this card
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BE_BATTLE_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE)
e1:SetTarget(s.eqtg)
e1:SetOperation(s.eqop)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE)
e2:SetCondition(s.eqcon)
e2:SetTarget(s.eqtg)
e2:SetOperation(s.eqop)
c:RegisterEffect(e2)
--Negate opponent's cards, up to number of "ZW -" monsters equipped
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DISABLE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(Cost.DetachFromSelf(1))
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
end
s.listed_series={SET_ZW}
s.xyz_number=39
function s.filter(c,tc,tp)
if not (c:IsSetCard(SET_ZW) and not c:IsForbidden()) then return false end
local effs={c:GetCardEffect(id)}
for _,te in ipairs(effs) do
if te:GetValue()(tc,c,tp) then return true end
end
return false
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_DECK|LOCATION_HAND,0,1,nil,e:GetHandler(),tp) end
Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK|LOCATION_HAND)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or c:IsFacedown() or not c:IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,c,tp)
local tc=g:GetFirst()
if tc then
local eff=tc:GetCardEffect(id)
eff:GetOperation()(tc,eff:GetLabelObject(),tp,c)
end
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return tg and tg:IsContains(e:GetHandler())
end
function s.cfilter(c)
return c:IsFaceup() and c:IsSetCard(SET_ZW) and c:IsOriginalType(TYPE_MONSTER)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsNegatable() and chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_ONFIELD) end
if chk==0 then return e:GetHandler():GetEquipGroup():IsExists(s.cfilter,1,nil)
and Duel.IsExistingTarget(Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,nil) end
local ct=e:GetHandler():GetEquipGroup():FilterCount(s.cfilter,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
local g=Duel.SelectTarget(tp,Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,ct,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetTargetCards(e)
local c=e:GetHandler()
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_DISABLE)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_DISABLE_EFFECT)
e2:SetValue(RESET_TURN_SET)
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
tc:RegisterEffect(e2)
if tc:IsType(TYPE_TRAPMONSTER) then
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e3:SetCode(EFFECT_DISABLE_TRAPMONSTER)
e3:SetReset(RESET_EVENT|RESETS_STANDARD)
tc:RegisterEffect(e3)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Unaffected by the effects of "Hole" Normal Traps. The first time each Set card in your Spell & Trap Zone would be destroyed by card effect each turn, it is not destroyed. During the Main Phase, if you control a "Traptrix" monster (Quick Effect): You can Special Summon this card from your hand, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn, except Insect or Plant monsters. You can only use this effect of "Traptrix Arachnocampa" once per turn.
|
--キノの蟲惑魔
--Traptrix Arachnocampa
--Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
--Special Summon this card
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Unaffected by the effects of "Hole" Normal Traps
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetCode(EFFECT_IMMUNE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetValue(s.immfilter)
c:RegisterEffect(e2)
--Set cards destruction protection
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetProperty(EFFECT_FLAG_SET_AVAILABLE)
e3:SetCode(EFFECT_INDESTRUCTABLE_COUNT)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_SZONE,0)
e3:SetTarget(function(_,c) return c:IsFacedown() and c:GetSequence()<5 end)
e3:SetValue(function(_,_,r) return (r&REASON_EFFECT==REASON_EFFECT) and 1 or 0 end)
c:RegisterEffect(e3)
end
s.listed_series={SET_TRAPTRIX,SET_HOLE}
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsMainPhase() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_TRAPTRIX),tp,LOCATION_MZONE,0,1,nil)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
--Cannot Special Summon monsters from the Extra Deck, except Insect or Plant monsters
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(RACE_INSECT|RACE_PLANT) end)
e1:SetTargetRange(1,0)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
--Lizard check
aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalRace(RACE_INSECT|RACE_PLANT) end)
end
function s.immfilter(e,te)
local c=te:GetOwner()
return c:IsNormalTrap() and (c:IsSetCard(SET_HOLE) or c:IsSetCard(SET_TRAP_HOLE))
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Tribute 1 "Gearfried the Iron Knight"; Special Summon 1 "Gearfried the Swordmaster" from your hand or Deck.
|
--拘束解除
--Release Restraint
local s,id=GetID()
function s.initial_effect(c)
--Special Summon 1 "Gearfried the Swordmaster" from your hand or Deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_names={423705,57046845} --"Gearfried the Iron Knight", "Gearfried the Swordmaster"
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(-100)
if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsCode,1,false,aux.ReleaseCheckMMZ,nil,423705) end
local g=Duel.SelectReleaseGroupCost(tp,Card.IsCode,1,1,false,aux.ReleaseCheckMMZ,nil,423705)
Duel.Release(g,REASON_COST)
end
function s.spfilter(c,e,tp)
return c:IsCode(57046845) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local cost_chk=e:GetLabel()==-100
e:SetLabel(0)
return (cost_chk or Duel.GetLocationCount(tp,LOCATION_MZONE)>0)
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
if sc and Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP)>0 then
sc:CompleteProcedure()
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
While this Flip Summoned card is face-up on the field, it gains 3500 ATK. When this card is flipped face-up: You can target up to 2 face-up monsters on the field; destroy them.
|
--ドドドガッサー
--Dododo Swordsman
local s,id=GetID()
function s.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_FLIP)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(3500)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
e:GetHandler():RegisterEffect(e1)
end
function s.filter(c,e)
return c:IsFaceup() and (not e or c:IsRelateToEffect(e))
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,2,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS):Filter(s.filter,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:
|
Cannot be Normal Summoned/Set. Must be Special Summoned by a card effect, and cannot be Special Summoned by other ways. When your opponent Normal or Special Summons a monster(s) while you control no monsters (except during the Damage Step): You can Special Summon both this card from your hand and 1 "PSY-Frame Driver" from your hand, Deck, or Graveyard, and if you do, add 1 "PSY-Frame" card from your Deck to your hand, except "PSY-Framegear Alpha". During the End Phase, banish the face-up monsters Special Summoned by this effect.
|
--PSYフレームギア・α
--PSY-Framegear Alpha
local s,id=GetID()
function s.initial_effect(c)
c:EnableUnsummonable()
--Must be special summoned by card effect
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
e1:SetValue(s.splimit)
c:RegisterEffect(e1)
--Special summon itself and "PSY-Frame Driver", add 1 "PSY-Frame" card from deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetRange(LOCATION_HAND)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetCondition(s.condition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
s.listed_series={SET_PSY_FRAME}
s.listed_names={CARD_PSYFRAME_DRIVER}
function s.splimit(e,se,sp,st)
return se:IsHasType(EFFECT_TYPE_ACTIONS)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or Duel.IsPlayerAffectedByEffect(tp,CARD_PSYFRAME_LAMBDA))
end
function s.spfilter1(c,e,tp)
return c:IsCode(CARD_PSYFRAME_DRIVER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,c)
end
function s.spfilter2(c,e,tp)
return c:IsCode(CARD_PSYFRAME_DRIVER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.thfilter0,tp,LOCATION_DECK,0,1,c)
end
function s.thfilter0(c)
return c:IsSetCard(SET_PSY_FRAME) and not c:IsCode(id)
end
function s.thfilter(c)
return c:IsSetCard(SET_PSY_FRAME) and not c:IsCode(id) and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>1
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false)
and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end
if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter2),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g==0 then return end
local tc=g:GetFirst()
local c=e:GetHandler()
local fid=c:GetFieldID()
Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)
Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP)
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid)
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid)
Duel.SpecialSummonComplete()
g:AddCard(c)
g:KeepAlive()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetCountLimit(1)
e1:SetLabel(fid)
e1:SetLabelObject(g)
e1:SetCondition(s.rmcon)
e1:SetOperation(s.rmop)
Duel.RegisterEffect(e1,tp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g2=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g2>0 then
Duel.SendtoHand(g2,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g2)
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:
|
You can target 3 "True Draco" and/or "True King" cards in your GY; shuffle them into the Deck, then draw 1 card. During your Main Phase, you can: Immediately after this effect resolves, Tribute Summon 1 "True Draco" or "True King" monster face-up. If this card is sent from the Spell & Trap Zone to the GY: You can target 1 Spell/Trap on the field; destroy it. You can only use each effect of "Disciples of the True Dracophoenix" once per turn.
|
--真竜凰の使徒
--Disciples of the True Dracophoenix
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)
--draw
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,id)
e2:SetTarget(s.drtg)
e2:SetOperation(s.drop)
c:RegisterEffect(e2)
--tribute summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,{id,1})
e3:SetTarget(s.sumtg)
e3:SetOperation(s.sumop)
c:RegisterEffect(e3)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetCountLimit(1,75425322)
e4:SetCondition(s.descon)
e4:SetTarget(s.destg)
e4:SetOperation(s.desop)
c:RegisterEffect(e4)
end
s.listed_series={SET_TRUE_DRACO_KING}
function s.tdfilter(c)
return c:IsSetCard(SET_TRUE_DRACO_KING) and c:IsAbleToDeck()
end
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end
if chk==0 then return Duel.IsPlayerCanDraw(tp,1)
and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,3,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,3,3,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
function s.drop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tg=Duel.GetTargetCards(e)
if #tg<=0 then return end
Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT)
local g=Duel.GetOperatedGroup()
if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA)
if ct>0 then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.sumfilter(c)
return c:IsSetCard(SET_TRUE_DRACO_KING) and c:IsSummonable(true,nil,1)
end
function s.sumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.sumfilter,tp,LOCATION_HAND,0,1,nil) end
Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription())
Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0)
end
function s.sumop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON)
local g=Duel.SelectMatchingCard(tp,s.sumfilter,tp,LOCATION_HAND,0,1,1,nil)
local tc=g:GetFirst()
if tc then
Duel.Summon(tp,tc,true,nil,1)
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousLocation(LOCATION_SZONE)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() end
if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 Level 8 monsters Once per turn: You can detach 1 material from this card; place 1 String Counter on each face-up monster on the field, except this card. Once per turn, during the next End Phase of the opponent of the player who placed a String Counter(s) by this effect: Destroy the monsters with String Counters, and if you do, inflict 500 damage to your opponent for each monster destroyed.
|
--No.40 ギミック・パペット-ヘブンズ・ストリングス
--Number 40: Gimmick Puppet of Strings
local s,id=GetID()
function s.initial_effect(c)
--Xyz Summon
Xyz.AddProcedure(c,nil,8,2)
c:EnableReviveLimit()
--Place String counters
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(Cost.DetachFromSelf(1,1,nil))
e1:SetTarget(s.cttg)
e1:SetOperation(s.ctop)
c:RegisterEffect(e1)
--Destroy monsters with String counters and burn 500 for each
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.descon)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
end
s.counter_place_list={0x1024}
s.xyz_number=40
function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end
end
function s.ctop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler())
for tc in g:Iter() do
tc:AddCounter(0x1024,1)
end
Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,2)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFlagEffect(tp,id)~=0 and Duel.GetTurnPlayer()~=tp
end
function s.desfilter(c)
return c:GetCounter(0x1024)~=0
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*500)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
local ct=Duel.Destroy(g,REASON_EFFECT)
Duel.Damage(1-tp,ct*500,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Once per turn, during your Standby Phase: You can add 1 "Polymerization" from your Deck or Graveyard to your hand.
|
--E・HERO フォレストマン
--Elemental HERO Woodsman
local s,id=GetID()
function s.initial_effect(c)
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_FIELD)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EVENT_PHASE|PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetCondition(s.con)
e1:SetTarget(s.tg)
e1:SetOperation(s.op)
c:RegisterEffect(e1)
end
s.listed_names={CARD_POLYMERIZATION}
function s.con(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(tp)
end
function s.filter(c)
return c:IsCode(CARD_POLYMERIZATION) and c:IsAbleToHand()
end
function s.tg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE)
end
function s.op(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Reveal 1 "Generaider" monster in your hand, and if you do, add up to 2 "Generaider" Spells/Traps with different names from each other from your Deck to your hand, except "Generaider Boss Quest". Then place the revealed card on the bottom of your Deck. You can only activate 1 "Generaider Boss Quest" per turn.
|
--王の試練
--Generaider Boss Quest
--Scripted by AlphaKretin
local s,id=GetID()
function s.initial_effect(c)
--search
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
end
s.listed_names={id}
s.listed_series={SET_GENERAIDER}
function s.cfilter(c)
return c:IsSetCard(SET_GENERAIDER) and c:IsMonster() and not c:IsPublic() and c:IsAbleToDeck()
end
function s.thfilter(c)
return not c:IsCode(id) and c:IsSetCard(SET_GENERAIDER) and c:IsSpellTrap() and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil)
and aux.SelectUnselectGroup(g,e,tp,1,2,aux.dncheck,0) 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)
local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local rc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil)
if #rc>0 then
Duel.ConfirmCards(1-tp,rc)
local sg=aux.SelectUnselectGroup(g,e,tp,1,2,aux.dncheck,1,tp,HINTMSG_ATOHAND)
if #sg>0 and Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then
Duel.ConfirmCards(1-tp,sg)
Duel.ShuffleDeck(tp)
Duel.BreakEffect()
Duel.SendtoDeck(rc,nil,SEQ_DECKBOTTOM,REASON_EFFECT)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 monsters with different names If this card is Link Summoned: You can discard 1 card, then target 1 Special Summoned monster in your opponent's Main Monster Zone; destroy it, then, if this card was co-linked when this effect was activated, you can draw 1 card. You can only use this effect of "Knightmare Cerberus" once per turn. Co-linked monsters you control cannot be destroyed by card effects.
|
--トロイメア・ケルベロス
--Knightmare Cerberus
local s,id=GetID()
function s.initial_effect(c)
--link summon
Link.AddProcedure(c,nil,2,2,s.lcheck)
c:EnableReviveLimit()
--Destroy monster
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetCondition(s.descon)
e1:SetCost(s.descost)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetRange(LOCATION_MZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(s.indtg)
e2:SetValue(1)
c:RegisterEffect(e2)
end
function s.lcheck(g,lc,sumtype,tp)
return g:CheckDifferentProperty(Card.GetCode,lc,sumtype,tp)
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLinkSummoned()
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD)
end
function s.desfilter(c)
return c:IsSpecialSummoned() and c:GetSequence()<5
end
function s.destg(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.desfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.desfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
if e:GetHandler():GetMutualLinkedGroupCount()>0 then
e:SetLabel(1)
else
e:SetLabel(0)
end
local cat=CATEGORY_DESTROY
if e:GetLabel()==1 then cat=cat+CATEGORY_DRAW end
e:SetCategory(cat)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0
and e:GetLabel()==1 and Duel.IsPlayerCanDraw(tp,1)
and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.Draw(tp,1,REASON_EFFECT)
end
end
function s.indtg(e,c)
return c:GetMutualLinkedGroupCount()>0
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Banish 2 "Ritual Beast" monsters you control; Special Summon 1 "Ritual Beast" monster from your Extra Deck, ignoring its Summoning conditions.
|
--霊獣の相絆
--Ritual Beast's Bond
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:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_series={SET_RITUAL_BEAST}
function s.cfilter(c)
return c:IsSetCard(SET_RITUAL_BEAST) and c:IsAbleToRemoveAsCost()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end
local bg = aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE)
Duel.Remove(bg,POS_FACEUP,REASON_COST)
end
function s.rescon(sg,e,tp,mg)
return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg)
end
function s.spfilter(c,e,tp,sg)
return c:IsSetCard(SET_RITUAL_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,sg,c) > 0
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp)
if #sg>0 then
Duel.SpecialSummon(sg,0,tp,tp,true,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Once per turn, you can flip this card into face-down Defense Position. Negate the activation of any Spell Card that targets this 1 face-down monster. At that time, flip this card into face-up Defense Position.
|
--ミドル・シールド・ガードナー
--Mid Shield Gardna
local s,id=GetID()
function s.initial_effect(c)
--turn set
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_POSITION)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_QUICK_F)
e2:SetCode(EVENT_CHAINING)
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_SET_AVAILABLE)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.negcon)
e2:SetOperation(s.negop)
c:RegisterEffect(e2)
end
function s.target(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.operation(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.negcon(e,tp,eg,ep,ev,re,r,rp)
if re:IsSpellEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then
local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return #tg==1 and tg:GetFirst()==e:GetHandler() and e:GetHandler():IsFacedown()
else
return false
end
end
function s.negop(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
Duel.ChangePosition(e:GetHandler(),POS_FACEUP_DEFENSE)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card is activated: You can send 1 LIGHT Fairy monster from your Deck to the GY. Fairy monsters you control gain 100 ATK for each Fairy monster in your field and GY. If this card is sent to the GY: You can target 1 Level 4 or lower Fairy monster in your GY; Special Summon it. You can only use this effect of "Vingolf's Blessing" once per turn. You can only activate 1 "Vingolf's Blessing" per turn.
|
--ヴィンゴルヴの祝福
--Vingolf's Blessing
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
--When this card is activated: You can send 1 LIGHT Fairy monster from your Deck to the GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOGRAVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Fairy monsters you control gain 100 ATK for each Fairy monster in your field and GY
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(function(e,c) return c:IsRace(RACE_FAIRY) end)
e2:SetValue(function(e,c) return 100*Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsRace,RACE_FAIRY),c:GetControler(),LOCATION_MZONE|LOCATION_GRAVE,0,nil) end)
c:RegisterEffect(e2)
--Special Summon 1 Level 4 or lower Fairy monster from your GY
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,{id,1})
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK)
end
function s.tgfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY) and c:IsAbleToGrave()
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
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
end
function s.spfilter(c,e,tp)
return c:IsLevelBelow(4) and c:IsRace(RACE_FAIRY) 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:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) 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) 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 your opponent controls a monster and you control no monsters, you can Normal Summon/Set this card without Tributing. Once per turn, during your Main Phase 1: You can target 1 "Blackwing" monster you control; until the end of this turn, it gains ATK equal to the total ATK of all "Blackwing" monsters currently on the field, except itself. Monsters other than the targeted monster cannot attack during the turn you activate this effect.
|
--BF-暁のシロッコ
--Blackwing - Sirocco the Dawn
local s,id=GetID()
function s.initial_effect(c)
--summon & set with no tribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(s.ntcon)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_SET_PROC)
c:RegisterEffect(e2)
--atkup
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_ATKCHANGE)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1)
e3:SetCondition(s.condition)
e3:SetTarget(s.target)
e3:SetOperation(s.operation)
c:RegisterEffect(e3)
end
s.listed_series={SET_BLACKWING}
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE)>0
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPhase(PHASE_MAIN1)
end
function s.filter(c)
return c:IsFaceup() and c:IsSetCard(SET_BLACKWING)
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)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_ATTACK)
e2:SetProperty(EFFECT_FLAG_OATH)
e2:SetTargetRange(LOCATION_MZONE,0)
e2:SetTarget(s.ftarget)
e2:SetLabel(g:GetFirst():GetFieldID())
e2:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e2,tp)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local atk=0
local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,tc)
local bc=g:GetFirst()
for bc in aux.Next(g) do
atk=atk+bc:GetAttack()
end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetReset(RESETS_STANDARD_PHASE_END)
e1:SetValue(atk)
tc:RegisterEffect(e1)
end
end
function s.ftarget(e,c)
return e:GetLabel()~=c:GetFieldID()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Banish 1 card from your Deck, face-up. During your 2nd Standby Phase after this card's activation, add that card to the hand.
|
--封印の黄金櫃
--Gold Sarcophagus
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,LOCATION_DECK,0,1,1,nil)
local tg=g:GetFirst()
if tg==nil then return end
Duel.Remove(tg,POS_FACEUP,REASON_EFFECT)
if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetRange(LOCATION_REMOVED)
e1:SetCode(EVENT_PHASE|PHASE_STANDBY)
e1:SetCountLimit(1)
e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,2)
e1:SetCondition(s.thcon)
e1:SetOperation(s.thop)
e1:SetLabel(0)
tg:RegisterEffect(e1)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(tp)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local ct=e:GetLabel()
e:GetHandler():SetTurnCounter(ct+1)
if ct==1 then
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,e:GetHandler())
else e:SetLabel(1) end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
The equipped monster gains 300 ATK. If the equipped monster would be destroyed by battle, return this card to its owner's hand instead. Then, destroy 1 monster, except the one that battled the equipped monster, and inflict 600 damage to your opponent. After that, Special Summon 1 "Evil Token" (Fiend-Type/DARK/Level 7/ATK 2500/DEF 2500) on your opponent's side of the field. During the turn this card is returned to your hand, you cannot use "Vicious Claw" from your hand.
|
--ヴィシャス・クロー
--Vicious Claw
local s,id=GetID()
function s.initial_effect(c)
aux.AddEquipProcedure(c)
--atkup
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(300)
c:RegisterEffect(e2)
--destroy sub
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP+EFFECT_TYPE_CONTINUOUS)
e4:SetCode(EFFECT_DESTROY_REPLACE)
e4:SetTarget(s.desreptg)
e4:SetOperation(s.desrepop)
c:RegisterEffect(e4)
--tohand
local e5=Effect.CreateEffect(c)
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e5:SetCode(EVENT_TO_HAND)
e5:SetOperation(s.thop)
c:RegisterEffect(e5)
end
s.listed_names={75524093}
function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk)
local tg=e:GetHandler():GetEquipTarget()
if chk==0 then return tg and tg:IsReason(REASON_BATTLE) end
return true
end
function s.desrepop(e,tp,eg,ep,ev,re,r,rp)
local exc=e:GetHandler():GetEquipTarget():GetBattleTarget()
Duel.SendtoHand(e:GetHandler(),nil,REASON_EFFECT)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,exc)
if Duel.Destroy(g,REASON_EFFECT)>0 and Duel.Damage(1-tp,600,REASON_EFFECT)~=0 then
if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,2500,2500,7,RACE_FIEND,ATTRIBUTE_DARK,POS_FACEUP,1-tp) then
local token=Duel.CreateToken(tp,id+1)
Duel.SpecialSummon(token,0,tp,1-tp,false,false,POS_FACEUP)
end
end
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsPreviousLocation(LOCATION_DECK) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_USE_AS_COST)
e1:SetTargetRange(LOCATION_HAND,0)
e1:SetTarget(s.limittg)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_TRIGGER)
Duel.RegisterEffect(e2,tp)
local e3=e1:Clone()
e3:SetCode(EFFECT_CANNOT_SSET)
Duel.RegisterEffect(e3,tp)
end
end
function s.limittg(e,c)
return c:IsCode(id)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If the only monster you control is 1 "Six Samurai" monster in face-up Attack Position: Target 2 cards your opponent controls; return those targets to the hand.
|
--六武派二刀流
--Six Style - Dual Wield
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_series={SET_SIX_SAMURAI}
function s.condition(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
local ct=#g
local tg=g:GetFirst()
return ct==1 and tg:IsFaceup() and tg:IsAttackPos() and tg:IsSetCard(SET_SIX_SAMURAI)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:GetControler()~=tp and chkc:IsOnField() and chkc:IsAbleToHand() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,2,2,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.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if #sg>0 then
Duel.SendtoHand(sg,nil,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Pay LP in multiples of 100 (max. 2000); equip this card to a monster. It gains that much ATK and DEF. You can only activate 1 "Psychic Blade" per turn.
|
--サイコ・ブレイド
--Psychic Blade
local s,id=GetID()
function s.initial_effect(c)
--Equip
local e1=aux.AddEquipProcedure(c,nil,nil,nil,s.cost)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
--Equipped monster gain ATK/DEF equal to the LP paid
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetValue(s.val)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e3)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
for _,te in ipairs({Duel.GetPlayerEffect(tp,EFFECT_LPCOST_CHANGE)}) do
local value=te:GetValue()
if value(te,e,tp,100)~=100 then return false end
end
return Duel.CheckLPCost(tp,100)
end
local lp=Duel.GetLP(tp)
local m=math.floor(math.min(lp,2000)/100)
local t={}
for i=1,m do
t[i]=i*100
end
local ac=Duel.AnnounceNumber(tp,table.unpack(t))
Duel.PayLPCost(tp,ac)
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,ac)
end
function s.val(e,c)
local ct=e:GetHandler():GetFlagEffectLabel(id)
if not ct then return 0 end
return ct
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
The equipped monster loses 300 ATK and cannot change its battle position or declare an attack. If this card is destroyed because the equipped monster is destroyed: Target 1 monster on the field; equip this card to that monster.
|
--フリント
--Flint
local s,id=GetID()
function s.initial_effect(c)
aux.AddEquipProcedure(c,nil,s.filter,s.eqlimit)
--atkdown
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_UPDATE_ATTACK)
e2:SetCondition(s.flcon)
e2:SetValue(-300)
c:RegisterEffect(e2)
--cannot attack
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e3:SetCondition(s.flcon)
c:RegisterEffect(e3)
--cannot change pos
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_EQUIP)
e4:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
e4:SetCondition(s.flcon)
c:RegisterEffect(e4)
--reequip
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,0))
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e6:SetCode(EVENT_TO_GRAVE)
e6:SetProperty(EFFECT_FLAG_CARD_TARGET)
e6:SetCondition(s.eqcon)
e6:SetTarget(s.target)
e6:SetOperation(s.operation)
c:RegisterEffect(e6)
local e7=e6:Clone()
e7:SetCode(EVENT_REMOVE)
c:RegisterEffect(e7)
end
function s.flcon(e)
local tc=e:GetHandler():GetEquipTarget()
return tc:GetCode()~=83812099 or tc:IsDisabled()
end
function s.eqlimit(e,c)
return c:GetCode()~=83812099 or c:IsDisabled() or not c:GetEquipGroup():IsExists(Card.IsCode,1,e:GetHandler(),id)
end
function s.filter(c)
return c:IsFaceup() and (c:GetCode()~=83812099 or c:IsDisabled() or not c:GetEquipGroup():IsExists(Card.IsCode,1,nil,id))
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0)
end
function s.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 tc:IsFaceup() then
Duel.Equip(tp,c,tc)
end
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=c:GetPreviousEquipTarget()
return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsReason(REASON_DESTROY)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 Level 4 monsters When this card is Xyz Summoned: You can target 1 "Box of Friends" in your GY; Special Summon that target. If you control another monster, your opponent's monsters cannot target this card for attacks, also your opponent cannot target this card with card effects. If a face-up Normal Monster(s) you control is destroyed by battle or card effect and sent to the GY: You can detach 1 material from this card; Special Summon 1 Normal Monster from your Deck or GY in Defense Position.
|
--プリンセス・コロン
--Princess Cologne
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--Xyz Summon procedure: 2 Level 4 monsters
Xyz.AddProcedure(c,nil,4,2)
--Special Summon 1 "Box of Friends" from your 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)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(function(e) return e:GetHandler():IsXyzSummoned() end)
e1:SetTarget(s.boxsptg)
e1:SetOperation(s.boxspop)
c:RegisterEffect(e1)
--If you control another monster, your opponent's monsters cannot target this card for attacks, also your opponent cannot target this card with card effects
local e2a=Effect.CreateEffect(c)
e2a:SetType(EFFECT_TYPE_SINGLE)
e2a:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2a:SetCode(EFFECT_CANNOT_BE_BATTLE_TARGET)
e2a:SetRange(LOCATION_MZONE)
e2a:SetCondition(function(e) return Duel.IsExistingMatchingCard(nil,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,e:GetHandler()) end)
e2a:SetValue(aux.imval1)
c:RegisterEffect(e2a)
local e2b=e2a:Clone()
e2b:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2b:SetValue(aux.tgoval)
c:RegisterEffect(e2b)
--Special Summon 1 Normal Monster from your Deck or GY in Defense Position
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetRange(LOCATION_MZONE)
e3:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN)
e3:SetCondition(s.normalspcon)
e3:SetCost(Cost.DetachFromSelf(1))
e3:SetTarget(s.normalsptg)
e3:SetOperation(s.normalspop)
c:RegisterEffect(e3)
end
s.listed_names={CARD_BOX_OF_FRIENDS}
function s.boxspfilter(c,e,tp)
return c:IsCode(CARD_BOX_OF_FRIENDS) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.boxsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.boxspfilter(chkc,e,tp) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingTarget(s.boxspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.boxspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0)
end
function s.boxspop(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.normalspconfilter(c,tp)
return c:IsPreviousTypeOnField(TYPE_NORMAL) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP)
and c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsType(TYPE_NORMAL)
end
function s.normalspcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.normalspconfilter,1,nil,tp)
end
function s.normalspfilter(c,e,tp)
return c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function s.normalsptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.normalspfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE)
end
function s.normalspop(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.normalspfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
3 Level 4 monsters You can detach 1 Xyz Material from this card to target 1 face-up Xyz Monster your opponent controls; this card's name and original effect become the same as that monster. This effect can only be used once while this card is face-up on the field.
|
--隻眼のスキル・ゲイナー
--One-Eyed Skill Gainer
local s,id=GetID()
function s.initial_effect(c)
--xyz summon
Xyz.AddProcedure(c,nil,4,3)
c:EnableReviveLimit()
--attack up
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_ATKCHANGE)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_NO_TURN_RESET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(Cost.DetachFromSelf(1))
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.filter(c)
return c:IsFaceup() and c:IsType(TYPE_XYZ)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if tc and c:IsRelateToEffect(e) and c:IsFaceup() and tc:IsFaceup() and tc:IsRelateToEffect(e) then
local code=tc:GetOriginalCode()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
e1:SetCode(EFFECT_CHANGE_CODE)
e1:SetValue(code)
c:RegisterEffect(e1)
c:CopyEffect(code,RESET_EVENT|RESETS_STANDARD,1)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Send 1 face-up "The Tricky" you control to the Graveyard; Special Summon "Tricky Tokens" (Spellcaster-Type/WIND/Level 5/ATK 2000/DEF 1200) in Defense Position, equal to the number of monsters your opponent controls. "Tricky Tokens" cannot declare an attack.
|
--トリッキーズ・マジック4
--Tricky Spell 4
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_names={14778250,75622825}
function s.cfilter(c,ft,ct)
return c:IsFaceup() and c:IsCode(14778250) and c:IsAbleToGraveAsCost() and (ft>=ct or c:GetSequence()<5)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(1)
local ct=Duel.GetFieldGroupCount(1-tp,LOCATION_MZONE,0)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if chk==0 then return ft>=ct-1 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,ft,ct) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil,ft,ct)
Duel.SendtoGrave(g,REASON_COST)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetFieldGroupCount(1-tp,LOCATION_MZONE,0)
if chk==0 then
if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<ct then return false end
e:SetLabel(0)
return ct>0 and (ct==1 or not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT))
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,2000,1200,5,RACE_SPELLCASTER,ATTRIBUTE_WIND)
end
Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,ct,0,0)
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,ct,tp,0)
end
function s.activate(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
local ct=Duel.GetFieldGroupCount(1-tp,LOCATION_MZONE,0)
if ft<ct then return end
if not Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,2000,1200,5,RACE_SPELLCASTER,ATTRIBUTE_WIND) then return end
for i=1,ct do
local token=Duel.CreateToken(tp,id+1)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_DEFENSE)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
token:RegisterEffect(e1,true)
end
Duel.SpecialSummonComplete()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can activate this card when a Continuous Trap Card is activated. Negate all Continuous Trap Cards during the turn this card is activated.
|
--金属探知器
--Metal Detector
local s,id=GetID()
function s.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetActiveType()==TYPE_CONTINUOUS+TYPE_TRAP
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--disable
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE)
e1:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE)
e1:SetTarget(s.distarget)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.distarget(e,c)
return c:IsContinuousTrap()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Target 1 Spell/Trap you control and 1 Spell/Trap your opponent controls; destroy them.
|
--ダブル・サイクロン
--Double Cyclone
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.filter(c)
return c:IsSpellTrap()
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.filter,tp,0,LOCATION_ONFIELD,1,nil)
and Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g1=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler())
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g2=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_ONFIELD,1,1,nil)
g1:Merge(g2)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,2,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS)
local sg=g:Filter(Card.IsRelateToEffect,nil,e)
if #sg>0 then
Duel.Destroy(sg,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can only control 1 "Hela, Generaider Boss of Doom". (Quick Effect): You can Tribute 1 "Generaider" monster or 1 Zombie monster, then target 1 "Generaider" monster or 1 Zombie monster in your GY, with a different name than the Tributed monster had on the field; Special Summon that monster in Defense Position. You can only use this effect of "Hela, Generaider Boss of Doom" once per turn.
|
--死の王 ヘル
--Hela, Generaider Boss of Doom
--Scripted by Hel
local s,id=GetID()
function s.initial_effect(c)
--You can only control 1 "Hela, Generaider Boss of Doom"
c:SetUniqueOnField(1,0,id)
--Special Summon 1 "Generaider" monster or 1 Zombie monster from your GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,id)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
end
s.listed_names={id}
s.listed_series={SET_GENERAIDER}
function s.spcostfilter(c,e,tp)
return (c:IsSetCard(SET_GENERAIDER) or c:IsRace(RACE_ZOMBIE)) and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetCode())
end
function s.spfilter(c,e,tp,code)
return (c:IsSetCard(SET_GENERAIDER) or c:IsRace(RACE_ZOMBIE)) and not c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
e:SetLabel(-100)
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.spcostfilter,1,false,aux.ReleaseCheckMMZ,nil,e,tp) end
local rc=Duel.SelectReleaseGroupCost(tp,s.spcostfilter,1,1,false,aux.ReleaseCheckMMZ,nil,e,tp):GetFirst()
e:SetLabel(rc:GetCode())
Duel.Release(rc,REASON_COST)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local label=e:GetLabel()
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp,label) end
if chk==0 then
local res=label==-100
e:SetLabel(0)
return res
end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,label)
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_DEFENSE)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
[ Pendulum Effect ] Once per turn: You can target 1 face-up monster your opponent controls; its ATK becomes half its current ATK (until the end of this turn), then destroy this card. ---------------------------------------- [ Monster Effect ] (This card is always treated as an "Xyz Dragon" card.) If this card is destroyed by battle or card effect: You can target 1 DARK Spellcaster-Type monster in your Graveyard; Special Summon it.
|
--黒牙の魔術師
--Black Fang Magician
local s,id=GetID()
function s.initial_effect(c)
Pendulum.AddProcedure(c)
--Halve ATK
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetTarget(s.atktg)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--Special Summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_DESTROYED)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(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_FACEUP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and tc and tc:IsFaceup() and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_ATTACK_FINAL)
e1:SetValue(math.floor(tc:GetAttack()/2))
e1:SetReset(RESETS_STANDARD_PHASE_END)
tc:RegisterEffect(e1)
Duel.BreakEffect()
Duel.Destroy(c,REASON_EFFECT)
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return r&(REASON_EFFECT|REASON_BATTLE)~=0
end
function s.spfilter(c,e,tp)
return c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_SPELLCASTER) 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 and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card is sent to the Graveyard: Banish 1 random card from your opponent's hand, until the End Phase. You can only use the effect of "Snapdragon" once per turn.
|
--スナップドラゴン
--Snapdragon
local s,id=GetID()
function s.initial_effect(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,id)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,LOCATION_HAND,nil)
if #g==0 then return end
local rg=g:RandomSelect(tp,1)
local tc=rg:GetFirst()
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabelObject(tc)
e1:SetCondition(s.retcon)
e1:SetOperation(s.retop)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
end
function s.retcon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffect(id)==0 then
e:Reset()
return false
else
return true
end
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
Duel.SendtoHand(tc,1-tp,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card inflicts Battle Damage to your opponent by a direct attack, remove from play all Synchro Monsters in your opponent's Graveyard, and inflict 1000 damage to your opponent for each monster removed.
|
--記憶破壊王
--Memory Crush King
local s,id=GetID()
function s.initial_effect(c)
--remove
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_BATTLE_DAMAGE)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp and Duel.GetAttackTarget()==nil
end
function s.filter(c)
return c:IsType(TYPE_SYNCHRO) and c:IsAbleToRemove() and aux.SpElimFilter(c,true)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,nil)
if #g~=0 then
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,#g*1000)
end
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,nil)
local ct=Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
if ct~=0 then
Duel.Damage(1-tp,ct*1000,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
1 Tuner + 1+ non-Tuner monsters Gains ATK equal to its Level x 300. Each time a "F.A." Spell/Trap Card or effect is activated: You can increase this card's Level by 1. This card gains the following effect(s), based on its current Level. ● Level 11 or higher: Cannot be destroyed by battle or card effects. ● Level 13 or higher: Once per turn: You can target 1 "F.A." monster in your GY; Special Summon it.
|
--F.A.ホームトランスポーター
--F.A. Motorhome Transport
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99)
--atk up
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetValue(s.atkval)
c:RegisterEffect(e1)
--level up
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_LVCHANGE)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e3:SetCode(EVENT_CHAINING)
e3:SetRange(LOCATION_MZONE)
e3:SetCondition(s.lvcon)
e3:SetOperation(s.lvop)
c:RegisterEffect(e3)
--indes
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e4:SetRange(LOCATION_MZONE)
e4:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e4:SetCondition(s.indcon)
e4:SetValue(1)
c:RegisterEffect(e4)
local e5=e4:Clone()
e5:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
c:RegisterEffect(e5)
--special summon
local e6=Effect.CreateEffect(c)
e6:SetDescription(aux.Stringid(id,1))
e6:SetCategory(CATEGORY_SPECIAL_SUMMON)
e6:SetProperty(EFFECT_FLAG_CARD_TARGET)
e6:SetType(EFFECT_TYPE_IGNITION)
e6:SetCountLimit(1)
e6:SetRange(LOCATION_MZONE)
e6:SetCondition(s.spcon)
e6:SetTarget(s.sptg)
e6:SetOperation(s.spop)
c:RegisterEffect(e6)
end
s.listed_series={SET_FA}
function s.atkval(e,c)
return c:GetLevel()*300
end
function s.lvcon(e,tp,eg,ep,ev,re,r,rp)
return re:IsSpellTrapEffect() and re:GetHandler():IsSetCard(SET_FA)
end
function s.lvop(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_LEVEL)
e1:SetValue(1)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
c:RegisterEffect(e1)
end
end
function s.indcon(e)
return e:GetHandler():IsLevelAbove(11)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLevelAbove(13)
end
function s.filter(c,e,tp)
return c:IsSetCard(SET_FA) 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: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.spop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
This card must attack, if able. If this card is targeted for an attack: Change the battle position of this card. (Quick Effect): You can banish this card from your GY, then target 1 "Karakuri" monster you control; change its battle position. You can only use this effect of "Karakuri Gama mdl 4624 "Shirokunishi"" once per turn.
|
--カラクリ蝦蟇 四六弐四
--Karakuri Gama mdl 4624 "Shirokunishi"
--scripted by Logical Nonsense
--Substitute ID
local s,id=GetID()
function s.initial_effect(c)
--Must attack
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_MUST_ATTACK)
c:RegisterEffect(e1)
--Position change
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_POSITION)
e2:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE)
e2:SetCode(EVENT_BE_BATTLE_TARGET)
e2:SetOperation(s.posop)
c:RegisterEffect(e2)
--Position change, quick effect
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_POSITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetCountLimit(1,id)
e3:SetRange(LOCATION_GRAVE)
e3:SetCost(Cost.SelfBanish)
e3:SetTarget(s.target)
e3:SetOperation(s.operation)
c:RegisterEffect(e3)
end
s.listed_series={SET_KARAKURI}
--Switch battle position
function s.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.ChangePosition(c,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0)
end
end
--Check for "Karakuri" monster that can switch position
function s.filter(c)
return c:IsFaceup() and c:IsSetCard(SET_KARAKURI) and c:IsCanChangePosition()
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.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_POSCHANGE)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0)
end
--Switch 1 "Karakuri" monster's battle position
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Equip only to a Normal Monster. It gains 500 ATK. When the equipped monster destroys an opponent's monster by battle: You can Special Summon 1 "Phantasm Spiral Dragon" from your hand, Deck, or Graveyard, and equip it with this card, then inflict 1000 damage to your opponent. You can only use this effect of "Phantasm Spiral Grip" once per turn.
|
--幻煌龍の螺旋絞
--Phantasm Spiral Grip
local s,id=GetID()
function s.initial_effect(c)
aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsType,TYPE_NORMAL))
--Atk up
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_EQUIP)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetValue(500)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,0))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DAMAGE)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_BATTLE_DESTROYING)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,id)
e4:SetCondition(s.spcon)
e4:SetTarget(s.sptg)
e4:SetOperation(s.spop)
c:RegisterEffect(e4)
end
s.listed_names={56649609}
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
return ec and eg:IsContains(ec)
end
function s.spfilter(c,e,tp)
return c:IsCode(56649609) 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_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000)
end
function s.spop(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 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 then
local tc=g:GetFirst()
if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP)~=0 then
Duel.Equip(tp,c,tc)
Duel.SpecialSummonComplete()
Duel.BreakEffect()
Duel.Damage(1-tp,1000,REASON_EFFECT)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this attacking card destroys a monster in your opponent's Main Monster Zone: You can discard 1 card; this card can attack again in a row, also the zone that monster was in cannot be used until the end of the next turn.
|
--燎星のプロメテオロン
--Prometeor, the Burning Star
--Scripted by Eerie Code
local s,id=GetID()
function s.initial_effect(c)
--extra attack
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetCondition(s.atcon)
e1:SetCost(s.atcost)
e1:SetOperation(s.atop)
c:RegisterEffect(e1)
end
function s.atcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
if not bc then return false end
local seq=bc:GetPreviousSequence()
e:SetLabel(seq+16)
return Duel.GetAttacker()==c and aux.bdocon(e,tp,eg,ep,ev,re,r,rp) and c:CanChainAttack(0) and seq<5
end
function s.atcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_DISCARD|REASON_COST)
end
function s.atop(e,tp,eg,ep,ev,re,r,rp)
local seq=e:GetLabel()
Duel.ChainAttack()
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_DISABLE_FIELD)
e1:SetLabel(0x1<<seq)
e1:SetOperation(s.disop)
e1:SetReset(RESET_PHASE|PHASE_END,2)
Duel.RegisterEffect(e1,tp)
end
function s.disop(e,tp)
return e:GetLabel()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Target 1 "Noble Knight" monster you control; equip it with 1 Equip Spell from your Deck that can equip to that target. You can only activate 1 "Glory of the Noble Knights" per turn.
|
--栄光の聖騎士団
--Glory of the Noble Knights
--
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_series={SET_NOBLE_KNIGHT}
function s.filter(c,tp)
return c:IsFaceup() and c:IsSetCard(SET_NOBLE_KNIGHT)
and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_DECK,0,1,nil,c,tp)
end
function s.eqfilter(c,tc,tp)
return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(tc) and c:CheckUniqueOnField(tp) and not c:IsForbidden()
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,tp) end
local ft=0
if e:GetHandler():IsLocation(LOCATION_HAND) then ft=1 end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>ft
and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,tp)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
local g=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_DECK,0,1,1,nil,tc,tp)
if #g>0 then
Duel.Equip(tp,g:GetFirst(),tc)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If "Visas Starfrost" is on the field: Target 1 Effect Monster on the field; shuffle that target into the Deck, and if you do, during the End Phase of this turn, its owner can add 1 monster from their Deck to their hand with a different Type and a Level lower than the Level/Rank/Link Rating of that monster. If a "Veda" monster(s) is Special Summoned, while this card is in your GY (except during the Damage Step): You can add this card to your hand. You can only use each effect of "Sharv Sarga" once per turn.
|
--新世廻
--Sharv Sarga
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
--Shuffle 1 Effect Monster into the Deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E)
e1:SetCountLimit(1,id)
e1:SetCondition(s.tdcon)
e1:SetTarget(s.tdtg)
e1:SetOperation(s.tdop)
c:RegisterEffect(e1)
--Add this card to the hand if a "Veda" monster is Special Summoned
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,{id,1})
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
end
s.listed_names={CARD_VISAS_STARFROST}
s.listed_series={SET_VEDA}
function s.tdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_VISAS_STARFROST),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil)
end
function s.tdfilter(c)
return c:IsFaceup() and c:IsType(TYPE_EFFECT) and c:IsAbleToDeck()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.tdfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0)
Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,g:GetFirst():GetOwner(),LOCATION_DECK)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and s.tdfilter(tc) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0
and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) then
local rac=tc:GetRace()
local val=math.max(tc:GetLevel(),tc:GetRank(),tc:GetLink())
--The owner can search a monster with different type and lower Level
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(aux.Stringid(id,1))
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetLabel(rac,val)
e1:SetCondition(s.srchcon)
e1:SetOperation(s.srchop)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tc:GetOwner())
end
end
function s.srcfilter(c,rac,lv)
return c:IsMonster() and c:IsAbleToHand() and not c:IsRace(rac) and c:GetLevel()<lv
end
function s.srchcon(e,tp,eg,ep,ev,re,r,rp)
local rac,lv=e:GetLabel()
return Duel.IsExistingMatchingCard(s.srcfilter,tp,LOCATION_DECK,0,1,nil,rac,lv)
end
function s.srchop(e,tp,eg,ep,ev,re,r,rp)
if not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end
Duel.Hint(HINT_CARD,1-tp,id)
local rac,lv=e:GetLabel()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.srcfilter,tp,LOCATION_DECK,0,1,1,nil,rac,lv)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(aux.FaceupFilter(Card.IsSetCard,SET_VEDA),1,nil)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SendtoHand(c,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,c)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can send 1 Normal Trap from your hand or that's Set on your field to the GY; Special Summon 1 Level 4 or lower Fiend monster from your Deck in Defense Position, except "Ariane the Labrynth Servant". If another monster(s) leaves the field by your Normal Trap effect (except during the Damage Step): You can draw 1 card, then you can apply this effect. ● From your hand, either Special Summon 1 Fiend monster, or Set 1 Spell/Trap. You can only use each effect of "Ariane the Labrynth Servant" once per turn.
|
--白銀の城の召使い アリアーヌ
--Ariane the Labrynth Servant
--Logical Nonsense
--Substitute ID
local s,id=GetID()
function s.initial_effect(c)
--Special Summon 1 Level 4 or lower Fiend monster from the Deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1,id)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(s.spcost)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Draw 1 card
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DRAW+CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,{id,1})
e2:SetCondition(s.drcon)
e2:SetTarget(s.drtg)
e2:SetOperation(s.drop)
c:RegisterEffect(e2)
end
--Mentions itself
s.listed_names={id}
--Send 1 Normal Trap from hand or field to GY as cost
function s.spcfilter(c,tp)
return c:IsNormalTrap() and c:IsAbleToGraveAsCost() and (c:IsLocation(LOCATION_HAND) or c:IsFacedown())
and Duel.GetMZoneCount(tp,c)>0
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.spcfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.spcfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil,tp)
Duel.SendtoGrave(g,REASON_COST)
end
--Activation legality
function s.spfilter(c,e,tp)
return c:IsRace(RACE_FIEND) and c:IsLevelBelow(4) 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)
if chk==0 then return 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
--Special Summon 1 Level 4 or lower Fiend monster from the Deck, except "Labrynth Servant Arianne"
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_DEFENSE)
end
end
--If a monster(s) leaves the field because of your Normal Trap's effect
function s.cfilter(c,re)
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT)
end
function s.drcon(e,tp,eg,ep,ev,re,r,rp)
return rp==tp and re and re:IsTrapEffect() and re:GetHandler():GetOriginalType()==TYPE_TRAP
and eg:IsExists(s.cfilter,1,nil)
end
--Activation legality
function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(1)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
end
--Draw 1 card, then you can Special Summon 1 Fiend monster, or Set 1 Spell/Trap, from hand
function s.ffilter(c,e,tp)
return c:IsRace(RACE_FIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.stfilter(c)
return c:IsSpellTrap() and c:IsSSetable()
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
local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.ffilter,tp,LOCATION_HAND,0,1,nil,e,tp)
local b2=Duel.IsExistingMatchingCard(s.stfilter,tp,LOCATION_HAND,0,1,nil)
if (b1 or b2) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
local op=Duel.SelectEffect(tp,
{b1,aux.Stringid(id,3)},
{b2,aux.Stringid(id,4)})
if op==1 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.ffilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if #g>0 then
Duel.BreakEffect()
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
elseif op==2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET)
local g=Duel.SelectMatchingCard(tp,s.stfilter,tp,LOCATION_HAND,0,1,1,nil)
if #g>0 then
Duel.BreakEffect()
Duel.SSet(tp,g,tp,false)
end
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Cannot be Normal Summoned or Set. Must first be Special Summoned (from your hand) to your opponent's side of the field by Special Summoning 2 "Grinder Tokens" (Fiend-Type/DARK/Level 1/ATK 0/DEF 0) in face-up Attack Position on your side of the field. If you Special Summon this monster, you cannot Normal Summon or Set a monster during the same turn.
|
--トーチ・ゴーレム
--Grinder Golem
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--special summon
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SPSUM_PARAM)
e1:SetRange(LOCATION_HAND)
e1:SetTargetRange(POS_FACEUP,1)
e1:SetCondition(s.spcon)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--spsummon cost
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_SPSUMMON_COST)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCost(s.spcost)
e2:SetOperation(s.spcop)
c:RegisterEffect(e2)
end
s.listed_names={75732623}
function s.spcon(e,c)
if c==nil then return true end
local tp=c:GetControler()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0
and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
and Duel.IsPlayerCanSpecialSummonCount(tp,2)
and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_FIEND,ATTRIBUTE_DARK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
for i=1,2 do
local token=Duel.CreateToken(tp,id+1)
Duel.SpecialSummonStep(token,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
Duel.SpecialSummonComplete()
end
function s.spcost(e,c,tp)
return Duel.GetActivityCount(tp,ACTIVITY_NORMALSUMMON)==0
end
function s.spcop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetReset(RESET_PHASE|PHASE_END)
e1:SetTargetRange(1,0)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_MSET)
Duel.RegisterEffect(e2,tp)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Gains 200 ATK for each "Meklord" monster on the field, except this card. When this card is destroyed by battle and sent to the GY: You can Special Summon 1 "Meklord Army" monster from your Deck.
|
--機皇兵スキエル・アイン
--Meklord Army of Skiel
local s,id=GetID()
function s.initial_effect(c)
--atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(s.val)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetCondition(s.condition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
s.listed_series={SET_MEKLORD,SET_MEKLORD_ARMY}
function s.atkfilter(c)
return c:IsFaceup() and c:IsSetCard(SET_MEKLORD)
end
function s.val(e,c)
return Duel.GetMatchingGroupCount(s.atkfilter,0,LOCATION_MZONE,LOCATION_MZONE,c)*200
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE)
end
function s.filter(c,e,tp)
return c:IsSetCard(SET_MEKLORD_ARMY) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
This card cannot be Special Summoned. This card returns to its owner's hand during the End Phase of the turn it is Normal Summoned or flipped face-up. If this card inflicts Battle Damage to your opponent, they discard all cards in their hand during the next Draw Phase, before they draw.
|
--火之迦具土
--Hino-Kagu-Tsuchi
local s,id=GetID()
function s.initial_effect(c)
Spirit.AddProcedure(c,EVENT_SUMMON_SUCCESS,EVENT_FLIP)
--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)
--Opponent discards their hand next Draw Phase
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetCondition(function(_,tp,_,ep) return ep==1-tp end)
e2:SetOperation(s.hdreg)
c:RegisterEffect(e2)
end
function s.hdreg(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
--Discard hand in the Draw Phase
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PREDRAW)
e1:SetOperation(s.hdop)
e1:SetReset(RESET_PHASE|PHASE_DRAW)
Duel.RegisterEffect(e1,tp)
aux.RegisterClientHint(c,0,tp,0,1,aux.Stringid(id,1)):SetReset(RESET_PHASE|PHASE_DRAW)
end
function s.hdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND)
if #g>0 then
Duel.SendtoGrave(g,REASON_DISCARD|REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
"X-Cross Cannon" + "Y-Yare Head" + "Z-Zillion Tank" Must first be Special Summoned (from your Extra Deck) by banishing the above cards from your field and/or GY. Once per opponent's turn (Quick Effect): You can discard 1 card, then target 1 card your opponent controls; destroy it. You can banish this card from your field or GY and reveal 1 Level 8 LIGHT Machine Fusion Monster in your Extra Deck; Special Summon up to 3 of the Fusion Materials mentioned on it from your GY and/or banishment.
|
--XYZ-ハイパー・ドラゴン・キャノン
--XYZ-Hyper Dragon Cannon
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--Fusion Materials
Fusion.AddProcMix(c,true,true,70860415,6355563,33744268)
Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit)
--Destroy 1 card your opponent controls
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end)
e1:SetCost(s.descost)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
--Special Summon up to 3 materials whose names are mentioned on a Level 8 LIGHT Machine Fusion Monster in your Extra Deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE|LOCATION_GRAVE)
e2:SetCost(s.spcost)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
s.listed_names={70860415,6355563,33744268} --"X-Cross Cannon", "Y-Dragon Yearhead", "Z-Zillion Tank"
function s.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA)
end
function s.matfilter(c)
return c:IsAbleToRemoveAsCost() and (c:IsLocation(LOCATION_SZONE) or aux.SpElimFilter(c,false,true))
end
function s.contactfil(tp)
return Duel.GetMatchingGroup(s.matfilter,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,nil)
end
function s.contactop(g)
Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_MATERIAL)
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function s.revealfilter(c,e,tp)
return c:IsLevel(8) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION) and c.material
and not c:IsPublic() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp,c)
end
function s.spfilter(c,e,tp,fc)
return c:IsCode(table.unpack(fc.material)) and c:IsFaceup() and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToRemoveAsCost()
and Duel.IsExistingMatchingCard(s.revealfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end
Duel.Remove(c,POS_FACEUP,REASON_COST)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM)
local rc=Duel.SelectMatchingCard(tp,s.revealfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
Duel.ConfirmCards(1-tp,rc)
Duel.ShuffleExtra(tp)
e:SetLabelObject(rc)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if ft==0 then return end
ft=math.min(ft,3)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,ft,nil,e,tp,e:GetLabelObject())
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 Ritual Summon this card with "Mikanko Kagura". Cannot be destroyed by battle, also your opponent takes any battle damage you would have taken from battles involving this card. If you have this card in your hand or GY, and another "Mikanko" card in your GY: You can target 1 face-up monster on the field; equip this card to it as an Equip Spell. You can only use this effect of "Arahime the Manifested Mikanko" once per turn. Once per turn, during the End Phase, while this card is equipped to a monster: You can return this card and the equipped monster to the hand.
|
--アラヒメの御巫
--Arahime the Manifested Mikanko
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--Cannot be destroyed by battle
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
c:RegisterEffect(e1)
--Reflect battle damage
local e2=e1:Clone()
e2:SetCode(EFFECT_REFLECT_BATTLE_DAMAGE)
c:RegisterEffect(e2)
--Equip itself from the hand or GY to a monster
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_EQUIP)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_HAND|LOCATION_GRAVE)
e3:SetCountLimit(1,id)
e3:SetCondition(s.eqcond)
e3:SetTarget(s.eqtg)
e3:SetOperation(s.eqop)
c:RegisterEffect(e3)
--Return itself and the equipped monster to the hand
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_TOHAND)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_PHASE+PHASE_END)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1)
e4:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end)
e4:SetTarget(s.thtg)
e4:SetOperation(s.thop)
c:RegisterEffect(e4)
end
s.listed_names={16310544} --"Mikanko Kagura"
s.listed_series={SET_MIKANKO}
function s.eqcond(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,1,e:GetHandler(),SET_MIKANKO)
end
function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,tp,0)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if not (Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Equip(tp,c,tc,true)) then
Duel.SendtoGrave(c,REASON_RULE)
end
--Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetValue(function(_,c) return c==tc end)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
c:RegisterEffect(e1)
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=c:GetEquipTarget()
if chk==0 then return c:IsAbleToHand() and tc and tc:IsAbleToHand() end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,Group.FromCards(c,tc),2,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetEquipTarget()
if c:IsRelateToEffect(e) and tc then
local rg=Group.FromCards(c,tc)
Duel.SendtoHand(rg,nil,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
● While in Attack Position: Once per turn, you can Tribute 1 "Morphtronic" monster, except "Morphtronic Slingen", to destroy 1 card on the field. ● While in Defense Position: If this card would be destroyed, you can destroy another "Morphtronic" monster you control instead.
|
--D・パッチン
--Morphtronic Slingen
local s,id=GetID()
function s.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(s.descon)
e1:SetCost(s.descost)
e1:SetTarget(s.destg)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
--Destroy replace
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DESTROY_REPLACE)
e2:SetTarget(s.reptg)
e2:SetOperation(s.repop)
c:RegisterEffect(e2)
end
s.listed_series={SET_MORPHTRONIC}
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttackPos()
end
function s.cfilter(c)
return c:GetCode()~=id and c:IsSetCard(SET_MORPHTRONIC)
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e)
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end
local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg)
Duel.Release(g,REASON_COST)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
function s.repfilter(c,e)
return c:IsFaceup() and c:IsSetCard(SET_MORPHTRONIC)
and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED)
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsFaceup() and c:IsDefensePos()
and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_MZONE,0,1,c,e) end
if Duel.SelectEffectYesNo(tp,c,96) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_MZONE,0,1,1,c,e)
e:SetLabelObject(g:GetFirst())
g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true)
return true
else return false end
end
function s.repop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
tc:SetStatus(STATUS_DESTROY_CONFIRMED,false)
Duel.Destroy(tc,REASON_EFFECT|REASON_REPLACE)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
1 LIGHT Tuner + 1 or more non-Tuner monsters Equip Cards equipped to this card cannot be targeted by cards or effects. Once per turn: You can send 1 Equip Card equipped to this card to the Graveyard to target 1 monster your opponent controls; destroy that target.
|
--ヴァイロン・エプシロン
--Vylon Epsilon
local s,id=GetID()
function s.initial_effect(c)
--synchro summon
Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT),1,1,Synchro.NonTuner(nil),1,99)
c:EnableReviveLimit()
--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_SZONE,LOCATION_SZONE)
e1:SetTarget(s.uttg)
e1:SetValue(1)
c:RegisterEffect(e1)
--destroy
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCost(s.descost)
e2:SetTarget(s.destg)
e2:SetOperation(s.desop)
c:RegisterEffect(e2)
end
function s.uttg(e,c)
return e:GetHandler():GetEquipGroup():IsContains(c)
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetEquipGroup():IsExists(Card.IsAbleToGraveAsCost,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=e:GetHandler():GetEquipGroup():FilterSelect(tp,Card.IsAbleToGraveAsCost,1,1,nil)
Duel.SendtoGrave(g,REASON_COST)
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(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,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) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
1 Machine monster + 1 Dinosaur monster Gains ATK equal to the original ATK of the Dinosaur monster used for its Fusion Summon. You can only use each of the following effects of "Dyna Tank" once per turn. When a card or effect is activated that targets this 1 card on the field (and no other cards) (Quick Effect): You can target 1 other card on the field that would be an appropriate target; that card or effect now targets the new target. If this card in its owner's possession is destroyed by an opponent's card: You can Special Summon 1 Dinosaur monster from your GY.
|
--ダイナ・タンク
--Dyna Tank
--Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--1 Machine monster + 1 Dinosaur monster
Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsRace,RACE_MACHINE),aux.FilterBoolFunctionEx(Card.IsRace,RACE_DINOSAUR))
--Gain ATK
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetCode(EFFECT_MATERIAL_CHECK)
e0:SetValue(s.atkval)
c:RegisterEffect(e0)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetLabelObject(e0)
e1:SetCondition(s.atkcon)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--Replace target
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCode(EVENT_CHAINING)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.tarcon)
e2:SetTarget(s.tartg)
e2:SetOperation(s.tarop)
c:RegisterEffect(e2)
--Special Summon 1 Dinosaur monster
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_DESTROYED)
e3:SetCountLimit(1,{id,1})
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.atkval(e,c)
local g=c:GetMaterial():Filter(Card.IsRace,nil,RACE_DINOSAUR)
e:SetLabel(#g==1 and g:GetFirst():GetBaseAttack() or 0)
end
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsFusionSummoned()
end
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local atk=e:GetLabelObject():GetLabel()
if atk>0 then
local c=e:GetHandler()
--Increase ATK
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(atk)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
c:RegisterEffect(e1)
end
end
function s.tarcon(e,tp,eg,ep,ev,re,r,rp)
if e==re or not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end
local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS)
return #g==1 and g:GetFirst()==e:GetHandler()
end
function s.tarfilter(c,ev)
return Duel.CheckChainTarget(ev,c)
end
function s.tartg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return c~=chkc and chkc:IsLocation(LOCATION_ONFIELD) and s.tarfilter(chkc,ev) end
if chk==0 then return Duel.IsExistingTarget(s.tarfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c,ev) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,s.tarfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,c,ev)
end
function s.tarop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.ChangeTargetCard(ev,Group.FromCards(tc))
end
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsPreviousControler(tp) and rp==1-tp
end
function s.spfilter(c,e,tp)
return c:IsRace(RACE_DINOSAUR) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
All Winged Beast monsters gain 200 ATK/DEF. If any "Harpie Lady" or "Harpie Lady Sisters" is Normal or Special Summoned: The player who conducted the Summon activates this effect by targeting 1 Spell/Trap on the field; they destroy it. * The above text is unofficial and describes the card's functionality in the OCG.
|
--ハーピィの狩場
--Harpies' Hunting Ground
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)
--trigger
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DESTROY)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetRange(LOCATION_FZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_EVENT_PLAYER)
e2:SetCode(EVENT_CUSTOM+id)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
--atk/def
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_UPDATE_ATTACK)
e3:SetRange(LOCATION_FZONE)
e3:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_WINGEDBEAST))
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetValue(200)
c:RegisterEffect(e3)
local e4=e3:Clone()
e4:SetCode(EFFECT_UPDATE_DEFENSE)
c:RegisterEffect(e4)
aux.GlobalCheck(s,function()
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SUMMON_SUCCESS)
ge1:SetOperation(s.check)
Duel.RegisterEffect(ge1,0)
local ge2=ge1:Clone()
ge2:SetCode(EVENT_SPSUMMON_SUCCESS)
Duel.RegisterEffect(ge2,0)
end)
end
s.listed_names={CARD_HARPIE_LADY,CARD_HARPIE_LADY_SISTERS}
function s.check(e,tp,eg,ep,ev,re,r,rp)
local g1=Group.CreateGroup()
local g2=Group.CreateGroup()
for tc in aux.Next(eg) do
if tc:IsFaceup() and tc:IsCode(CARD_HARPIE_LADY,CARD_HARPIE_LADY_SISTERS) then
if tc:IsControler(0) then g1:AddCard(tc) else g2:AddCard(tc) end
end
end
if #g1>0 then Duel.RaiseEvent(g1,EVENT_CUSTOM+id,re,r,rp,0,0) end
if #g2>0 then Duel.RaiseEvent(g2,EVENT_CUSTOM+id,re,r,rp,1,0) end
end
function s.filter(c)
return c:IsSpellTrap()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and s.filter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 Level 4 "Butterspy" monsters You can detach 1 Xyz Material from this card; return all monsters on the field to the hand, then inflict 300 damage to each player for each card returned to their hand.
|
--フォトン・アレキサンドラ・クィーン
--Photon Alexandra Queen
local s,id=GetID()
function s.initial_effect(c)
--xyz summon
Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_BUTTERSPY),4,2)
c:EnableReviveLimit()
--return
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(Cost.DetachFromSelf(1))
e1:SetTarget(s.rettg)
e1:SetOperation(s.retop)
c:RegisterEffect(e1)
end
s.listed_series={SET_BUTTERSPY}
function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0)
end
function s.hfilter(c,tp)
return c:IsLocation(LOCATION_HAND) and c:IsControler(tp)
end
function s.retop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsAbleToHand,tp,LOCATION_MZONE,LOCATION_MZONE,nil)
if #g==0 then return end
Duel.SendtoHand(g,nil,REASON_EFFECT)
local ct1=g:FilterCount(s.hfilter,nil,tp)
local ct2=g:FilterCount(s.hfilter,nil,1-tp)
Duel.Damage(tp,ct1*300,REASON_EFFECT,true)
Duel.Damage(1-tp,ct2*300,REASON_EFFECT,true)
Duel.RDComplete()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Control of this face-up card cannot switch. During the End Phase, if this card destroyed a monster by battle this turn: You can send this face-up card to the Graveyard; Special Summon 1 "Horus the Black Flame Dragon LV6" from your hand or Deck.
|
--ホルスの黒炎竜 LV4
--Horus the Black Flame Dragon LV4
local s,id=GetID()
function s.initial_effect(c)
--battle destroy
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_BATTLE_DESTROYING)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetOperation(s.bdop)
c:RegisterEffect(e1)
--control
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e2:SetRange(LOCATION_MZONE)
e2:SetCode(EFFECT_CANNOT_CHANGE_CONTROL)
c:RegisterEffect(e2)
--special summon
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e3:SetRange(LOCATION_MZONE)
e3:SetCode(EVENT_PHASE+PHASE_END)
e3:SetCondition(s.spcon)
e3:SetCost(Cost.SelfToGrave)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
s.listed_names={11224103}
s.LVnum=4
s.LVset=SET_HORUS_BLACK_FLAME_DRAGON
function s.bdop(e,tp,eg,ep,ev,re,r,rp)
e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)>0
end
function s.spfilter(c,e,tp)
return c:IsCode(11224103) and c:IsCanBeSpecialSummoned(e,0,tp,true,true)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if e:GetHandler():GetSequence()<5 then ft=ft+1 end
if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp):GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,true,true,POS_FACEUP)>0 then
tc:CompleteProcedure()
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When a Spell/Trap Card is activated, if you have no monsters in your Graveyard: Negate the activation, and if you do, return it to the hand, then, if you control a face-up "Madolche Puddingcess", you can destroy 1 card your opponent controls.
|
--マドルチェ・ティーブレイク
--Madolche Tea Break
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_NEGATE+CATEGORY_TOHAND+CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_names={74641045}
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsExistingMatchingCard(Card.IsMonster,tp,LOCATION_GRAVE,0,1,nil)
and re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev)
end
function s.cfilter(c)
return c:IsFaceup() and c:IsCode(74641045)
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():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_TOHAND,eg,1,0,0)
end
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local ec=re:GetHandler()
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
ec:CancelToGrave()
Duel.SendtoHand(ec,nil,REASON_EFFECT)
end
if Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)
and Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil)
and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.HintSelection(g)
Duel.BreakEffect()
Duel.Destroy(g,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 Level 4 "Bujin" monsters This card can attack all monsters your opponent controls once each. Once per turn: You can detach 1 Xyz Material from this card; take 1 "Bujin" monster from your Deck, and either add it to your hand or send it to the Graveyard. You can only control 1 "Bujintei Susanowo".
|
--武神帝-スサノヲ
--Bujintei Susanowo
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
--xyz summon
Xyz.AddProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,SET_BUJIN),4,2)
c:EnableReviveLimit()
--search
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DECKDES)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetCountLimit(1)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(Cost.DetachFromSelf(1))
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--attack all
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_ATTACK_ALL)
e2:SetValue(1)
c:RegisterEffect(e2)
end
s.listed_series={SET_BUJIN}
function s.filter(c)
return c:IsSetCard(SET_BUJIN) and c:IsMonster() and (c:IsAbleToHand() or c:IsAbleToGrave())
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
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)
aux.ToHandOrElse(g:GetFirst(),tp)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
During your opponent's Main Phase, if this card is in your hand (Quick Effect): You can target 1 Dragon Synchro Monster in your GY; Special Summon this card, and if you do, Special Summon that monster but negate its effects, then immediately after this effect resolves, you can Synchro Summon 1 Dragon Synchro Monster using this card you control. You can only use this effect of "Shining Star Dragon" once per turn. A Dragon monster that was Synchro Summoned using this card as material cannot be destroyed by battle.
|
--輝ける星の竜
--Shining Star Dragon
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
--Special Summon itself and a Dragon Synchro from your GY
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_QUICK_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetRange(LOCATION_HAND)
e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER)
e1:SetCountLimit(1,id)
e1:SetCondition(function(e,tp) return Duel.IsMainPhase() and Duel.IsTurnPlayer(1-tp) end)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--A Dragon Synchro Monster summoned using this card cannot be destroyed by battle
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e2:SetCode(EVENT_BE_MATERIAL)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return r&REASON_SYNCHRO>0 and e:GetHandler():GetReasonCard():IsRace(RACE_DRAGON) end)
e2:SetOperation(s.efop)
c:RegisterEffect(e2)
end
function s.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end
local c=e:GetHandler()
if chk==0 then return Duel.GetMZoneCount(tp)>=2
and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
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:AddCard(c),2,tp,0)
Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.synchfilter(c,mc)
return c:IsRace(RACE_DRAGON) and c:IsSynchroSummonable(mc)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsRelateToEffect(e) and Duel.SpecialSummonStep(c,0,tp,tp,false,false,POS_FACEUP)
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and tc:IsRelateToEffect(e)
and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then
tc:NegateEffects(c)
end
if Duel.SpecialSummonComplete()~=2 then return end
--Synchro Summon 1 Dragon Synchro Monster using this card you control
local synchg=Duel.GetMatchingGroup(s.synchfilter,tp,LOCATION_EXTRA,0,nil,c)
if #synchg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sc=synchg:Select(tp,1,1,nil):GetFirst()
if sc then
Duel.BreakEffect()
Duel.SynchroSummon(tp,sc,c)
end
end
end
function s.efop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local rc=c:GetReasonCard()
--Cannot be destroyed by battle
local e1=Effect.CreateEffect(c)
e1:SetDescription(3000)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetValue(1)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
rc:RegisterEffect(e1)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If this card is Summoned: You can add 1 "tellarknight" monster from your Deck to your hand, except "Satellarknight Deneb". You can only use this effect of "Satellarknight Deneb" once per turn.
|
--星因士 デネブ
--Satellarknight Deneb
local s,id=GetID()
function s.initial_effect(c)
--Add 1 "tellarknight" monster from your Deck to your hand, except "Satellarknight Deneb"
local e1a=Effect.CreateEffect(c)
e1a:SetDescription(aux.Stringid(id,0))
e1a:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1a:SetProperty(EFFECT_FLAG_DELAY)
e1a:SetCode(EVENT_SUMMON_SUCCESS)
e1a:SetCountLimit(1,id)
e1a:SetTarget(s.thtg)
e1a:SetOperation(s.thop)
c:RegisterEffect(e1a)
local e1b=e1a:Clone()
e1b:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e1b)
local e1c=e1a:Clone()
e1c:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e1c)
end
s.listed_series={SET_TELLARKNIGHT}
s.listed_names={id}
function s.thfilter(c)
return c:IsSetCard(SET_TELLARKNIGHT) and c:IsMonster() 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:
|
If an "Armed Dragon" monster(s) and/or a LIGHT Machine Fusion Monster(s) you control would be destroyed by battle or card effect, you can banish 1 "Ojama" card from your hand, face-up field, or GY instead. You can only use each of the following effects of "Ojama Pajama" once per turn. ● During the Main Phase: You can add 1 "Ojama" card from your Deck to your hand, then discard 1 card. ● If this card is sent to the GY: You can Special Summon as many of your banished "Ojama" monsters as possible.
|
--おジャマパーティ
--Ojama Pajama
--Scripted by Eerie Code
local s,id=GetID()
function s.initial_effect(c)
--activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--search
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_HANDES)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.thcon)
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
--destroy replace
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_DESTROY_REPLACE)
e3:SetRange(LOCATION_SZONE)
e3:SetTarget(s.reptg)
e3:SetValue(s.repval)
e3:SetOperation(s.repop)
c:RegisterEffect(e3)
--spsummon
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e4:SetCode(EVENT_TO_GRAVE)
e4:SetProperty(EFFECT_FLAG_DELAY)
e4:SetCountLimit(1,{id,1})
e4:SetTarget(s.sptg)
e4:SetOperation(s.spop)
c:RegisterEffect(e4)
end
s.listed_series={SET_OJAMA,SET_ARMED_DRAGON}
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return Duel.IsMainPhase()
end
function s.thfilter(c)
return c:IsSetCard(SET_OJAMA) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then
Duel.ConfirmCards(1-tp,g)
Duel.BreakEffect()
Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT|REASON_DISCARD,nil)
end
end
function s.repfilter(c,tp)
return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_ONFIELD)
and ((c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION)) or (c:IsSetCard(SET_ARMED_DRAGON) and c:IsMonster()))
and (c:IsReason(REASON_BATTLE) or c:IsReason(REASON_EFFECT)) and not c:IsReason(REASON_REPLACE)
end
function s.desfilter(c,e,tp)
return ((c:IsFaceup() and c:IsLocation(LOCATION_ONFIELD)) or c:IsLocation(LOCATION_HAND|LOCATION_GRAVE)) and c:IsControler(tp) and c:IsSetCard(SET_OJAMA)
and c:IsAbleToRemove() and not c:IsStatus(STATUS_DESTROY_CONFIRMED+STATUS_BATTLE_DESTROYED)
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return eg:IsExists(s.repfilter,1,nil,tp)
and Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_ONFIELD|LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end
if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE)
local g=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_ONFIELD|LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp)
e:SetLabelObject(g:GetFirst())
g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true)
return true
end
return false
end
function s.repval(e,c)
return s.repfilter(c,e:GetHandlerPlayer())
end
function s.repop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_CARD,1-tp,id)
local tc=e:GetLabelObject()
tc:SetStatus(STATUS_DESTROY_CONFIRMED,false)
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT|REASON_REPLACE)
end
function s.spfilter(c,e,tp)
return c:IsFaceup() and c:IsSetCard(SET_OJAMA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-1
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,ft,tp,LOCATION_REMOVED)
end
function s.spop(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.spfilter,tp,LOCATION_REMOVED,0,ft,ft,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 sent from the Monster Card Zone to the Graveyard: You can pay 500 Life Points to target 1 face-up monster you control; equip this card to that target. You can send this Equip Card to the Graveyard to target 1 Equip Spell Card in your Graveyard; equip that target to the monster this card was equipped to.
|
--ヴァイロン・スフィア
--Vylon Sphere
local s,id=GetID()
function s.initial_effect(c)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCondition(s.eqcon)
e1:SetCost(Cost.PayLP(500))
e1:SetTarget(s.eqtg)
e1:SetOperation(s.eqop)
c:RegisterEffect(e1)
--equip2
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCategory(CATEGORY_EQUIP)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_SZONE)
e2:SetCost(s.eqcost2)
e2:SetTarget(s.eqtg2)
e2:SetOperation(s.eqop2)
c:RegisterEffect(e2)
end
function s.eqcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return c:GetPreviousLocation()==LOCATION_MZONE
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 chkc:IsFaceup() end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil)
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) then
Duel.Equip(tp,c,tc)
--equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(s.eqlimit)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
c:RegisterEffect(e1)
end
end
function s.eqlimit(e,c)
local tp=e:GetHandlerPlayer()
return c:IsControler(tp)
end
function s.eqcost2(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():IsAbleToGraveAsCost() end
e:SetLabelObject(e:GetHandler():GetEquipTarget())
Duel.SendtoGrave(e:GetHandler(),REASON_COST)
end
function s.filter2(c,ec)
return c:IsType(TYPE_EQUIP) and c:CheckEquipTarget(ec)
end
function s.eqtg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local ec=e:GetHandler():GetEquipTarget()
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter2(chkc,ec) end
if chk==0 then return ec and Duel.IsExistingTarget(s.filter2,tp,LOCATION_GRAVE,0,1,nil,ec) end
Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2))
Duel.SelectTarget(tp,s.filter2,tp,LOCATION_GRAVE,0,1,1,nil,e:GetLabelObject())
e:GetLabelObject():CreateEffectRelation(e)
end
function s.eqop2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
local ec=e:GetLabelObject()
if tc:IsRelateToEffect(e) then
Duel.Equip(tp,tc,ec)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If this card is Special Summoned by the effect of a "Dream Mirror" monster: You can Special Summon 1 "Dream Mirror" monster from your hand, except "Ikelos, the Dream Mirror Mara". During the Main or Battle Phase, if "Dream Mirror of Joy" is in a Field Zone (Quick Effect): You can Tribute this card; Special Summon 1 "Ikelos, the Dream Mirror Sprite" from your Deck. You can only use each effect of "Ikelos, the Dream Mirror Mara" once per turn.
|
--夢魔鏡の夢魔-イケロス
--Ikelos, the Dream Mirror Mara
--Scripted by Eerie Code
local s,id=GetID()
function s.initial_effect(c)
--Special summon 1 "Dream Mirror" monster from 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:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
e1:SetCountLimit(1,id)
e1:SetCondition(s.spcon)
e1:SetTarget(s.sptg)
e1:SetOperation(s.spop)
c:RegisterEffect(e1)
--Special summon 1 "Ikelos, the Dream Mirror Sprite" from deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END|TIMING_BATTLE_START|TIMING_BATTLE_END)
e2:SetCountLimit(1,{id,1})
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.dspcon)
e2:SetCost(Cost.SelfTribute)
e2:SetTarget(s.dsptg)
e2:SetOperation(s.dspop)
c:RegisterEffect(e2)
end
s.listed_names={49389190,CARD_DREAM_MIRROR_JOY}
s.listed_series={SET_DREAM_MIRROR}
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
if not re then return false end
return re:IsMonsterEffect() and re:GetHandler():IsSetCard(SET_DREAM_MIRROR)
end
function s.spfilter(c,e,tp)
return c:IsSetCard(SET_DREAM_MIRROR) 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 Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp)
if #g>0 then
Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)
end
end
function s.dspcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_DREAM_MIRROR_JOY),tp,LOCATION_FZONE,LOCATION_FZONE,1,nil)
and (Duel.IsMainPhase() or Duel.IsBattlePhase())
end
function s.dspfilter(c,e,tp)
return c:IsCode(49389190) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.dsptg(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.dspfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function s.dspop(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.dspfilter,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:
|
Cannot be Special Summoned. If you control no monsters, or all monsters you control are EARTH Machine monsters, you can Normal Summon this card without Tributing. When your opponent activates a Spell/Trap Card or effect (Quick Effect): You can send to the GY, 1 Machine monster from your hand or face-up field, or 1 "Ancient Gear Golem" from your Deck; negate that effect. You can only use this effect of "Ancient Gear Dragon" once per turn.
|
--古代の機械竜
--Ancient Gear Dragon
local s,id=GetID()
function s.initial_effect(c)
c:AddCannotBeSpecialSummoned()
--Normal Summon this card without Tributing
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SUMMON_PROC)
e1:SetCondition(s.nscon)
c:RegisterEffect(e1)
--Negate an opponent's activated Spell/Trap Card or effect
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)
e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp and re:IsSpellTrapEffect() and Duel.IsChainDisablable(ev) end)
e2:SetCost(s.discost)
e2:SetTarget(s.distg)
e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end)
c:RegisterEffect(e2)
--"Double Snare" check
aux.DoubleSnareValidity(c,LOCATION_MZONE)
end
s.listed_names={CARD_ANCIENT_GEAR_GOLEM} --"Ancient Gear Golem"
function s.nsconfilter(c)
return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_MACHINE)
end
function s.nscon(e)
local tp=e:GetHandlerPlayer()
if Duel.GetLocationCount(tp,LOCATION_MZONE)==0 then return false end
local g=Duel.GetFieldGroup(tp,LOCATION_MZONE,0)
return #g==0 or g:FilterCount(s.nsconfilter,nil)==#g
end
function s.discostfilter(c)
if not c:IsAbleToGraveAsCost() then return false end
if c:IsLocation(LOCATION_DECK) then
return c:IsCode(CARD_ANCIENT_GEAR_GOLEM)
else
return c:IsRace(RACE_MACHINE) and (c:IsFaceup() or c:IsLocation(LOCATION_HAND))
end
end
function s.discost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.discostfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_DECK,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=Duel.SelectMatchingCard(tp,s.discostfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_DECK,0,1,1,nil)
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_DISABLE,eg,1,0,0)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can Ritual Summon this card with "Armor Dragon Ritual". At the start of the Damage Step, if this card battles a monster that was Special Summoned from the Extra Deck: You can shuffle that monster into the Deck. You can Tribute this card; Special Summon 1 Level 5 or higher WIND Dragon monster from your hand or Deck. You can only use each effect of "Knight of Armor Dragon" once per turn.
|
--鎧竜の聖騎士
--Knight of Armor Dragon
--Logical Nonsense
--Substitute ID
local s,id=GetID()
function s.initial_effect(c)
--Must be properly summoned before reviving
c:EnableReviveLimit()
--Shuffle battle target into deck
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TODECK)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetCode(EVENT_BATTLE_START)
e1:SetCountLimit(1,id)
e1:SetCondition(s.atkcon)
e1:SetTarget(s.atktg)
e1:SetOperation(s.atkop)
c:RegisterEffect(e1)
--Special summon 1 level 5+ WIND dragon monster from hand or deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,{id,1})
e2:SetCost(Cost.SelfTribute)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
s.listed_names={58827995}
--If this card battles a monster that was special summoned from extra deck
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local bc=c:GetBattleTarget()
return bc and bc:IsSummonLocation(LOCATION_EXTRA)
end
--Activation legality
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
local d=Duel.GetAttackTarget()
if chk==0 then return d:IsAbleToDeck() end
Duel.SetOperationInfo(0,CATEGORY_TODECK,d,1,0,0)
end
--Shuffle the battle target into deck
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetBattleTarget()
if tc:IsRelateToBattle() then
Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
--Tribute itself as cost
--Check for a level 5+ WIND dragon monster
function s.spfilter(c,e,tp)
return c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_WIND) and c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
--Activation legality
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
if e:GetHandler():GetSequence()<5 then ft=ft+1 end
if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND)
end
--Special summon 1 level 5+ WIND dragon monster from hand or deck
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|LOCATION_HAND,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc then
Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When an opponent's monster that was Normal or Special Summoned this turn declares an attack: Destroy that attacking monster, and if you do, inflict damage to your opponent equal to half the original ATK of that monster.
|
--串刺しの落とし穴
--Trap Hole of Spikes
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
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 at=Duel.GetAttacker()
return at:IsControler(1-tp) and at:IsStatus(STATUS_SUMMON_TURN+STATUS_SPSUMMON_TURN)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local at=Duel.GetAttacker()
if chk==0 then return at:IsRelateToBattle() end
local dam=math.max(at:GetBaseAttack()/2,0)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,at,1,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local at=Duel.GetAttacker()
if at:IsRelateToBattle() and Duel.Destroy(at,REASON_EFFECT)~=0 then
local atk=at:GetBaseAttack()/2
if atk>0 then
Duel.Damage(1-tp,atk,REASON_EFFECT)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
"VWXYZ-Dragon Catapult Cannon" + "Armed Dragon LV7" Must first be Special Summoned (from your Extra Deck) during a Duel you Special Summoned both the above cards, by banishing the above cards from your field and/or GY. (You do not use "Polymerization".) Your opponent cannot activate cards or effects with the same name as any banished card. Once per turn, during your opponent's turn (Quick Effect): You can banish 1 card from your Deck or Extra Deck, face-up; banish all cards your opponent controls and in their GY.
|
--アームド・ドラゴン・カタパルトキャノン
--Armed Dragon Catapult Cannon
local s,id=GetID()
function s.initial_effect(c)
--fusion material
c:EnableReviveLimit()
Fusion.AddProcMix(c,true,true,84243274,73879377)
Fusion.AddContactProc(c,s.contactfil,s.contactop,s.splimit,s.spcon)
--inactivate
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_CANNOT_ACTIVATE)
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(0,1)
e3:SetValue(s.aclimit)
c:RegisterEffect(e3)
--banish
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,0))
e4:SetCategory(CATEGORY_REMOVE)
e4:SetType(EFFECT_TYPE_QUICK_O)
e4:SetCode(EVENT_FREE_CHAIN)
e4:SetRange(LOCATION_MZONE)
e4:SetCountLimit(1)
e4:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E)
e4:SetCondition(s.rmcon)
e4:SetCost(s.rmcost)
e4:SetTarget(s.rmtg)
e4:SetOperation(s.rmop)
c:RegisterEffect(e4)
--register summon
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.regop)
Duel.RegisterEffect(ge1,0)
end)
end
s.listed_names={84243274,73879377}
function s.reg(c)
if c:IsCode(84243274) then
Duel.RegisterFlagEffect(c:GetControler(),id,0,0,0)
elseif c:IsCode(73879377) then
Duel.RegisterFlagEffect(c:GetControler(),id+1,0,0,0)
end
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
eg:ForEach(s.reg)
end
function s.splimit(e,se,sp,st)
return e:GetHandler():GetLocation()~=LOCATION_EXTRA
end
function s.contactfil(tp)
return Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,LOCATION_ONFIELD|LOCATION_GRAVE,0,nil)
end
function s.contactop(g)
Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_MATERIAL)
end
function s.spcon(tp)
return Duel.GetFlagEffect(tp,id)~=0 and Duel.GetFlagEffect(tp,id+1)~=0
end
function s.acfilter(c,cd)
return c:IsFaceup() and c:IsCode(cd)
end
function s.aclimit(e,re,tp)
return Duel.IsExistingMatchingCard(s.acfilter,e:GetHandlerPlayer(),LOCATION_REMOVED,LOCATION_REMOVED,1,nil,re:GetHandler():GetCode())
end
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(1-tp)
end
function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemoveAsCost,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemoveAsCost,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil)
Duel.Remove(g,POS_FACEUP,REASON_COST)
end
function s.rmfilter(c)
return c:IsAbleToRemove() and (c:IsLocation(LOCATION_SZONE) or aux.SpElimFilter(c,false,true))
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,nil)
if chk==0 then return #g>0 end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD|LOCATION_GRAVE,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:
|
This card cannot be Normal Summoned or Set. This card cannot be Special Summoned except with "Trial of the Princesses". During your Standby Phase, gain 800 Life Points for each monster you control.
|
--魔法の国の王女-ピケル
--Princess Pikeru
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--recover
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_RECOVER)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_PHASE|PHASE_STANDBY)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.condition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return tp==Duel.GetTurnPlayer()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
local ct=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,ct*800)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
local ct=Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)
Duel.Recover(p,ct*800,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If you control a Level/Link 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Red" once per turn this way. When your opponent activates a monster effect (Quick Effect): You can Tribute 1 other Level/Rank/Link 2 monster; negate that effect, then if you Tributed a Rank/Link 2 monster to activate this effect, you can destroy that monster. You can only use this effect of "Spright Red" once per turn.
|
--スプライト・レッド
--Spright Red
--Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
--Special Summon self
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--Negate monster effect
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DISABLE+CATEGORY_DESTROY)
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(s.discost)
e2:SetTarget(s.distg)
e2:SetOperation(s.disop)
c:RegisterEffect(e2)
end
function s.spconfilter(c)
return c:IsFaceup() and (c:IsLevel(2) or c:IsLink(2))
end
function s.spcon(e,c)
if c==nil then return true end
local tp=e:GetHandlerPlayer()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
return rp==1-tp and re:IsMonsterEffect() and Duel.IsChainDisablable(ev)
end
function s.discostfilter(c)
return c:IsLevel(2) or c:IsRank(2) or c:IsLink(2)
end
function s.discost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.discostfilter,1,false,nil,c) end
local rc=Duel.SelectReleaseGroupCost(tp,s.discostfilter,1,1,false,nil,c):GetFirst()
e:SetLabel(rc:GetLevel())
Duel.Release(rc,REASON_COST)
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return not re:GetHandler():IsDisabled() end
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateEffect(ev) and re:GetHandler():IsRelateToEffect(re)
and e:GetLabel()==0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.Destroy(eg,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
"Robolady" + "Roboyarou" You can Special Summon "Super Roboyarou" by returning this card from the field to the Extra Deck. You cannot use this effect during the same turn this monster is Special Summoned. In addition, increase the ATK of this monster by 1000 points during the Damage Step when this monster inflicts Direct Damage to your opponent's Life Points.
|
--レアメタル・ヴァルキリー
--Super Robolady
local s,id=GetID()
function s.initial_effect(c)
--Fusion Material
c:EnableReviveLimit()
Fusion.AddProcMix(c,true,true,92421852,38916461)
--Increase ATK
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCondition(s.atkcon)
e1:SetValue(1000)
c:RegisterEffect(e1)
--Special Summon "Super Roboyarou"
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
s.listed_names={1412158}
function s.atkcon(e)
local ph=Duel.GetCurrentPhase()
if not (ph==PHASE_DAMAGE or ph==PHASE_DAMAGE_CAL) then return false end
return Duel.GetAttacker()==e:GetHandler() and not Duel.GetAttackTarget()
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetTurnID()~=Duel.GetTurnCount()
end
function s.spfilter(c,e,tp,mc)
return c:IsCode(1412158) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:GetOwner()==tp and c:IsAbleToExtra()
and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end
Duel.SetOperationInfo(0,CATEGORY_TODECK,c,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 not (c:IsRelateToEffect(e) and c:IsFaceup()) then return end
if Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c)
if #sg==0 then return end
Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When your opponent activates a card or effect: Draw cards equal to the number of Level 8 or higher LIGHT Machine Fusion Monsters you control. During your Standby Phase: You can banish this card from your GY; shuffle up to 6 of your banished LIGHT Machine monsters into the Deck, including a Union monster. You can only use each effect of "A-to-Z Energy Load" once per turn.
|
--AtoZエナジーロード
--A-to-Z Energy Load
--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_DRAW)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_CHAINING)
e1:SetCountLimit(1,id)
e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp end)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Shuffle up to 6 of your banished LIGHT Machine monsters into the Deck, including a Union monster
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_TODECK)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_GRAVE)
e2:SetCountLimit(1,{id,1})
e2:SetHintTiming(TIMING_STANDBY_PHASE)
e2:SetCondition(function(e,tp) return Duel.IsPhase(PHASE_STANDBY) and Duel.IsTurnPlayer(tp) end)
e2:SetCost(Cost.SelfBanish)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
end
s.listed_card_types={TYPE_UNION}
function s.drawcountfilter(c)
return c:IsLevelAbove(8) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_FUSION) and c:IsFaceup()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local ct=Duel.GetMatchingGroupCount(s.drawcountfilter,tp,LOCATION_MZONE,0,nil)
if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end
Duel.SetTargetPlayer(tp)
Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local ct=Duel.GetMatchingGroupCount(s.drawcountfilter,tp,LOCATION_MZONE,0,nil)
if ct==0 then return end
local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER)
Duel.Draw(p,ct,REASON_EFFECT)
end
function s.tdfilter(c)
return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsFaceup() and c:IsAbleToDeck()
end
function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then
local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil)
return g:IsExists(Card.IsType,1,nil,TYPE_UNION)
end
Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_REMOVED)
end
function s.rescon(sg,e,tp,mg)
return sg:IsExists(Card.IsType,1,nil,TYPE_UNION)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(s.tdfilter,tp,LOCATION_REMOVED,0,nil)
local sg=aux.SelectUnselectGroup(g,e,tp,1,6,s.rescon,1,tp,HINTMSG_TODECK,s.rescon)
if #sg>0 then
Duel.HintSelection(sg)
Duel.SendtoDeck(sg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If you control no monsters, you can Normal Summon this card without Tributing. When this card is Special Summoned, place 3 counters on it. This card cannot be destroyed by battle. If this card attacks or is attacked, remove 1 counter from this card at the end of the Damage Step. If you cannot, destroy it.
|
--巨大戦艦 ビッグ・コアMk-Ⅱ
--B.E.S. Big Core MK-2
local s,id=GetID()
function s.initial_effect(c)
c:EnableCounterPermit(0x1f)
--spsummon success
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_COUNTER)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetTarget(s.addct)
e1:SetOperation(s.addc)
c:RegisterEffect(e1)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e2:SetValue(1)
c:RegisterEffect(e2)
--remove counter
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e3:SetCode(EVENT_DAMAGE_STEP_END)
e3:SetCondition(s.rctcon)
e3:SetOperation(s.rctop)
c:RegisterEffect(e3)
--destroy
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,2))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e4:SetCode(EVENT_DAMAGE_STEP_END)
e4:SetCondition(s.descon)
e4:SetTarget(s.destg)
e4:SetOperation(s.desop)
c:RegisterEffect(e4)
--summon with no tribute
local e5=Effect.CreateEffect(c)
e5:SetDescription(aux.Stringid(id,3))
e5:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e5:SetType(EFFECT_TYPE_SINGLE)
e5:SetCode(EFFECT_SUMMON_PROC)
e5:SetCondition(s.ntcon)
c:RegisterEffect(e5)
end
function s.addct(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_COUNTER,nil,3,0,0x1f)
end
function s.addc(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
e:GetHandler():AddCounter(0x1f,3)
end
end
function s.rctcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x1f)~=0
end
function s.rctop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
c:RemoveCounter(tp,0x1f,1,REASON_EFFECT)
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetCounter(0x1f)==0
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsFaceup() and c:IsRelateToEffect(e) then
Duel.Destroy(c,REASON_EFFECT)
end
end
function s.ntcon(e,c,minc)
if c==nil then return true end
return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0
and Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0)==0
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card is Normal Summoned: You can Special Summon 1 "Deskbot" monster from your Deck, except "Deskbot 003". Once per turn (Quick Effect): You can target 1 "Deskbot" monster you control; it gains 500 ATK/DEF for each "Deskbot" card you currently control, until the end of this turn.
|
--ブンボーグ003
--Deskbot 003
local s,id=GetID()
function s.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
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)
--atk
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_ATKCHANGE)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP)
e2:SetHintTiming(TIMING_DAMAGE_STEP)
e2:SetCountLimit(1)
e2:SetCondition(aux.StatChangeDamageStepCondition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
s.listed_series={SET_DESKBOT}
s.listed_names={id}
function s.spfilter(c,e,tp)
return c:IsSetCard(SET_DESKBOT) 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 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
function s.filter(c)
return c:IsFaceup() and c:IsSetCard(SET_DESKBOT)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local val=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_ONFIELD,0,nil)*500
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:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(val)
e1:SetReset(RESETS_STANDARD_PHASE_END)
tc:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_UPDATE_DEFENSE)
tc:RegisterEffect(e2)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
FLIP: Select 1 Monster Card from you or your opponent's Graveyard. Remove it from play.
|
--混沌の呪術師
--Witch Doctor of Chaos
local s,id=GetID()
function s.initial_effect(c)
--flip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_REMOVE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.filter(c)
return c:IsMonster() and c:IsAbleToRemove() and aux.SpElimFilter(c)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and s.filter(chkc) end
if chk==0 then return true end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card is activated: Place 1 "Vaylantz" Field Spell from your Deck face-up in your opponent's Field Zone, except "Vaylantz World - Konig Wissen". If there are 2 cards in the Field Zones: The turn player can target 1 Effect Monster in the opponent's Main Monster Zone, in the same column as one of the monsters they control; they place that opponent's monster face-up as a Continuous Spell in their Spell & Trap Zone in its same column. (If the zone is occupied, destroy the occupying card.) The turn player can only use this effect of "Vaylantz World - Konig Wissen" once per turn.
|
--VV-百識公国
--Vaylantz World - Konig Wissen
--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:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Place in the Spell/Trap Zone
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_BOTH_SIDE+EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.plcon)
e2:SetTarget(s.pltg)
e2:SetOperation(s.plop)
c:RegisterEffect(e2)
end
s.listed_series={SET_VAYLANTZ}
s.listed_names={id}
function s.filter(c)
return c:IsFieldSpell() and c:IsSetCard(SET_VAYLANTZ) and not c:IsCode(id) and not c:IsForbidden()
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
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil):GetFirst()
if tc then
local fc=Duel.GetFieldCard(1-tp,LOCATION_FZONE,0)
if fc then
Duel.SendtoGrave(fc,REASON_RULE)
Duel.BreakEffect()
end
Duel.MoveToField(tc,tp,1-tp,LOCATION_FZONE,POS_FACEUP,true)
end
end
function s.plcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.GetFieldGroupCount(tp,LOCATION_FZONE,LOCATION_FZONE)==2
end
function s.plfilter(c,tp)
if not (c:IsFaceup() and c:IsType(TYPE_EFFECT)) then return false end
local cg=c:GetColumnGroup()
return #cg>0 and cg:IsExists(aux.AND(Card.IsControler,Card.IsMonster),1,nil,tp)
end
function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MMZONE) and s.plfilter(chkc,tp) end
if chk==0 then return Duel.IsExistingTarget(s.plfilter,tp,0,LOCATION_MMZONE,1,nil,tp) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
local tc=Duel.SelectTarget(tp,s.plfilter,tp,0,LOCATION_MMZONE,1,1,nil,tp):GetFirst()
local dc=Duel.GetFieldCard(1-tp,LOCATION_SZONE,tc:GetSequence())
if dc then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dc,1,0,0)
end
end
function s.plop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and tc:IsControler(1-tp) and not tc:IsImmuneToEffect(e)) then return end
local seq=tc:GetSequence()
local dc=Duel.GetFieldCard(1-tp,LOCATION_SZONE,seq)
if dc then
Duel.Destroy(dc,REASON_RULE)
end
if Duel.CheckLocation(1-tp,LOCATION_SZONE,seq)
and Duel.MoveToField(tc,tp,1-tp,LOCATION_SZONE,POS_FACEUP,tc:IsMonsterCard(),1<<seq) then
--Treated as a Continuous Spell
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_TYPE)
e1:SetReset(RESET_EVENT|RESETS_STANDARD&~RESET_TURN_SET)
e1:SetValue(TYPE_SPELL|TYPE_CONTINUOUS)
tc:RegisterEffect(e1)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
"Utopia" and "Utopic" Xyz Monsters you control whose original Attribute is LIGHT cannot be destroyed by card effects, also your opponent cannot target them with card effects. You can only use each of the following effects of "Gagaga Utopic Tactics" once per turn. You can declare a Level from 1 to 12, then target 2 face-up monsters you control, including a "Gagaga" monster; they become that Level. If you Xyz Summon a "Utopia" or "Utopic" Xyz Monster whose original Attribute is LIGHT: You can target 1 card your opponent controls; destroy it.
|
--ガガガ・ホープ・タクティクス
--Gagaga Utopic Tactics
--Scripted by Eerie Code
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_ACTIVATE)
e0:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e0)
--"Utopia" and "Utopic" Xyz Monsters you control whose original Attribute is LIGHT cannot be destroyed by card effects, also your opponent cannot target them with card effects
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetRange(LOCATION_SZONE)
e1:SetTargetRange(LOCATION_MZONE,0)
e1:SetTarget(aux.TargetBoolFunction(s.utopixyzfilter))
e1:SetValue(1)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET)
e2:SetValue(aux.tgoval)
c:RegisterEffect(e2)
--Change the Levels of 2 face-up monsters you control, including a "Gagaga" monster
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_LVCHANGE)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetCountLimit(1,{id,0})
e3:SetTarget(s.lvtg)
e3:SetOperation(s.lvop)
c:RegisterEffect(e3)
--Destroy 1 card your opponent controls
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_DESTROY)
e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
e4:SetRange(LOCATION_SZONE)
e4:SetCountLimit(1,{id,1})
e4:SetCondition(s.descon)
e4:SetTarget(s.destg)
e4:SetOperation(s.desop)
c:RegisterEffect(e4)
end
s.listed_series={SET_UTOPIC,SET_GAGAGA}
function s.utopixyzfilter(c)
return c:IsSetCard(SET_UTOPIC) and c:IsType(TYPE_XYZ) and c:IsOriginalAttribute(ATTRIBUTE_LIGHT) and c:IsFaceup()
end
function s.lvfilter(c,e)
return c:HasLevel() and c:IsFaceup() and c:IsCanBeEffectTarget(e)
end
function s.rescon(sg,e,tp,mg)
return sg:IsExists(Card.IsSetCard,1,nil,SET_GAGAGA)
end
s.nlvfilter=aux.NOT(Card.IsLevel)
function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return false end
local gg=Duel.GetMatchingGroup(s.lvfilter,tp,LOCATION_MZONE,0,nil,e)
if chk==0 then return aux.SelectUnselectGroup(gg,e,tp,2,2,s.rescon,0) end
local g1,g2=gg:Split(Card.IsSetCard,nil,SET_GAGAGA)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_LVRANK)
local lv=Duel.AnnounceNumber(tp,s.get_declarable_levels(g1,g2))
local g=gg:Match(s.nlvfilter,nil,lv)
local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_TARGET)
Duel.SetTargetCard(tg)
e:SetLabel(lv)
Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,tg,2,tp,lv)
end
function s.lvop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetTargetCards(e):Filter(Card.IsFaceup,nil)
if #tg==0 then return end
local lv=e:GetLabel()
for tc in tg:Iter() do
if not tc:IsLevel(lv) then
--Its Level becomes the declared Level
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_CHANGE_LEVEL)
e1:SetValue(lv)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
tc:RegisterEffect(e1)
end
end
end
function s.get_declarable_levels(g1,g2)
local opts={}
for lv=1,12 do
local ct=g1:FilterCount(s.nlvfilter,nil,lv)
if ct>1 or (ct>0 and g2:IsExists(s.nlvfilter,1,nil,lv)) then
table.insert(opts,lv)
end
end
return table.unpack(opts)
end
function s.desconfilter(c,tp)
return s.utopixyzfilter(c) and c:IsSummonPlayer(tp) and c:IsXyzSummoned()
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.desconfilter,1,nil,tp)
end
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end
if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Activate only if you control 3 or more "Batteryman" monsters. Destroy all cards your opponent controls.
|
--漏電
--Short Circuit
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetCondition(s.condition)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
s.listed_series={SET_BATTERYMAN}
function s.cfilter(c)
return c:IsFaceup() and c:IsSetCard(SET_BATTERYMAN)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,3,nil)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) end
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil)
Duel.Destroy(g,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When an opponent's monster declares an attack: Target the attacking monster; change that target to Defense Position, and if you do, equip this card to that monster. Once per turn, during either player's Main Phase or Battle Phase: You can change the equipped monster's battle position.
|
--隷属の鱗粉
--Butterflyoke
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_POSITION+CATEGORY_EQUIP)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_ATTACK_ANNOUNCE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCondition(s.condition)
e1:SetCost(aux.RemainFieldCost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--pos
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCategory(CATEGORY_POSITION)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetCondition(s.poscon)
e2:SetOperation(s.posop)
c:RegisterEffect(e2)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(1-tp)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local tc=Duel.GetAttacker()
if chkc then return chkc==tc end
if chk==0 then return e:IsHasType(EFFECT_TYPE_ACTIVATE) and tc:IsLocation(LOCATION_MZONE) and tc:IsAttackPos()
and tc:IsCanChangePosition() and tc:IsCanBeEffectTarget(e) end
Duel.SetTargetCard(tc)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsLocation(LOCATION_SZONE) then return end
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and tc:CanAttack() and not tc:IsStatus(STATUS_ATTACK_CANCELED) then
Duel.ChangePosition(tc,POS_FACEUP_DEFENSE)
if c:IsRelateToEffect(e) and not c:IsStatus(STATUS_LEAVE_CONFIRMED) then
Duel.Equip(tp,c,tc)
--Equip limit
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetValue(s.eqlimit)
e1:SetLabelObject(tc)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
c:RegisterEffect(e1)
end
else
c:CancelToGrave(false)
end
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
end
function s.poscon(e,tp,eg,ep,ev,re,r,rp)
local ph=Duel.GetCurrentPhase()
return ph>=PHASE_MAIN1 and ph<=PHASE_MAIN2 and e:GetHandler():GetEquipTarget()
end
function s.posop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local ec=c:GetEquipTarget()
if ec then
Duel.ChangePosition(ec,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
1 Tuner + 1+ non-Tuner monsters When this card is Synchro Summoned: You can target 1 Machine monster in your GY; add it to your hand, also if you have a Spell/Trap in your GY, you cannot Normal or Special Summon it, or a monster with its name, for the rest of this turn. This card can attack while in face-up Defense Position. If it does, apply its DEF for damage calculation.
|
--超重剣聖ムサ-C
--Superheavy Samurai Swordmaster Musashi
local s,id=GetID()
function s.initial_effect(c)
--synchro summon
Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99)
c:EnableReviveLimit()
--Add to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCondition(s.thcon)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
--defense attack
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_DEFENSE_ATTACK)
e2:SetValue(1)
c:RegisterEffect(e2)
end
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():IsSynchroSummoned()
end
function s.thfilter(c)
return c:IsRace(RACE_MACHINE) and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
if Duel.IsExistingMatchingCard(Card.IsSpellTrap,tp,LOCATION_GRAVE,0,1,nil) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_CANNOT_SUMMON)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetTargetRange(1,0)
e1:SetTarget(s.sumlimit)
e1:SetLabel(tc:GetCode())
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
local e2=e1:Clone()
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
Duel.RegisterEffect(e2,tp)
end
end
end
function s.sumlimit(e,c)
return c:IsCode(e:GetLabel())
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
During the End Phase, if this card is currently banished, and was banished this turn: You can banish 1 card from your hand, field, or GY, and if you do, Special Summon this card in Attack Position. You can only use this effect of "D.D. Patrol Plane" once per turn.
|
--異次元の哨戒機
--D.D. Patrol Plane
--Scripted by AlphaKretin
local s,id=GetID()
function s.initial_effect(c)
--register banished
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_REMOVE)
e1:SetOperation(s.regop)
c:RegisterEffect(e1)
--special summon
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_REMOVED)
e2:SetCountLimit(1,id)
e2:SetCondition(s.spcon)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsFacedown() then return end
e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetFlagEffect(id)~=0
end
function s.rmfilter(c)
return c:IsAbleToRemove() and (c:IsLocation(LOCATION_HAND) or aux.SpElimFilter(c,false,true))
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,POS_FACEUP_ATTACK)
and Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,nil)
end
Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE)
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.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local rg=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,1,nil)
if #rg>0 and Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)~=0 then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_ATTACK)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
1 Tuner + 1+ non-Tuner FIRE monsters You can shuffle 2 "Laval" monsters from your GY into your Main Deck, then target 1 card your opponent controls; return it to the hand.
|
--ラヴァルバル・ドラゴン
--Lavalval Dragon
local s,id=GetID()
function s.initial_effect(c)
--synchro summon
Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsAttribute,ATTRIBUTE_FIRE),1,99)
c:EnableReviveLimit()
--to hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
s.listed_series={SET_LAVAL}
function s.costfilter(c)
return c:IsSetCard(SET_LAVAL) and c:IsAbleToDeckAsCost()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,2,2,nil)
Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsAbleToHand() end
if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp,chk)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Target 1 face-up monster your opponent controls; take damage equal to half its ATK, then inflict damage to your opponent, equal to the damage you took. If this card you control is destroyed by an opponent's card and sent to your Graveyard: Inflict 1000 damage to your opponent. You can only activate 1 "Bad Luck Blast" per turn.
|
--不運の爆弾
--Bad Luck Blast
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_DRAW_PHASE|TIMINGS_CHECK_MONSTER_E)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetTarget(s.target)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
--Inflict damage when it leaves the field
local e2=Effect.CreateEffect(c)
e2:SetCategory(CATEGORY_DAMAGE)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_TO_GRAVE)
e2:SetCondition(s.damcon)
e2:SetTarget(s.damtg)
e2:SetOperation(s.damop)
c:RegisterEffect(e2)
end
function s.filter(c)
return c:IsFaceup() and c:GetAttack()>0
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then
local atk=tc:GetAttack()/2
local val=Duel.Damage(tp,atk,REASON_EFFECT)
if val>0 and Duel.GetLP(tp)>0 then
Duel.BreakEffect()
Duel.Damage(1-tp,val,REASON_EFFECT)
end
end
end
function s.damcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
return rp==1-tp and c:IsReason(REASON_DESTROY)
and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp)
end
function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(1-tp)
Duel.SetTargetParam(1000)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,1000)
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
[ Pendulum Effect ] You can target 1 face-up monster on the field; its DEF becomes 0 until the end of this turn (even if this card leaves the field). You can only use this effect of "D/D/D Supersight King Zero Maxwell" once per turn. ---------------------------------------- [ Monster Effect ] Before damage calculation, if this card attacks an opponent's Defense Position monster: You can change the DEF of that opponent's monster to 0 until the end of the Damage Step. If this card attacks a Defense Position monster, inflict piercing battle damage. You take no battle damage from battles involving this card.
|
--DDD超視王ゼロ・マクスウェル
--D/D/D Supersight King Zero Maxwell
local s,id=GetID()
function s.initial_effect(c)
--pendulum summon
Pendulum.AddProcedure(c)
--defdown
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DEFCHANGE)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_PZONE)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCountLimit(1,id)
e1:SetTarget(s.deftg)
e1:SetOperation(s.defop)
c:RegisterEffect(e1)
--defdown
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_DEFCHANGE)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_BATTLE_CONFIRM)
e2:SetCondition(s.defcon2)
e2:SetOperation(s.defop2)
c:RegisterEffect(e2)
--pierce
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_SINGLE)
e3:SetCode(EFFECT_PIERCE)
c:RegisterEffect(e3)
--no damage
local e4=Effect.CreateEffect(c)
e4:SetType(EFFECT_TYPE_SINGLE)
e4:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e4:SetValue(1)
c:RegisterEffect(e4)
end
function s.deftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:HasNonZeroDefense() end
if chk==0 then return Duel.IsExistingTarget(Card.HasNonZeroDefense,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
Duel.SelectTarget(tp,Card.HasNonZeroDefense,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil)
end
function s.defop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsFaceup() and tc:IsRelateToEffect(e) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
e1:SetValue(0)
e1:SetReset(RESETS_STANDARD_PHASE_END)
tc:RegisterEffect(e1)
end
end
function s.defcon2(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetAttackTarget()
e:SetLabelObject(tc)
return Duel.GetAttacker()==e:GetHandler() and tc and tc:IsPosition(POS_FACEUP_DEFENSE) and tc:GetDefense()>0
end
function s.defop2(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:IsFaceup() and tc:IsRelateToBattle() then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_SET_DEFENSE_FINAL)
e1:SetValue(0)
e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE)
tc:RegisterEffect(e1)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 2 Insect monsters from your GY. If this card inflicts battle damage to your opponent: Send the top card of their Deck to the GY.
|
--デビルドーザー
--Doom Dozer
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--cannot special summon
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e0)
--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)
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DECKDES)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
e2:SetCode(EVENT_BATTLE_DAMAGE)
e2:SetCondition(s.condition)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
end
function s.spfilter(c)
return c:IsRace(RACE_INSECT) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
end
function s.spcon(e,c)
if c==nil then return true end
local tp=e:GetHandlerPlayer()
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil)
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and #rg>1 and aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),0)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,c)
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil)
local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE,nil,nil,true)
if #g>0 then
g:KeepAlive()
e:SetLabelObject(g)
return true
end
return false
end
function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
if not g then return end
Duel.Remove(g,POS_FACEUP,REASON_COST)
g:DeleteGroup()
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return ep~=tp
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetOperationInfo(0,CATEGORY_DECKDES,0,0,1-tp,1)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
Duel.DiscardDeck(1-tp,1,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When your opponent activates a card or effect that would destroy a card(s) on the field: Negate the effect, then send 1 Level 3 or lower DARK monster from your Deck to your GY.
|
--身代わりの闇
--Dark Sacrifice
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
local e1=Effect.CreateEffect(c)
e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_DISABLE)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
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)
if tp==ep or not Duel.IsChainDisablable(ev) then return false end
local ex,tg,tc=Duel.GetOperationInfo(ev,CATEGORY_DESTROY)
return ex and tg~=nil and tc+tg:FilterCount(Card.IsOnField,nil)-#tg>0
end
function s.tgfilter(c)
return c:IsLevelBelow(3) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToGrave()
end
function s.target(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)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateEffect(ev) then
Duel.BreakEffect()
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
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Cannot be Special Summoned from the GY. At the end of your opponent's Battle Phase, if this card is in the GY because it was destroyed by battle: Make your opponent discard 1 random card. This card must be in the GY to activate and to resolve this effect.
|
--地獄詩人ヘルポエマー
--Helpoemer
local s,id=GetID()
function s.initial_effect(c)
--cannot special summon
local e1=Effect.CreateEffect(c)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_SINGLE_RANGE)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetRange(LOCATION_GRAVE)
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
c:RegisterEffect(e1)
--reg
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e2:SetCode(EVENT_BATTLE_DESTROYED)
e2:SetOperation(s.regop)
c:RegisterEffect(e2)
--handes
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e3:SetCategory(CATEGORY_HANDES)
e3:SetCode(EVENT_PHASE|PHASE_BATTLE)
e3:SetRange(LOCATION_GRAVE)
e3:SetCountLimit(1)
e3:SetCondition(s.hdcon)
e3:SetTarget(s.hdtg)
e3:SetOperation(s.hdop)
c:RegisterEffect(e3)
end
function s.regop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsLocation(LOCATION_GRAVE) and c:IsReason(REASON_BATTLE) then
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0)
end
end
function s.hdcon(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsTurnPlayer(1-tp) and e:GetHandler():GetFlagEffect(id)~=0
end
function s.hdtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
e:GetHandler():ResetFlagEffect(id)
Duel.SetOperationInfo(0,CATEGORY_HANDES,0,0,1-tp,1)
end
function s.hdop(e,tp,eg,ep,ev,re,r,rp)
if e:GetHandler():IsRelateToEffect(e) then
e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0)
local g=Duel.GetFieldGroup(1-tp,LOCATION_HAND,0)
if #g==0 then return end
local sg=g:RandomSelect(1-tp,1)
Duel.SendtoGrave(sg,REASON_DISCARD|REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When this card is destroyed by battle and sent to the Graveyard, or when this card you control is destroyed by an opponent's card effect and sent to your Graveyard: You can Special Summon 1 EARTH Pendulum Monster from your Deck in Defense Position, but destroy it during the End Phase. You can only use this effect of "Dragon Dowser" once per turn.
|
--ドラゴンダウザー
--Dragon Dowser
local s,id=GetID()
function s.initial_effect(c)
--spsummon
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetCountLimit(1,id)
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)
local c=e:GetHandler()
return (c:IsReason(REASON_BATTLE)
or rp~=tp and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp))
and c:IsPreviousLocation(LOCATION_ONFIELD)
end
function s.filter(c,e,tp)
return c:IsType(TYPE_PENDULUM) and c:IsAttribute(ATTRIBUTE_EARTH)
and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp)
local tc=g:GetFirst()
if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)~=0 then
local fid=e:GetHandler():GetFieldID()
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid)
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_PHASE+PHASE_END)
e1:SetCountLimit(1)
e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE)
e1:SetLabel(fid)
e1:SetLabelObject(tc)
e1:SetCondition(s.descon)
e1:SetOperation(s.desop)
Duel.RegisterEffect(e1,tp)
end
end
function s.descon(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetLabelObject()
if tc:GetFlagEffectLabel(id)~=e:GetLabel() then
e:Reset()
return false
else return true end
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
Duel.Destroy(e:GetLabelObject(),REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 Level 4 DARK monsters Once per turn: You can detach 1 material from this card, then target 1 other card you control; this card gains the following effects. ● The targeted card cannot be destroyed by card effects. ● If this card would be destroyed by battle or card effect, you can send the targeted card to the GY instead. * The above text is unofficial and describes the card's functionality in the OCG.
|
--No.66 覇鍵甲虫マスター・キー・ビートル
--Number 66: Master Key Beetle
local s,id=GetID()
function s.initial_effect(c)
--xyz summon
Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_DARK),4,2)
c:EnableReviveLimit()
--target
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetCost(Cost.DetachFromSelf(1))
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
--desrep
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE)
e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e3:SetCode(EFFECT_DESTROY_REPLACE)
e3:SetRange(LOCATION_MZONE)
e3:SetTarget(s.reptg)
c:RegisterEffect(e3)
end
s.xyz_number=66
function s.filter(c,ec)
return not ec:IsHasCardTarget(c)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
local c=e:GetHandler()
if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc~=c and s.filter(chkc,c) end
if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,c,c) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,c,c)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=Duel.GetFirstTarget()
if c:IsFaceup() and c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) then
c:SetCardTarget(tc)
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,0)
--indes
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetProperty(EFFECT_FLAG_SET_AVAILABLE+EFFECT_FLAG_OWNER_RELATE)
e2:SetCondition(s.indcon)
e2:SetValue(1)
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
tc:RegisterEffect(e2)
end
end
function s.indcon(e)
return e:GetOwner():IsHasCardTarget(e:GetHandler()) and e:GetOwner():IsOnField() and e:GetOwner():IsFaceup()
end
function s.repfilter(c,tp)
return c:IsControler(tp) and c:GetFlagEffect(id)~=0
end
function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return not c:IsReason(REASON_REPLACE) and c:GetCardTarget():IsExists(s.repfilter,1,nil,tp) end
if Duel.SelectEffectYesNo(tp,c,96) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local g=c:GetCardTarget():FilterSelect(tp,s.repfilter,1,1,nil,tp)
Duel.SendtoGrave(g,REASON_EFFECT)
return true
else return false end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2 "Sky Striker Ace" monsters You can only Special Summon "Sky Striker Ace = Zero(s)" once per turn. Cannot be used as Link Material. If this card is Special Summoned: You can add 1 "Sky Striker" Spell from your Deck or GY to your hand. (Quick Effect): You can Tribute this card; Special Summon 1 "Sky Striker Ace - Raye" and 1 "Sky Striker Ace - Roze" from your Deck and/or GY, then you can destroy 1 card on the field. You can only use 1 "Sky Striker Ace = Zero" effect per turn, and only once that turn.
|
--閃刀姫=ゼロ
--Sky Striker Ace = Zero
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--Link Summon procedure: 2 "Sky Striker Ace" monsters
Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_SKY_STRIKER_ACE),2)
--You can only Special Summon "Sky Striker Ace - Zero(s)" once per turn
c:SetSPSummonOnce(id)
--Cannot be used as Link Material
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL)
e0:SetValue(1)
c:RegisterEffect(e0)
--Add 1 "Sky Striker" Spell from your Deck or GY to your hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SPSUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
--Special Summon both 1 "Sky Striker Ace - Raye" and 1 "Sky Striker Ace - Roze" from your Deck and/or GY, then you can destroy 1 card on the field
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,1))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E)
e2:SetCountLimit(1,id)
e2:SetCost(Cost.SelfTribute)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
s.listed_series={SET_SKY_STRIKER_ACE,SET_SKY_STRIKER}
s.listed_names={id,26077387,37351133} --"Sky Striker Ace - Raye", "Sky Striker Ace - Roze"
function s.thfilter(c)
return c:IsSetCard(SET_SKY_STRIKER) and c:IsSpell() and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE)
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
function s.spfilter(c,e,tp)
return c:IsCode(26077387,37351133) 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
local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp)
return Duel.GetMZoneCount(tp,e:GetHandler())>=2
and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
and aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK|LOCATION_GRAVE)
Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,PLAYER_EITHER,LOCATION_ONFIELD)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)
or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end
local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_DECK|LOCATION_GRAVE,0,nil,e,tp)
if #g<2 then return end
local sg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SPSUMMON)
if #sg==2 and Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP)==2
and Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,LOCATION_ONFIELD)>0
and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local dg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
if #dg>0 then
Duel.HintSelection(dg)
Duel.BreakEffect()
Duel.Destroy(dg,REASON_EFFECT)
end
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
[ Pendulum Effect ] You can activate 1 of these effects; ● Special Summon this card to your Main Monster Zone in its same column. ● Move 1 monster in your Main Monster Zone to an adjacent (horizontal) Monster Zone. You can only use this effect of "Vaylantz Genesis Grand Duke" once per turn. ---------------------------------------- [ Monster Effect ] 2 "Vaylantz" monsters This face-down card in the Extra Deck must first be either Fusion Summoned, or Special Summoned by Tributing 1 Level 5 or higher non-Fusion "Vaylantz" monster in the same column as the Extra Monster Zone. If this card is Special Summoned: You can target 1 Monster Card in your opponent's Spell & Trap Zone; return it to the hand, and if you do, inflict damage to your opponent equal to its ATK, then, this card gains ATK equal to half the damage inflicted.
|
--ヴァリアンツG-グランデューク
--Vaylantz Genesis Grand Duke
--Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
Pendulum.AddProcedure(c,false)
c:EnableReviveLimit()
--2 "Valiants" monsters
Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_VAYLANTZ),2)
--Special Summon limitation
local e0=Effect.CreateEffect(c)
e0:SetType(EFFECT_TYPE_SINGLE)
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
e0:SetCode(EFFECT_SPSUMMON_CONDITION)
e0:SetValue(s.splimit)
c:RegisterEffect(e0)
--Alternate summon procedure
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetRange(LOCATION_EXTRA)
e1:SetCondition(s.hspcon)
e1:SetTarget(s.hsptg)
e1:SetOperation(s.hspop)
c:RegisterEffect(e1)
--Special Summon self or move 1 "Valiants" monster
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetRange(LOCATION_PZONE)
e2:SetCountLimit(1,id)
e2:SetTarget(s.spmvtg)
c:RegisterEffect(e2)
--Send Monster Card to hand
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,1))
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_DAMAGE+CATEGORY_ATKCHANGE)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET)
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
e3:SetTarget(s.thtg)
e3:SetOperation(s.thop)
c:RegisterEffect(e3)
end
s.listed_series={SET_VAYLANTZ}
local mask=0x2|0x8|0x20|0x40
function s.splimit(e,se,sp,st)
return not e:GetHandler():IsLocation(LOCATION_EXTRA) or aux.fuslimit(e,se,sp,st) or aux.penlimit(e,se,sp,st)
end
function s.hspfilter(c,tp,sc)
local zone=1<<c:GetSequence()
return zone&mask==zone and c:IsSetCard(SET_VAYLANTZ) and c:IsLevelAbove(5)
and not c:IsType(TYPE_FUSION) and Duel.GetLocationCountFromEx(tp,tp,c,sc)>0
end
function s.hspcon(e,c)
if not c then return true end
if c:IsFaceup() then return false end
local tp=c:GetControler()
return Duel.CheckReleaseGroup(tp,s.hspfilter,1,false,1,true,c,tp,nil,nil,nil,tp,c)
end
function s.hsptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
local g=Duel.SelectReleaseGroup(tp,s.hspfilter,1,1,false,true,true,c,tp,nil,false,nil,tp,c)
if g then
g:KeepAlive()
e:SetLabelObject(g)
return true
end
return false
end
function s.hspop(e,tp,eg,ep,ev,re,r,rp,c)
local g=e:GetLabelObject()
if not g then return end
Duel.Release(g,REASON_COST|REASON_MATERIAL)
g:DeleteGroup()
end
function s.spmvtg(e,tp,eg,ep,ev,re,r,rp,chk)
local sp=s.sptg(e,tp,eg,ep,ev,re,r,rp,0)
local mv=s.mvtg(e,tp,eg,ep,ev,re,r,rp,0)
if chk==0 then return sp or mv end
local op=Duel.SelectEffect(tp,
{sp,aux.Stringid(id,2)},
{mv,aux.Stringid(id,3)})
if op==1 then
e:SetCategory(CATEGORY_SPECIAL_SUMMON)
e:SetOperation(s.spop)
s.sptg(e,tp,eg,ep,ev,re,r,rp,1)
elseif op==2 then
e:SetCategory(0)
e:SetOperation(s.mvop)
end
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then
local zone=(1<<c:GetSequence())&ZONES_MMZ
return zone~=0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local zone=(1<<c:GetSequence())&ZONES_MMZ
if zone~=0 then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone)
end
end
function s.mvtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingTarget(Card.CheckAdjacent,tp,LOCATION_MZONE,0,1,nil) end
end
function s.mvop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT)
local tc=Duel.SelectMatchingCard(tp,Card.CheckAdjacent,tp,LOCATION_MZONE,0,1,1,nil):GetFirst()
if tc then
tc:MoveAdjacent()
end
end
function s.thfilter(c)
return c:IsOriginalType(TYPE_MONSTER) and c:GetSequence()<5 and c:GetBaseAttack()>0 and c:IsAbleToHand()
end
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_SZONE) and chkc:IsController(1-tp) and s.thfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_SZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_SZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,g:GetFirst():GetBaseAttack())
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND)) then return end
local atk=tc:GetBaseAttack()
if atk<=0 then return end
local dam=Duel.Damage(1-tp,atk,REASON_EFFECT)
if dam>0 then
Duel.BreakEffect()
local c=e:GetHandler()
--Gain ATK
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(dam/2)
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:
|
Offer 1 Warrior-Type monster on your side of the field as a Tribute to destroy 1 face-up monster on the field whose DEF is equal to or lower than the ATK of this monster.
|
--投石部隊
--Throwstone Unit
local s,id=GetID()
function s.initial_effect(c)
--Destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(s.descost)
e1:SetOperation(s.desop)
c:RegisterEffect(e1)
end
function s.cfilter(c)
return c:IsRace(RACE_WARRIOR)
end
function s.desfilter(c,atk)
return c:IsFaceup() and c:IsDefenseBelow(atk)
end
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local dg=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil,c:GetAttack())
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,c,dg) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE)
local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,c,dg)
Duel.Release(g,REASON_COST)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg-g,1,0,0)
end
function s.desop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local atk=c:GetAttack()
if not c:IsRelateToEffect(e) then atk=c:GetPreviousAttackOnField() end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,atk)
if #g>0 then
Duel.HintSelection(g,true)
Duel.Destroy(g,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Equip only to a DARK monster. It gains 600 ATK, also it cannot be destroyed by your opponent's card effects. If this card is sent to the GY because the equipped monster was destroyed by battle and sent to the GY: You can Special Summon that monster, and if you do, equip this card to it, but banish this card when it leaves the field. You can only use this effect of "Dragon Nails" once per turn.
|
--闇竜族の爪
--Dragon Nails
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsAttribute,ATTRIBUTE_DARK))
--Increase ATK by 600
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(600)
c:RegisterEffect(e1)
--Prevent destruction by opponent's effect
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_EQUIP)
e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e2:SetValue(aux.indoval)
c:RegisterEffect(e2)
--Special Summon the destroyed monster
local e3=Effect.CreateEffect(c)
e3:SetDescription(aux.Stringid(id,0))
e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP)
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e3:SetProperty(EFFECT_FLAG_DELAY)
e3:SetCode(EVENT_TO_GRAVE)
e3:SetCountLimit(1,id)
e3:SetCondition(s.spcon)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local ec=c:GetPreviousEquipTarget()
return c:IsReason(REASON_LOST_TARGET) and ec and ec:IsReason(REASON_DESTROY) and ec:IsReason(REASON_BATTLE) and ec:IsLocation(LOCATION_GRAVE)
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
local tc=c:GetPreviousEquipTarget()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and tc:IsCanBeSpecialSummoned(e,0,tp,false,false)
end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,1,tp,LOCATION_GRAVE)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,tp,0)
Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tc=c:GetPreviousEquipTarget()
if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.Equip(tp,c,tc) then
--Banish this card 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:
|
2 Level 4 monsters You can target 1 Effect Monster your opponent controls; negate its effects, then if it battled this turn, you can take control of it until the End Phase. This is a Quick Effect if this card has an Illusion monster as material. You can only use this effect of "Heretical Phobos Covos" once per turn. If this card battles a monster, neither can be destroyed by that battle.
|
--異端なるフォボスコボス
--Heretical Phobos Covos
--scripted by pyrQ
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
--Xyz Summon procedure
Xyz.AddProcedure(c,nil,4,2)
--Negate the effects of an opponent's monster
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DISABLE+CATEGORY_CONTROL)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1,id)
e1:SetCondition(aux.NOT(s.quickcon))
e1:SetTarget(s.distg)
e1:SetOperation(s.disop)
c:RegisterEffect(e1)
--This is a Quick Effect if this card has an Illusion monster as material
local e2=e1:Clone()
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_MZONE)
e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E|TIMING_BATTLE_END)
e2:SetCondition(s.quickcon)
c:RegisterEffect(e2)
--If this card battles a monster, neither can be destroyed by that battle
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD)
e3:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e3:SetRange(LOCATION_MZONE)
e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE)
e3:SetTarget(s.indestg)
e3:SetValue(1)
c:RegisterEffect(e3)
--Keep track of any monster that has battled in a given 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
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
Duel.GetAttacker():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1)
local ac=Duel.GetAttackTarget()
if ac then ac:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end
end
function s.quickcon(e,tp,eg,ep,ev,re,r,rp)
return e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_ILLUSION)
end
function s.disfilter(c)
return c:IsType(TYPE_EFFECT) and c:IsNegatableMonster()
end
function s.distg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.disfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.disfilter,tp,0,LOCATION_MZONE,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE)
local g=Duel.SelectTarget(tp,s.disfilter,tp,0,LOCATION_MZONE,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,tp,0)
Duel.SetPossibleOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0)
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsCanBeDisabledByEffect(e)) then return end
local c=e:GetHandler()
tc:NegateEffects(c)
Duel.AdjustInstantly(tc)
if tc:HasFlagEffect(id) and tc:IsControlerCanBeChanged() and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.GetControl(tc,tp,PHASE_END,1)
end
end
function s.indestg(e,c)
local handler=e:GetHandler()
return c==handler or c==handler:GetBattleTarget()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can target 1 "Number C39: Utopia Ray" you control; equip this card from your hand to that target. It gains 1900 ATK. If the equipped monster battles an opponent's monster, the opponent's monster's effect is negated during the Battle Phase only. You can only control 1 "ZW - Unicorn Spear".
|
--ZW-一角獣皇槍
--ZW - Unicorn Spear
local s,id=GetID()
function s.initial_effect(c)
c:SetUniqueOnField(1,0,id)
--equip
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(s.eqcon)
e1:SetTarget(s.eqtg)
e1:SetOperation(s.eqop)
c:RegisterEffect(e1)
aux.AddZWEquipLimit(c,s.eqcon,function(tc,c,tp) return s.filter(tc) and tc:IsControler(tp) end,s.equipop,e1)
--disable
local e3=Effect.CreateEffect(c)
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
e3:SetCode(EVENT_BE_BATTLE_TARGET)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(s.discon)
e3:SetOperation(s.disop)
c:RegisterEffect(e3)
end
s.listed_names={56840427}
function s.eqcon(e)
return e:GetHandler():CheckUniqueOnField(e:GetHandlerPlayer())
end
function s.filter(c)
return c:IsFaceup() and c:IsCode(56840427)
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.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or not tc:IsRelateToEffect(e) or tc:IsFacedown() or tc:GetControler()~=tp or not c:CheckUniqueOnField(tp) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
s.equipop(c,e,tp,tc)
end
function s.equipop(c,e,tp,tc)
if not aux.EquipAndLimitRegister(c,e,tp,tc) then return end
--atkup
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_EQUIP)
e1:SetCode(EFFECT_UPDATE_ATTACK)
e1:SetValue(1900)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
c:RegisterEffect(e1)
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
local ec=e:GetHandler():GetEquipTarget()
return ec and (ec==Duel.GetAttacker() or ec==Duel.GetAttackTarget()) and ec:GetBattleTarget()
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
local tc=e:GetHandler():GetEquipTarget():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:
|
If this card is Summoned: You can add 1 "Cyber Angel" monster or "Machine Angel Ritual" from your Deck to your hand. You can only use this effect of "Cyber Petit Angel" once per turn.
|
--サイバー・プチ・エンジェル
--Cyber Petit Angel
local s,id=GetID()
function s.initial_effect(c)
--tohand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e1:SetProperty(EFFECT_FLAG_DELAY)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetCountLimit(1,id)
e1:SetTarget(s.thtg)
e1:SetOperation(s.thop)
c:RegisterEffect(e1)
local e2=e1:Clone()
e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS)
c:RegisterEffect(e2)
local e3=e1:Clone()
e3:SetCode(EVENT_SPSUMMON_SUCCESS)
c:RegisterEffect(e3)
end
s.listed_series={SET_CYBER_ANGEL}
s.listed_names={39996157}
function s.thfilter(c)
return ((c:IsSetCard(SET_CYBER_ANGEL) and c:IsMonster()) or c:IsCode(39996157)) 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:
|
Inflict 200 points of damage to your opponent's Life Points.
|
--火の粉
--Sparks
local s,id=GetID()
function s.initial_effect(c)
--damage
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCategory(CATEGORY_DAMAGE)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetTarget(s.damtg)
e1:SetOperation(s.damop)
c:RegisterEffect(e1)
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(200)
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,200)
end
function s.damop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Damage(p,d,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can banish this card from your hand, then target 1 Fish monster in your GY; banish it. During your opponent's turn, if this card is banished: You can Special Summon it. If this card is Special Summoned, you can (except during the Damage Step): Immediately after this effect resolves, Synchro Summon 1 Fish Synchro Monster using this card you control. You can only use each effect of "Zep, Ruby of the Ghoti" once per turn.
|
--ゴーティスの紅玉ゼップ
--Zep, Ruby of the Ghoti
--scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
--Banish 1 Fish monster from the GY
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_HAND)
e1:SetCountLimit(1,id)
e1:SetCost(s.rmvcost)
e1:SetTarget(s.rmtg)
e1:SetOperation(s.rmvop)
c:RegisterEffect(e1)
--Special Summon itself if it is banished
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)
e2:SetCode(EVENT_REMOVE)
e2:SetCountLimit(1,{id,1})
e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
--Synchro Summon 1 Fish monster
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_SPSUMMON_SUCCESS)
e3:SetCountLimit(1,{id,2})
e3:SetCondition(function() return Duel.GetCurrentPhase()~=PHASE_DAMAGE end)
e3:SetTarget(s.syncsumtg)
e3:SetOperation(s.syncsumop)
c:RegisterEffect(e3)
end
function s.rmvcost(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return c:IsAbleToRemoveAsCost() end
Duel.Remove(c,POS_FACEUP,REASON_COST)
end
function s.rmfilter(c)
return c:IsRace(RACE_FISH) and c:IsAbleToRemove() and aux.SpElimFilter(c)
end
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsControler(tp) and s.rmfilter(chkc) end
if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE)
local g=Duel.SelectTarget(tp,s.rmfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0)
end
function s.rmvop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) then
Duel.Remove(tc,POS_FACEUP,REASON_EFFECT)
end
end
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
local c=e:GetHandler()
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsRelateToEffect(e) then
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
end
function s.syncmfilter(c,must)
return c:IsRace(RACE_FISH) and c:IsSynchroSummonable(must)
end
function s.syncsumtg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(s.syncmfilter,tp,LOCATION_EXTRA,0,1,nil,e:GetHandler()) end
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA)
end
function s.syncsumop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if c:IsControler(1-tp) or not c:IsRelateToEffect(e) or c:IsFacedown() then return end
local g=Duel.GetMatchingGroup(s.syncmfilter,tp,LOCATION_EXTRA,0,nil,c)
if #g>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
local sg=g:Select(tp,1,1,nil)
Duel.SynchroSummon(tp,sg:GetFirst(),c)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If a Level 10 EARTH Machine monster(s) is Normal or Special Summoned to your field (except during the Damage Step): You can activate this effect; your opponent takes no battle damage for the rest of this turn (even if this card leaves the field), also you Special Summon 1 Level 4 EARTH Machine monster with 1800 or more ATK from your Deck, and if you do, it becomes Level 10. You can send 1 card from your hand to the GY; add 1 Level 10 EARTH Machine monster from your Deck to your hand. You can only use 1 "Revolving Switchyard" effect per turn, and only once that turn.
|
--転回操車
--Revolving Switchyard
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)
--Special Summon 1 Level 4 EARTH Machine from your Deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SUMMON_SUCCESS)
e2:SetRange(LOCATION_FZONE)
e2:SetCountLimit(1,id)
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)
--Search 1 Level 10 EARTH Machine monster
local e4=Effect.CreateEffect(c)
e4:SetDescription(aux.Stringid(id,1))
e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
e4:SetType(EFFECT_TYPE_IGNITION)
e4:SetRange(LOCATION_FZONE)
e4:SetCountLimit(1,id)
e4:SetCost(s.thcost)
e4:SetTarget(s.thtg)
e4:SetOperation(s.thop)
c:RegisterEffect(e4)
end
function s.cfilter(c,tp)
return c:IsFaceup() and c:IsLevel(10) and c:IsControler(tp) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH)
end
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.cfilter,1,nil,tp)
end
function s.spfilter(c,e,tp)
return c:IsLevel(4) and c:IsAttackAbove(1800) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH)
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)
local c=e:GetHandler()
--Your opponent takes no battle damage
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,2))
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT)
e1:SetCode(EFFECT_AVOID_BATTLE_DAMAGE)
e1:SetTargetRange(0,1)
e1:SetValue(1)
e1:SetReset(RESET_PHASE|PHASE_END)
Duel.RegisterEffect(e1,tp)
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
--It becomes Level 10
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_CHANGE_LEVEL)
e2:SetValue(10)
e2:SetReset(RESET_EVENT|RESETS_STANDARD)
sc:RegisterEffect(e2)
end
Duel.SpecialSummonComplete()
end
function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,nil) end
Duel.DiscardHand(tp,Card.IsAbleToGraveAsCost,1,1,REASON_COST)
end
function s.thfilter(c)
return c:IsLevel(10) and c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_EARTH) 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:
|
Discard 1 card and chain this card to a Spell Card you activated. Whenever that Spell Card is sent to the Graveyard, return it to its owner's hand.
|
--マジック・キャプチャー
--Spell Reclamation
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_CHAINING)
e1:SetCondition(s.condition)
e1:SetCost(s.cost)
e1:SetOperation(s.activate)
c:RegisterEffect(e1)
end
function s.condition(e,tp,eg,ep,ev,re,r,rp)
return rp==tp and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect()
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD,nil)
end
function s.activate(e,tp,eg,ep,ev,re,r,rp)
if re:GetHandler():IsRelateToEffect(re) then
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
e1:SetCode(EVENT_TO_GRAVE)
e1:SetOperation(s.thop)
e1:SetReset(RESET_EVENT|RESETS_STANDARD_EXC_GRAVE)
re:GetHandler():RegisterEffect(e1)
end
end
function s.thop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsHasEffect(EFFECT_NECRO_VALLEY) then
Duel.SendtoHand(e:GetHandler(),tp,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Once per turn: You can target 1 face-up Spell on the field; remove 1 Spell Counter from anywhere on the field, and if you do, return that target to the hand.
|
--聖なる解呪師
--Disenchanter
local s,id=GetID()
function s.initial_effect(c)
--Remove 1 Spell Counter from anywhere on the field, and if you do, return 1 face-up Spell on the field to the hand
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_TOHAND)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCountLimit(1)
e1:SetTarget(s.rthtg)
e1:SetOperation(s.rthop)
c:RegisterEffect(e1)
end
s.counter_list={COUNTER_SPELL}
function s.rthfilter(c)
return c:IsSpell() and c:IsFaceup() and c:IsAbleToHand()
end
function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() and s.rthfilter(chkc) end
if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,COUNTER_SPELL,1,REASON_EFFECT)
and Duel.IsExistingTarget(s.rthfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND)
local g=Duel.SelectTarget(tp,s.rthfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0)
end
function s.rthop(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if Duel.RemoveCounter(tp,1,1,COUNTER_SPELL,1,REASON_EFFECT) and tc:IsRelateToEffect(e) and tc:IsFaceup() then
Duel.SendtoHand(tc,nil,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
2+ Effect Monsters, including an "Orcust" monster This linked card cannot be destroyed by card effects. You can target 2 of your banished Machine monsters; shuffle them into the Deck, then you can send 1 linked monster your opponent controls to the GY. This card cannot attack the turn you activate this effect. You can only use this effect of "Longirsu, the Orcust Orchestrator" once per turn.
|
--オルフェゴール・ロンギルス
--Longirsu, the Orcust Orchestrator
local s,id=GetID()
function s.initial_effect(c)
c:EnableReviveLimit()
Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,nil,s.matcheck)
--indes
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
e1:SetRange(LOCATION_MZONE)
e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT)
e1:SetCondition(s.indcon)
e1:SetValue(1)
c:RegisterEffect(e1)
--to deck
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOGRAVE)
e2:SetType(EFFECT_TYPE_IGNITION)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetRange(LOCATION_MZONE)
e2:SetCountLimit(1,id)
e2:SetCondition(s.tdcon1)
e2:SetCost(s.tdcost)
e2:SetTarget(s.tdtg)
e2:SetOperation(s.tdop)
c:RegisterEffect(e2)
local e3=e2:Clone()
e3:SetType(EFFECT_TYPE_QUICK_O)
e3:SetCode(EVENT_FREE_CHAIN)
e3:SetHintTiming(0,TIMINGS_CHECK_MONSTER)
e3:SetCondition(s.tdcon2)
c:RegisterEffect(e3)
end
function s.matcheck(g,lc,sumtype,tp)
return g:IsExists(Card.IsSetCard,1,nil,SET_ORCUST,lc,sumtype,tp)
end
function s.indcon(e)
return e:GetHandler():IsLinked()
end
function s.tdcon1(e,tp,eg,ep,ev,re,r,rp)
return not Duel.IsPlayerAffectedByEffect(tp,CARD_ORCUSTRATED_BABEL)
end
function s.tdcon2(e,tp,eg,ep,ev,re,r,rp)
return Duel.IsPlayerAffectedByEffect(tp,CARD_ORCUSTRATED_BABEL)
end
function s.tdcost(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return e:GetHandler():GetAttackAnnouncedCount()==0 end
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH)
e1:SetCode(EFFECT_CANNOT_ATTACK)
e1:SetReset(RESETS_STANDARD_PHASE_END)
e:GetHandler():RegisterEffect(e1)
end
function s.tdfilter(c)
return c:IsFaceup() and c:IsRace(RACE_MACHINE) 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,2,2,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK)
local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_REMOVED,0,2,2,nil)
Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0)
end
function s.tdop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
local tg=Duel.GetTargetCards(e)
if #tg==0 then return end
Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT)
local og=Duel.GetOperatedGroup()
if #og==0 then return end
if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end
local g=Duel.GetMatchingGroup(Card.IsLinked,tp,0,LOCATION_MZONE,nil)
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
Duel.BreakEffect()
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE)
local sg=g:Select(tp,1,1,nil)
Duel.SendtoGrave(sg,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If you control a Level/Rank 2 monster, you can Special Summon this card (from your hand). You can only Special Summon "Spright Blue" once per turn this way. If this card is Special Summoned: You can add 1 "Spright" monster from your Deck to your hand, except "Spright Blue". You can only use this effect of "Spright Blue" once per turn.
|
--スプライト・ブルー
--Spright Blue
--Scripted by Hatter
local s,id=GetID()
function s.initial_effect(c)
--Special Summon self
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_FIELD)
e1:SetCode(EFFECT_SPSUMMON_PROC)
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
e1:SetRange(LOCATION_HAND)
e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH)
e1:SetCondition(s.spcon)
c:RegisterEffect(e1)
--Search 1 "Splight" monster
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
e2:SetProperty(EFFECT_FLAG_DELAY)
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
e2:SetCountLimit(1,{id,1})
e2:SetTarget(s.thtg)
e2:SetOperation(s.thop)
c:RegisterEffect(e2)
end
s.listed_names={id}
s.listed_series={SET_SPRIGHT}
function s.spconfilter(c)
return c:IsFaceup() and (c:IsLevel(2) or c:IsRank(2))
end
function s.spcon(e,c)
if c==nil then return true end
local tp=e:GetHandlerPlayer()
return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil)
end
function s.thfilter(c)
return c:IsSetCard(SET_SPRIGHT) and c:IsMonster() 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:
|
When this card is Normal Summoned: You can have all face-up monsters you currently control gain 1 Level, also, they become DARK (these effects last until the End Phase).
|
--ダークロン
--Darklon
local s,id=GetID()
function s.initial_effect(c)
--level,attribute
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
e1:SetCode(EVENT_SUMMON_SUCCESS)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil)
local tc=g:GetFirst()
for tc in aux.Next(g) do
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e1:SetCode(EFFECT_UPDATE_LEVEL)
e1:SetValue(1)
e1:SetReset(RESETS_STANDARD_PHASE_END)
tc:RegisterEffect(e1)
local e2=Effect.CreateEffect(e:GetHandler())
e2:SetType(EFFECT_TYPE_SINGLE)
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
e2:SetCode(EFFECT_CHANGE_ATTRIBUTE)
e2:SetValue(ATTRIBUTE_DARK)
e2:SetReset(RESETS_STANDARD_PHASE_END)
tc:RegisterEffect(e2)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can Tribute 1 other Fish-Type monster, then target 1 card on the field; destroy that target.
|
--光鱗のトビウオ
--Golden Flying Fish
local s,id=GetID()
function s.initial_effect(c)
--destroy
local e1=Effect.CreateEffect(c)
e1:SetDescription(aux.Stringid(id,0))
e1:SetCategory(CATEGORY_DESTROY)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetRange(LOCATION_MZONE)
e1:SetCost(s.cost)
e1:SetTarget(s.target)
e1:SetOperation(s.operation)
c:RegisterEffect(e1)
end
function s.cfilter(c)
return c:IsRace(RACE_FISH)
end
function s.cost(e,tp,eg,ep,ev,re,r,rp,chk)
local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e)
if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,e:GetHandler(),dg) end
local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,e:GetHandler(),dg)
Duel.Release(g,REASON_COST)
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
if chkc then return chkc:IsOnField() end
if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
local tc=Duel.GetFirstTarget()
if tc and tc:IsRelateToEffect(e) then
Duel.Destroy(tc,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can target 1 "Megalith" monster in your GY; Special Summon it in Defense Position, but place it on the bottom of the Deck when it leaves the field (even if this card leaves the field). You can only use this effect of "Megalith Emergence" once per turn.
|
--メガリス・エマージョン
--Megalith Emergence
--Scripted by Naim
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
e1:SetHintTiming(0,TIMING_END_PHASE)
c:RegisterEffect(e1)
--Special summon 1 "Megalith" monster from GY
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_SPECIAL_SUMMON)
e2:SetType(EFFECT_TYPE_QUICK_O)
e2:SetCode(EVENT_FREE_CHAIN)
e2:SetRange(LOCATION_SZONE)
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
e2:SetCountLimit(1,id)
e2:SetTarget(s.sptg)
e2:SetOperation(s.spop)
c:RegisterEffect(e2)
end
s.listed_series={SET_MEGALITH}
function s.spfilter(c,e,tp)
return c:IsSetCard(SET_MEGALITH) 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,0,0)
end
function s.spop(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local tc=Duel.GetFirstTarget()
if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE) then
--Return it to deck if it leaves the field
local e1=Effect.CreateEffect(e:GetHandler())
e1:SetDescription(3301)
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_DECKBOT)
tc:RegisterEffect(e1)
end
Duel.SpecialSummonComplete()
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
When your opponent activates a card's effect that inflicts damage, you can discard this card to negate its activation and destroy it.
|
--ライフ・コーディネイター
--Lifeforce Harmonizer
local s,id=GetID()
function s.initial_effect(c)
--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:SetCode(EVENT_CHAINING)
e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL)
e1:SetRange(LOCATION_HAND)
e1:SetCondition(s.discon)
e1:SetCost(Cost.SelfDiscard)
e1:SetTarget(s.distg)
e1:SetOperation(s.disop)
c:RegisterEffect(e1)
end
function s.discon(e,tp,eg,ep,ev,re,r,rp)
if ep==tp or (re:GetHandler():IsSpellTrap() and not re:IsHasType(EFFECT_TYPE_ACTIVATE)) or not Duel.IsChainNegatable(ev) then return false end
local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE)
if ex then return true end
ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER)
return ex and ((cp~=PLAYER_ALL and Duel.IsPlayerAffectedByEffect(cp,EFFECT_REVERSE_RECOVER)) or
(cp==PLAYER_ALL and (Duel.IsPlayerAffectedByEffect(0,EFFECT_REVERSE_RECOVER) or Duel.IsPlayerAffectedByEffect(1,EFFECT_REVERSE_RECOVER))))
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():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then
Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0)
end
end
function s.disop(e,tp,eg,ep,ev,re,r,rp)
if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then
Duel.Destroy(eg,REASON_EFFECT)
end
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
You can target 1 "Buster Blader" you control; equip this monster from your hand or field to that monster. While this card is equipped to a monster, your opponent cannot Special Summon monsters from the Extra Deck. While this card is equipped to a monster: You can Special Summon this equipped card. You can only use this effect of "Dragon Buster Destruction Sword" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
|
--破壊剣-ドラゴンバスターブレード
--Dragon Buster Destruction Sword
local s,id=GetID()
function s.initial_effect(c)
--Equip itself to a "Buster Blader"
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_IGNITION)
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
e1:SetCategory(CATEGORY_EQUIP)
e1:SetRange(LOCATION_HAND|LOCATION_MZONE)
e1:SetTarget(s.eqtg)
e1:SetOperation(s.eqop)
c:RegisterEffect(e1)
--Opponent cannot Special Summon from the Extra Deck while this card is equipped to a monster
local e2=Effect.CreateEffect(c)
e2:SetType(EFFECT_TYPE_FIELD)
e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetRange(LOCATION_SZONE)
e2:SetTargetRange(0,1)
e2:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) end)
e2:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end)
c:RegisterEffect(e2)
--Special Summon itself while it is equipped to a monster
local e3=Effect.CreateEffect(c)
e3:SetCategory(CATEGORY_SPECIAL_SUMMON)
e3:SetType(EFFECT_TYPE_IGNITION)
e3:SetCountLimit(1,id)
e3:SetRange(LOCATION_SZONE)
e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end)
e3:SetTarget(s.sptg)
e3:SetOperation(s.spop)
c:RegisterEffect(e3)
--clock lizard
local e4=aux.createContinuousLizardCheck(c,LOCATION_SZONE,nil,0,0xff)
e4:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end)
c:RegisterEffect(e4)
end
s.listed_names={CARD_BUSTER_BLADER}
function s.filter(c)
return c:IsFaceup() and c:IsCode(CARD_BUSTER_BLADER)
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.filter(chkc) end
if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0
and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP)
Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil)
Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,tp,0)
end
function s.eqop(e,tp,eg,ep,ev,re,r,rp)
local c=e:GetHandler()
if not c:IsRelateToEffect(e) then return end
if c:IsLocation(LOCATION_MZONE) and c:IsFacedown() then return end
local tc=Duel.GetFirstTarget()
if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 or tc:GetControler()~=tp or tc:IsFacedown() or not tc:IsRelateToEffect(e) then
Duel.SendtoGrave(c,REASON_EFFECT)
return
end
Duel.Equip(tp,c,tc,true)
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_EQUIP_LIMIT)
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
e1:SetValue(s.eqlimit)
e1:SetLabelObject(tc)
c:RegisterEffect(e1)
end
function s.eqlimit(e,c)
return c==e:GetLabelObject()
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 not c:IsRelateToEffect(e) then return end
Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
If you control a face-up Tuner monster, this card cannot be destroyed by battle. When a face-up Tuner monster(s) you control is removed from the field, gain 800 Life Points.
|
--ブラックポータン
--Black Potan
local s,id=GetID()
function s.initial_effect(c)
--If you control a Tuner this card cannot be destroyed by battle
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_SINGLE)
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
e1:SetCondition(function(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsType,TYPE_TUNER),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end)
e1:SetValue(1)
c:RegisterEffect(e1)
--Gain 800 LP
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_RECOVER)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
e2:SetCode(EVENT_LEAVE_FIELD)
e2:SetRange(LOCATION_MZONE)
e2:SetCondition(s.lpcon)
e2:SetTarget(s.lptg)
e2:SetOperation(s.lpop)
c:RegisterEffect(e2)
end
function s.lpconfilter(c,tp)
return c:IsPreviousTypeOnField(TYPE_TUNER) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp)
and c:IsPreviousLocation(LOCATION_MZONE)
end
function s.lpcon(e,tp,eg,ep,ev,re,r,rp)
return eg:IsExists(s.lpconfilter,1,nil,tp)
end
function s.lptg(e,tp,eg,ep,ev,re,r,rp,chk)
if chk==0 then return true end
Duel.SetTargetPlayer(tp)
Duel.SetTargetParam(800)
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,800)
end
function s.lpop(e,tp,eg,ep,ev,re,r,rp)
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
Duel.Recover(p,d,REASON_EFFECT)
end
|
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
|
Once per turn, during the End Phase of any turn in which you Tribute Summoned a monster(s): You can apply these effects, in sequence, based on the number of monsters you Tributed for Tribute Summons this turn. ● 1 or more: Destroy 1 Set card your opponent controls. ● 2 or more: Draw 1 card. ● 3 or more: Add 1 monster from your Graveyard to your hand.
|
--アドバンス・ゾーン
--Advance Zone
local s,id=GetID()
function s.initial_effect(c)
--Activate
local e1=Effect.CreateEffect(c)
e1:SetType(EFFECT_TYPE_ACTIVATE)
e1:SetCode(EVENT_FREE_CHAIN)
c:RegisterEffect(e1)
--Destroy, draw, and/or add 1 monster from your GY to your hand
local e2=Effect.CreateEffect(c)
e2:SetDescription(aux.Stringid(id,0))
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW+CATEGORY_TOHAND)
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
e2:SetCode(EVENT_PHASE+PHASE_END)
e2:SetRange(LOCATION_SZONE)
e2:SetCountLimit(1)
e2:SetTarget(s.target)
e2:SetOperation(s.operation)
c:RegisterEffect(e2)
aux.GlobalCheck(s,function()
s[0]=0
s[1]=0
local ge1=Effect.CreateEffect(c)
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge1:SetCode(EVENT_SUMMON_SUCCESS)
ge1:SetOperation(s.checkop)
Duel.RegisterEffect(ge1,0)
local ge2=Effect.CreateEffect(c)
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
ge2:SetCode(EVENT_MSET)
ge2:SetOperation(s.checkop)
Duel.RegisterEffect(ge2,0)
aux.AddValuesReset(function()
s[0]=0
s[1]=0
end)
end)
end
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
local tc=eg:GetFirst()
if tc:IsTributeSummoned() then
local mg=tc:GetMaterial()
if mg then
s[ep]=s[ep]+mg:FilterCount(Card.IsMonster,nil)
end
end
end
function s.filter2(c)
return c:IsMonster() and c:IsAbleToHand()
end
function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
local b1=s[tp]>0 and Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil)
local b2=s[tp]>1 and Duel.IsPlayerCanDraw(tp,1)
local b3=s[tp]>2 and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_GRAVE,0,1,nil)
if chk==0 then return b1 or b2 or b3 end
if b1 then
local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_ONFIELD,nil)
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0)
end
Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1)
Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE)
end
function s.operation(e,tp,eg,ep,ev,re,r,rp)
if not e:GetHandler():IsRelateToEffect(e) then return end
local act=false
if s[tp]>0 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY)
local g=Duel.SelectMatchingCard(tp,Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,1,nil)
if #g>0 then
Duel.Destroy(g,REASON_EFFECT)
act=true
end
end
if s[tp]>1 and Duel.IsPlayerCanDraw(tp,1) then
if act then Duel.BreakEffect() end
Duel.Draw(tp,1,REASON_EFFECT)
act=true
end
if s[tp]>2 then
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_GRAVE,0,1,1,nil)
if #g>0 then
if act then Duel.BreakEffect() end
Duel.SendtoHand(g,nil,REASON_EFFECT)
Duel.ConfirmCards(1-tp,g)
end
end
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.