instruction
stringclasses
1 value
input
stringlengths
10
1.11k
output
stringlengths
67
7.06k
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Special Summoned by the effect of a Spellcaster-Type monster: You can target any number of your banished "Spellbook" Spell Cards; shuffle them into the Deck, and if you do, return your other banished "Spellbook" Spell Cards to your Graveyard. You can only use the effect of "Wheel of Prophecy" once per turn.
--魔導獣士 ルード --Wheel of Prophecy local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.retcon) e1:SetTarget(s.rettg) e1:SetOperation(s.retop) c:RegisterEffect(e1) end s.listed_series={SET_SPELLBOOK} function s.retcon(e,tp,eg,ep,ev,re,r,rp) return re and re:GetHandler():IsRace(RACE_SPELLCASTER) end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() and c:IsAbleToDeck() end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,99,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.filter2(c) return c:IsFaceup() and c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() end function s.retop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end local g2=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_REMOVED,0,nil) if #g2>0 then Duel.SendtoGrave(g2,REASON_EFFECT|REASON_RETURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner Dinosaur-Type monsters This card's ATK and DEF are equal to the total original ATK of the Synchro Material Monsters used for its Synchro Summon. If this card attacks a face-down Defense Position monster, you can destroy the monster immediately with this card's effect without flipping it face-up or applying damage calculation.
--ジュラック・ヴェルヒプト --Jurrac Velphito local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_DINOSAUR),1,99) c:EnableReviveLimit() --Atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetOperation(s.valop) 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_BATTLE_START) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.valop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsSynchroSummoned() then return end local g=c:GetMaterial() local tc=g:GetFirst() local atk=0 for tc in aux.Next(g) do local tatk=tc:GetTextAttack() if tatk<0 then tatk=0 end atk=atk+tatk end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_SET_DEFENSE) c:RegisterEffect(e2) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() return e:GetHandler()==Duel.GetAttacker() and d and d:IsPosition(POS_FACEDOWN_DEFENSE) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetAttackTarget():IsDestructable() end Duel.SetOperationInfo(0,CATEGORY_DESTROY,Duel.GetAttackTarget(),1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local d=Duel.GetAttackTarget() if d:IsRelateToBattle() then Duel.Destroy(d,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can target Set cards on the field, equal to the number of "Subterror Behemoth" monsters you control; destroy them. You can only use this effect of "Subterror Behemoth Stygokraken" once per turn. When a face-up monster you control is flipped face-down, if you control no face-up monsters: You can Special Summon this card from your hand in Defense Position. Once per turn: You can change this card to face-down Defense Position.
--サブテラーマリス・アクエドリア --Subterror Behemoth Stygokraken local s,id=GetID() function s.initial_effect(c) --Destroy set cards on the field equal to the number of "Subterror Behemoth" monsters you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) -- Special Summon this card from your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetRange(LOCATION_HAND) e2:SetCode(EVENT_CHANGE_POS) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Change this card to face-down Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetTarget(s.postg) e3:SetOperation(s.posop) c:RegisterEffect(e3) end s.listed_series={SET_SUBTERROR_BEHEMOTH} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_SUBTERROR_BEHEMOTH) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ct=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_MZONE,0,nil) if chkc then return chkc:IsOnField() and chkc:IsFacedown() end if chk==0 then return Duel.IsExistingTarget(Card.IsFacedown,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,ct,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFacedown,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,ct,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.cfilter(c,tp) return c:IsPreviousPosition(POS_FACEUP) and c:IsFacedown() and c:IsControler(tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) and not Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD&~RESET_TURN_SET)|RESET_PHASE|PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card was Special Summoned by the effect of a "Gladiator Beast" monster, at the end of any Battle Phase that this card attacked or was attacked, you can return it to the Deck to draw 1 card.
--剣闘獣トラケス --Gladiator Beast Torax local s,id=GetID() function s.initial_effect(c) --Draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PHASE+PHASE_BATTLE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.drcon) e1:SetCost(Cost.SelfToDeck) e1:SetTarget(s.drtg) e1:SetOperation(s.drop) c:RegisterEffect(e1) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:HasFlagEffect(id) and c:GetBattledGroupCount()>0 end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by discarding 1 monster, then target 1 monster in your GY whose Level is lower than the discarded monster's original Level; Special Summon it and equip it with this card. The equipped monster has its effects negated. You can only activate 1 "Overdone Burial" per turn.
--やりすぎた埋葬 --Overdone Burial local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_DISABLE) c:RegisterEffect(e2) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.costfilter(c,e,tp) local lv=c:GetOriginalLevel() return lv>1 and c:IsMonster() and c:IsDiscardable() and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,lv) end function s.spfilter(c,e,tp,lv) return c:IsLevelBelow(lv-1) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp,e:GetLabel()) end if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DISCARD) local cg=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.SendtoGrave(cg,REASON_DISCARD|REASON_COST) local lv=cg:GetFirst():GetLevel() e:SetLabel(lv) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,lv) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_EQUIP,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) then if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end Duel.Equip(tp,c,tc) --Add Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) end end function s.eqlimit(e,c) return e:GetLabelObject()==c end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target cards your opponent controls, up to the number of different Monster Types among the WIND Synchro Monsters you control; destroy them. If your opponent Special Summons a monster(s) (except during the Damage Step): You can banish this card from your GY, then target 1 WIND Synchro Monster you control; banish it, then return it to the field. You can only use each effect of "Speedroid Clear Wing Wonder" once per turn.
--SR/CWW --Speedroid Clear Wing Wonder --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Destroy cards your opponent controls up to the number of different Monster Types among the WIND Synchro Monsters you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Banish 1 WIND Synchro monster you control, then return it local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.rmvrettg) e2:SetOperation(s.rmvretop) c:RegisterEffect(e2) end function s.windsynchrofilter(c) return c:IsAttribute(ATTRIBUTE_WIND) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() 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 local ct=Duel.GetMatchingGroup(s.windsynchrofilter,tp,LOCATION_MZONE,0,nil):GetBinClassCount(Card.GetRace) if chk==0 then return ct>0 and 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,ct,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end function s.rmvretfilter(c,tp) return s.windsynchrofilter(c) and c:IsAbleToRemove() and Duel.GetMZoneCount(tp,c)>0 end function s.rmvrettg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.rmvretfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.rmvretfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmvretfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) end function s.rmvretop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Remove(tc,nil,REASON_EFFECT|REASON_TEMPORARY)>0 and tc:IsLocation(LOCATION_REMOVED) and not tc:IsReason(REASON_REDIRECT) then Duel.BreakEffect() Duel.ReturnToField(tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 monsters You can detach 2 materials from this card, then activate 1 of the following effects; ● Skip your next Draw Phase, also draw 2 cards, then discard 1 card. ● Skip your next Main Phase 1, also Special Summon 1 monster from your GY in Defense Position. ● Skip the Battle Phase of your next turn, also double the ATK of 1 monster you control until the end of this turn. You can only use this effect of "Number 60: Dugares the Timeless" once per turn.
--No.60 刻不知のデュガレス --Number 60: Dugares the Timeless --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure Xyz.AddProcedure(c,nil,4,2) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(2,2,nil)) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) end s.xyz_number=60 function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) --Draw 2 cards, then discard 1 card local b1=Duel.IsPlayerCanDraw(tp,2) --Special Summon 1 monster from your GY in Defense Position local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) --Double the ATK of 1 monster you control until the end of this turn local b3=Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) if chk==0 then return b1 or b2 or b3 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}, {b3,aux.Stringid(id,3)}) e:SetLabel(op) if op==1 then e:SetCategory(CATEGORY_DRAW+CATEGORY_HANDES) e:SetProperty(EFFECT_FLAG_PLAYER_TARGET) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(2) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) elseif op==2 then e:SetCategory(CATEGORY_SPECIAL_SUMMON) e:SetProperty(0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) elseif op==3 then e:SetCategory(CATEGORY_ATKCHANGE) e:SetProperty(0) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local op=e:GetLabel() local c=e:GetHandler() local skipped_phase=(op==1 and PHASE_DRAW) or (op==2 and PHASE_MAIN1) or (op==3 and PHASE_BATTLE) local skip_effect_code=(op==1 and EFFECT_SKIP_DP) or (op==2 and EFFECT_SKIP_M1) or (op==3 and EFFECT_SKIP_BP) local turn_ct=Duel.GetTurnCount() local curr_phase=Duel.GetCurrentPhase() local skip_next_turn=(Duel.IsTurnPlayer(tp) and curr_phase>=skipped_phase) or skipped_phase==PHASE_BATTLE local reset_ct=skip_next_turn and 2 or 1 --Skip your next Draw Phase/your next Main Phase 1/the Battle Phase of your next turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,3+op)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(skip_effect_code) e1:SetTargetRange(1,0) if skip_next_turn then e1:SetCondition(function() return Duel.GetTurnCount()~=turn_ct end) end e1:SetReset(RESET_PHASE|PHASE_END|RESET_SELF_TURN,reset_ct) Duel.RegisterEffect(e1,tp) if op==1 then --Draw 2 cards, then discard 1 card local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Draw(p,d,REASON_EFFECT)==2 then Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT|REASON_DISCARD) end elseif op==2 then --Special Summon 1 monster from your GY in Defense Position 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_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end elseif op==3 then --Double the ATK of 1 monster you control until the end of this turn Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) local tc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() if tc then Duel.HintSelection(tc,true) --Double its ATK local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EFFECT_SET_ATTACK_FINAL) e2:SetValue(tc:GetAttack()*2) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 4 or lower Dragon monsters, except Tokens When this card is Link Summoned: You can pay 500 LP, then target 1 Level 5 or higher monster in your GY; Special Summon it to your zone this card points to, but it cannot attack this turn, also it has its effects negated.
--ツイン・トライアングル・ドラゴン --Twin Triangle Dragon local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Link summon procedure Link.AddProcedure(c,s.mfilter,2) --Special summon 1 level 5+ dragon monster from 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:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.spcon) e1:SetCost(Cost.PayLP(500)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.mfilter(c,lc,sumtype,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON,lc,sumtype,tp) and not c:IsType(TYPE_TOKEN,lc,sumtype,tp) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLinkSummoned() end function s.filter(c,e,tp,zone) return c:IsLevelAbove(5) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=e:GetHandler():GetLinkedZone(tp) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp,zone) 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,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local zone=c:GetLinkedZone(tp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1,true) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2,true) --Cannot attack this turn local e3=Effect.CreateEffect(c) e3:SetDescription(3206) e3:SetProperty(EFFECT_FLAG_CLIENT_HINT) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_ATTACK) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3,true) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If 2 or more cards are in the same column, you can Special Summon this card (from your hand) in that column. You can only Special Summon "Mekk-Knight Green Horizon" once per turn this way. When an attack is declared involving this card and an opponent's monster in this card's column: You can target 1 "Mekk-Knight" monster in your GY; add it to your hand.
--翠嵐の機界騎士 --Mekk-Knight Green Horizon --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon itself from hand local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetValue(s.hspval) c:RegisterEffect(e1) --Add 1 "Mekk-Knight" monster from GY to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_ATTACK_ANNOUNCE) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_MEKK_KNIGHT} function s.cfilter(c) return c:GetColumnGroupCount()>0 end function s.hspval(e,c) local tp=c:GetControler() local zone=0 local lg=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) for tc in aux.Next(lg) do zone=(zone|tc:GetColumnZone(LOCATION_MZONE,0,0,tp)) end return 0,zone end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=c:GetBattleTarget() return c:IsRelateToBattle() and tc and tc:IsControler(1-tp) and c:GetColumnGroup():IsContains(tc) end function s.thfilter(c) return c:IsSetCard(SET_MEKK_KNIGHT) and c:IsMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 monsters with different Types Cannot be used as Link Material. If this card is Link Summoned: You can Special Summon 1 monster "Fur Hire" with a different Type from the 3 monsters used for the Link Summon, from your Deck in Defense Position. If a card(s) your opponent controls is destroyed by battle or card effect: You can draw 1 card, then if you control 3 or more monsters "Fur Hire" with different names, draw 2 additional cards. You can only use each effect of "Folgo, Justice Fur Hire" once per turn.
--空牙団の大義 フォルゴ --Folgo, Justice Fur Hire --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,nil,3,3,s.lcheck) --cannot link material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_CANNOT_BE_LINK_MATERIAL) e1:SetValue(1) c:RegisterEffect(e1) --spsummon 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:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_MATERIAL_CHECK) e3:SetValue(s.valcheck) e3:SetLabelObject(e2) c:RegisterEffect(e3) --draw local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_DESTROYED) e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_PLAYER_TARGET) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.drcon) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end s.listed_series={SET_FUR_HIRE} function s.lcheck(g,lc,sumtype,tp) return g:CheckDifferentPropertyBinary(Card.GetRace,lc,sumtype,tp) end function s.valcheck(e,c) local g=c:GetMaterial() local val=0 for tc in aux.Next(g) do val=val|tc:GetRace() end e:GetLabelObject():SetLabel(val) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLinkSummoned() and #(e:GetHandler():GetMaterial())==3 end function s.spfilter(c,e,tp,rc) return c:IsSetCard(SET_FUR_HIRE) and not c:IsRace(rc) 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.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp,e:GetLabel()) 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)<1 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,e:GetLabel()) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.drcfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and not c:IsPreviousControler(tp) and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.drcfilter,1,nil,tp) end function s.drfilter(c) return c:IsFaceup() and c:IsSetCard(SET_FUR_HIRE) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.drfilter,tp,LOCATION_MZONE,0,nil) local ct=1 if g:GetClassCount(Card.GetCode)>=3 then ct=3 end if chk==0 then return Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.drfilter,tp,LOCATION_MZONE,0,nil) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) if Duel.Draw(p,1,REASON_EFFECT)>0 and g:GetClassCount(Card.GetCode)>=3 then Duel.BreakEffect() Duel.Draw(p,2,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: Excavate the top 6 cards of your Deck, then place them on top of the Deck in any order. Once per turn: You can pay 1500 LP; Special Summon 1 "Materiactor" Xyz Monster from your Extra Deck, by using 1 Level 3 Normal Monster you control as material (this is treated as an Xyz Summon), also you cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters. If an Xyz Monster is Xyz Summoned: You can attach the top card of your Deck to 1 "Materiactor" Xyz Monster you control.
--原質の炉心貫通 --Materiactor Meltthrough --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Excavate the top 6 cards of your Deck, and if you do, place them on top of the Deck in any order local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.excavtg) e1:SetOperation(s.excavop) c:RegisterEffect(e1) --Special Summon 1 "Materiactor" Xyz Monster from your Extra Deck, by using 1 Level 3 Normal Monster you control as material (this is treated as an Xyz Summon) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetCost(Cost.PayLP(1500)) e2:SetTarget(s.xyztg) e2:SetOperation(s.xyzop) c:RegisterEffect(e2) --Attach the top card of your Deck to 1 "Materiactor" Xyz Monster you control local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,0,EFFECT_COUNT_CODE_CHAIN) e3:SetCondition(function(e,tp,eg) return eg:IsExists(function(c) return c:IsXyzSummoned() and c:IsType(TYPE_XYZ) and c:IsFaceup() end,1,nil) end) e3:SetTarget(s.attachtg) e3:SetOperation(s.attachop) c:RegisterEffect(e3) end s.listed_series={SET_MATERIACTOR} function s.excavtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>=6 end end function s.excavop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 then Duel.ConfirmDecktop(tp,6) Duel.SortDecktop(tp,tp,6) end end function s.normalfilter(c,e,tp) if not (c:IsLevel(3) and c:IsType(TYPE_NORMAL) and c:IsFaceup()) then return false end local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and Duel.IsExistingMatchingCard(s.xyzspfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end function s.xyzspfilter(c,e,tp,mc) return c:IsType(TYPE_XYZ) and c:IsSetCard(SET_MATERIACTOR) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and mc:IsCanBeXyzMaterial(c,tp) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end function s.xyztg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.normalfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.xyzop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) local mc=Duel.SelectMatchingCard(tp,s.normalfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp):GetFirst() if mc then Duel.HintSelection(mc) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.xyzspfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,mc):GetFirst() if sc then sc:SetMaterial(mc) Duel.Overlay(sc,mc) if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then sc:CompleteProcedure() end end end --You cannot Special Summon from the Extra Deck for the rest of this turn, except Xyz Monsters local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,3)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_XYZ) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.attachfilter(c,tp,top_c) return c:IsSetCard(SET_MATERIACTOR) and c:IsType(TYPE_XYZ) and c:IsFaceup() and top_c:IsCanBeXyzMaterial(c,tp,REASON_EFFECT) end function s.attachtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local top_c=Duel.GetDecktopGroup(tp,1):GetFirst() return top_c and Duel.IsExistingMatchingCard(s.attachfilter,tp,LOCATION_MZONE,0,1,nil,tp,top_c) end end function s.attachop(e,tp,eg,ep,ev,re,r,rp) local top_c=Duel.GetDecktopGroup(tp,1):GetFirst() if not top_c then return end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,4)) local xyzc=Duel.SelectMatchingCard(tp,s.attachfilter,tp,LOCATION_MZONE,0,1,1,nil,tp,top_c):GetFirst() if xyzc then Duel.HintSelection(xyzc) Duel.DisableShuffleCheck() Duel.Overlay(xyzc,top_c) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can equip 1 "Inzektor" monster from your hand or Graveyard to this card. If an "Inzektor" card equips to this card: You can look at all Set cards your opponent controls. While this card is equipped to a monster, that monster's Level is increased by 1, also it gains ATK and DEF equal to this card's ATK and DEF.
--甲虫装機 リュシオル --Inzektor Firefly local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCategory(CATEGORY_EQUIP) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e1) --equip effect local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_LEVEL) e2:SetValue(1) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetValue(100) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_EQUIP) e4:SetCode(EFFECT_UPDATE_DEFENSE) e4:SetValue(100) c:RegisterEffect(e4) --confirm local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_EQUIP) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.cfcon) e3:SetTarget(s.cftg) e3:SetOperation(s.cfop) c:RegisterEffect(e3) end s.listed_series={SET_INZEKTOR} function s.eqval(ec,c,tp) return ec:IsControler(tp) and ec:IsSetCard(SET_INZEKTOR) end function s.filter(c) return c:IsSetCard(SET_INZEKTOR) and c:IsMonster() and not c:IsForbidden() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_GRAVE|LOCATION_HAND) end function s.equipop(c,e,tp,tc) c:EquipByEffectAndLimitRegister(e,tp,tc,nil,true) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end if c:IsFacedown() or not c:IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then s.equipop(c,e,tp,tc) end end function s.eqfilter(c,ec) return c:IsFaceup() and c:GetEquipTarget()==ec and c:IsSetCard(SET_INZEKTOR) end function s.cfcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.eqfilter,1,nil,e:GetHandler()) end function s.cftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFacedown,tp,0,LOCATION_ONFIELD,1,nil) end end function s.cfop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFacedown,tp,0,LOCATION_ONFIELD,nil) if #g>0 then Duel.ConfirmCards(tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can add 1 "Prediction Princess" monster, except "Prediction Princess Bibliomuse", and 1 Ritual Spell from your Deck to your hand. If this card is Tributed and sent to the GY: You can Special Summon this card in face-down Defense Position. You can only use each of the preceding effects of "Prediction Princess Bibliomuse" once per turn. Your opponent cannot target Ritual Monsters you control with card effects, also they cannot be destroyed by your opponent's card effects.
--占術姫ビブリオムーサ --Prediction Princess Bibliomuse --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself if tributed and sent to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsReason(REASON_RELEASE) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Add to hand 1 "Prediction Princess" Monster and 1 Ritual Spell local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Ritual monsters you control cannot be targeted by opponent's effects local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_RITUAL)) e3:SetValue(aux.tgoval) c:RegisterEffect(e3) --Ritual monsters you control cannot be destroyed by opponent's effects local e4=e3:Clone() e4:SetProperty(0) e4:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e4:SetValue(aux.indoval) c:RegisterEffect(e4) end s.listed_series={SET_PREDICTION_PRINCESS} s.listed_names={id} function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_GRAVE) 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_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,c) end end function s.thfilter1(c) return c:IsSetCard(SET_PREDICTION_PRINCESS) and c:IsMonster() and not c:IsCode(id) and c:IsAbleToHand() end function s.thfilter2(c) return c:IsRitualSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter1,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,2,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not (Duel.IsExistingMatchingCard(s.thfilter1,tp,LOCATION_DECK,0,1,nil) and Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_DECK,0,1,nil)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g1=Duel.SelectMatchingCard(tp,s.thfilter1,tp,LOCATION_DECK,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g2=Duel.SelectMatchingCard(tp,s.thfilter2,tp,LOCATION_DECK,0,1,1,nil) g1:Merge(g2) Duel.SendtoHand(g1,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot attack unless you control an "Adventurer Token". You can only use each of the following effects of "Magicore Warrior of the Relics" once per turn. If you control an "Adventurer Token": You can Special Summon this card from your hand. At the end of the Battle Phase, if your monster that mentions "Adventurer Token" battled: You can Set 1 Trap that mentions "Adventurer Token" directly from your Deck.
--遺跡の魔鉱戦士 --Magicore Warrior of the Relics --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Cannot attack unless you control an "Adventurer Token" local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetCondition(aux.NOT(s.bravecon)) c:RegisterEffect(e1) --Special Summon itself from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.bravecon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Set Trap that lists "Adventurer Token" from the Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE|PHASE_BATTLE) e3:SetCountLimit(1,{id,1}) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.setcon) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_BATTLED) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_names={TOKEN_ADVENTURER} function s.checkop(e,tp,eg,ep,ev,re,r,rp) local attacker,target=Duel.GetBattleMonster(tp) if attacker and attacker:ListsCode(TOKEN_ADVENTURER) then Duel.RegisterFlagEffect(attacker:GetControler(),id,RESET_PHASE|PHASE_BATTLE,0,1) end if target and target:ListsCode(TOKEN_ADVENTURER) then Duel.RegisterFlagEffect(target:GetControler(),id,RESET_PHASE|PHASE_BATTLE,0,1) end end function s.bravecon(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,TOKEN_ADVENTURER),e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFlagEffect(tp,id)>0 end function s.setfilter(c) return c:IsTrap() and c:ListsCode(TOKEN_ADVENTURER) and c:IsSSetable() and not c:IsForbidden() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_DECK,0,1,1,nil) if #g==0 then return end Duel.SSet(tp,g) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Fire Fist" monster you control attacks or is attacked, during damage calculation (in either player's turn): You can send 1 face-up "Fire Formation" Spell/Trap Card you control and 1 "Fire Fist" monster from your hand to the Graveyard once per battle; your attacking/attacked monster gains ATK equal to the original ATK of the monster sent to the Graveyard, during damage calculation only.
--空炎星-サイチョウ --Brotherhood of the Fire Fist - Rhino local s,id=GetID() function s.initial_effect(c) --attack up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) e1:SetCondition(s.atkcon) e1:SetCost(s.atkcost) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end s.listed_series={SET_FIRE_FIST,SET_FIRE_FORMATION} function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return (Duel.GetAttacker():IsControler(tp) and Duel.GetAttacker():IsSetCard(SET_FIRE_FIST)) or (Duel.GetAttackTarget() and Duel.GetAttackTarget():IsControler(tp) and Duel.GetAttackTarget():IsSetCard(SET_FIRE_FIST)) end function s.filter1(c) return c:IsFaceup() and c:IsSetCard(SET_FIRE_FORMATION) and c:IsAbleToGraveAsCost() end function s.filter2(c) return c:IsSetCard(SET_FIRE_FIST) and c:GetBaseAttack()>0 and c:IsAbleToGraveAsCost() end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)==0 and Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_ONFIELD,0,1,nil) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_HAND,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g1=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g2=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_HAND,0,1,1,nil) e:SetLabel(g2:GetFirst():GetBaseAttack()) g1:Merge(g2) Duel.SendtoGrave(g1,REASON_COST) e:GetHandler():RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE_CAL,0,1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=Duel.GetAttacker() if c:IsControler(1-tp) then c=Duel.GetAttackTarget() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(e:GetLabel()) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks, it is changed to Defense Position at the end of the Battle Phase. Once per turn: You can target 1 face-up Defense Position monster your opponent controls; discard 1 card, and if you do, equip that opponent's monster to this card (max. 1). This card gains ATK equal to that equipped monster's. Once per turn, during the End Phase: Special Summon that equipped monster to your opponent's field in Defense Position. * The above text is unofficial and describes the card's functionality in the OCG.
--トランスフォーム・スフィア --Transforming 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_HANDES+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,s.eqcon,s.eqval,s.equipop,e1) --to defense local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.poscon) e2:SetOperation(s.posop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.eqval(ec,c,tp) return ec:IsControler(1-tp) and ec:IsPosition(POS_FACEUP_DEFENSE) end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetHandler():GetEquipGroup():Filter(s.eqfilter,nil) return #g==0 end function s.eqfilter(c) return c:GetFlagEffect(id)~=0 end function s.filter(c) return c:IsPosition(POS_FACEUP_DEFENSE) and c:IsAbleToChangeControler() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and s.filter(chkc) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.GetFieldGroup(tp,LOCATION_HAND,0)~=0 and Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) end function s.equipop(c,e,tp,tc) local atk=tc:GetTextAttack() if atk<0 then atk=0 end if not c:EquipByEffectAndLimitRegister(e,tp,tc,id) then return end if atk>0 then local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OWNER_RELATE+EFFECT_FLAG_SET_AVAILABLE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetReset(RESET_EVENT|RESETS_STANDARD) e2:SetValue(atk) tc:RegisterEffect(e2) end end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.GetFieldGroup(tp,LOCATION_HAND,0)==0 then return end Duel.DiscardHand(tp,nil,1,1,REASON_EFFECT|REASON_DISCARD) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then s.equipop(c,e,tp,tc) end end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackedCount()>0 end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsAttackPos() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local g=e:GetHandler():GetEquipGroup():Filter(s.eqfilter,nil) return #g==1 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local tc=e:GetHandler():GetEquipGroup():Filter(s.eqfilter,nil):GetFirst() Duel.SetTargetCard(tc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tc,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) and Duel.IsPlayerCanSpecialSummon(tp) then if Duel.SpecialSummon(tc,0,tp,1-tp,false,false,POS_FACEUP_DEFENSE)==0 then Duel.SendtoGrave(tc,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Any cards that would be returned to the Deck from the Graveyard are removed from play instead.
--転生断絶 --Transmigration Break 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) --remove local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_GRAVE,LOCATION_GRAVE) e2:SetCode(EFFECT_TO_DECK_REDIRECT) e2:SetValue(LOCATION_REMOVED) c:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand or GY (Quick Effect): You can Tribute 1 "@Ignister" monster; Special Summon this card, but banish it when it leaves the field. When a card or effect is activated that targets a Cyberse monster(s) you control, and you control a Cyberse monster that was Special Summoned from the Extra Deck (Quick Effect): You can Tribute this card; negate that effect. You can only use each effect of "Kurikurinku @Ignister" once per turn.
--クリクリンク@イグニスター --Kurikurinku @Ignister --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,{id,0}) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Negate an effect that targets a Cyberse monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.discon) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.distg) e2:SetOperation(function(e,tp,eg,ep,ev,re,r,rp) Duel.NegateEffect(ev) end) c:RegisterEffect(e2) end s.listed_series={SET_IGNISTER} function s.spcostfilter(c,tp) return c:IsSetCard(SET_IGNISTER) 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.CheckReleaseGroupCost(tp,s.spcostfilter,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.spcostfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then --Banish it when it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1,true) end end function s.disconfilter(c) return c:IsRace(RACE_CYBERSE) and c:IsSummonLocation(LOCATION_EXTRA) and c:IsFaceup() end function s.tgfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsRace(RACE_CYBERSE) and c:IsFaceup() end function s.discon(e,tp,eg,ep,ev,re,r,rp) if not (Duel.IsExistingMatchingCard(s.disconfilter,tp,LOCATION_MZONE,0,1,nil) and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and Duel.IsChainDisablable(ev)) then return false end local tg=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return tg and tg:IsExists(s.tgfilter,1,nil,tp) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,tp,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Each time a Spell Card is activated, place 1 Spell Counter on this card when that Spell resolves. You can remove 3 Spell Counters from this card; Special Summon both this card from your Pendulum Zone and 1 face-up monster from your Extra Deck that you can place a Spell Counter on, and if you do, place 1 Spell Counter on each. ---------------------------------------- [ Monster Effect ] You can only Special Summon "Magister(s) of Endymion" once per turn. When this card declares an attack: You can place 1 Spell Counter on it. Once per opponent's turn (Quick Effect): You can remove 3 Spell Counters from your field; Special Summon 1 monster from your Deck that you can place a Spell Counter on. If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone, then place the same number of Spell Counters on it that it had as a monster.
--マギステル・オブ・エンディミオン --Magister of Endymion --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:SetSPSummonOnce(id) c:EnableCounterPermit(COUNTER_SPELL,LOCATION_PZONE|LOCATION_MZONE) Pendulum.AddProcedure(c) --Add counter to itself local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EVENT_CHAIN_SOLVING) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_PZONE) e1:SetOperation(s.ctop) c:RegisterEffect(e1) --Special Summon from Extra deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_COUNTER) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_PZONE) e2:SetCost(s.spcost1) e2:SetTarget(s.sptg1) e2:SetOperation(s.spop1) c:RegisterEffect(e2) --Place Spell counters local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCategory(CATEGORY_COUNTER) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetCondition(s.ctcon) e3:SetOperation(s.ctop2) c:RegisterEffect(e3) --Special Summon from deck local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_FREE_CHAIN) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.spcon2) e4:SetCost(s.spcost2) e4:SetTarget(s.sptg2) e4:SetOperation(s.spop2) c:RegisterEffect(e4) --Counter check local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e0:SetCode(EVENT_DESTROY) e0:SetOperation(s.ctchk) e0:SetLabel(0) c:RegisterEffect(e0) --Place itself in the `Pendulum Zone when destroyed local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e5:SetProperty(EFFECT_FLAG_DELAY) e5:SetCode(EVENT_DESTROYED) e5:SetLabelObject(e0) e5:SetCondition(s.pencon) e5:SetTarget(s.pentg) e5:SetOperation(s.penop) c:RegisterEffect(e5) end s.counter_place_list={COUNTER_SPELL} function s.ctop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() and re:GetHandler()~=c then c:AddCounter(COUNTER_SPELL,1) end end function s.spcost1(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanRemoveCounter(tp,COUNTER_SPELL,3,REASON_COST) end c:RemoveCounter(tp,COUNTER_SPELL,3,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCanAddCounter(COUNTER_SPELL,1,false,LOCATION_MZONE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg1(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCountFromEx(tp)>0 and Duel.GetUsableMZoneCount(tp)>1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(aux.FaceupFilter(s.spfilter,e,tp),tp,LOCATION_EXTRA,0,1,nil,e,tp) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,0,0) end function s.spop1(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or not c:IsCanBeSpecialSummoned(e,0,tp,false,false) or Duel.GetLocationCount(tp,LOCATION_MZONE)<1 or Duel.GetLocationCountFromEx(tp)<1 or Duel.GetUsableMZoneCount(tp)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.FaceupFilter(s.spfilter,e,tp),tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then g:AddCard(c) if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)==2 then g:ForEach(Card.AddCounter,COUNTER_SPELL,1) end end end function s.ctcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsCanAddCounter(COUNTER_SPELL,1,false,LOCATION_MZONE) end function s.ctop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then c:AddCounter(COUNTER_SPELL,1) end end function s.spcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.spcost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsCanRemoveCounter(tp,1,0,COUNTER_SPELL,3,REASON_COST) end Duel.RemoveCounter(tp,1,0,COUNTER_SPELL,3,REASON_COST) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and 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.spop2(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_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.ctchk(e,tp,eg,ep,ev,re,r,rp) e:SetLabel(e:GetHandler():GetCounter(COUNTER_SPELL)) end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return r&REASON_EFFECT+REASON_BATTLE~=0 and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetLabelObject():GetLabel() if chk==0 then return Duel.CheckPendulumZones(tp) and (ct==0 or e:GetHandler():IsCanAddCounter(COUNTER_SPELL,ct,false,LOCATION_PZONE)) end end function s.penop(e,tp,eg,ep,ev,re,r,rp) if not Duel.CheckPendulumZones(tp) then return false end local c=e:GetHandler() local ct=e:GetLabelObject():GetLabel() if c:IsRelateToEffect(e) and Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) and ct>0 then Duel.BreakEffect() c:AddCounter(COUNTER_SPELL,ct) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 Fusion Monster in your Extra Deck, add 1 of the Fusion Materials whose name is specifically listed on that card from your Deck to your hand, then you can add 1 "Polymerization" from your Graveyard to your hand.
--融合準備 --Fusion Reserve local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={CARD_POLYMERIZATION} function s.filter1(c,tp) return c.material and c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_DECK,0,1,nil,c) end function s.filter2(c,fc) if c:IsForbidden() or not c:IsAbleToHand() then return false end return c:IsCode(table.unpack(fc.material)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_EXTRA,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) end function s.filter3(c) return c:IsCode(CARD_POLYMERIZATION) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local cg=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_EXTRA,0,1,1,nil,tp) if #cg==0 then return end Duel.ConfirmCards(1-tp,cg) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_DECK,0,1,1,nil,cg:GetFirst()) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) local tg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.filter3),tp,LOCATION_GRAVE,0,nil) if #tg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=tg:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Fiend Tuner + 1+ non-Tuner monsters When this card is Synchro Summoned: You can target 1 "Resonator" monster in your GY; Special Summon it. You cannot Special Summon monsters from the Extra Deck the turn you activate this effect, except DARK Dragon Synchro Monsters. During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY, then target 2 Level 1 "Resonator" monsters in your GY; Special Summon both.
--レッド・ライジング・ドラゴン --Red Rising Dragon local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_FIEND),1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCondition(s.spcon) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --spsummon (grave) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg2) e2:SetOperation(s.spop2) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_RESONATOR} function s.counterfilter(c) return not c:IsSummonLocation(LOCATION_EXTRA) or (c:IsType(TYPE_SYNCHRO) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON)) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsSynchroSummoned() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) --lizard check aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not (c:IsType(TYPE_SYNCHRO) and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_DRAGON)) and c:IsLocation(LOCATION_EXTRA) end function s.lizfilter(e,c) return not (c:IsOriginalType(TYPE_SYNCHRO) and c:IsOriginalAttribute(ATTRIBUTE_DARK) and c:IsOriginalRace(RACE_DRAGON)) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_RESONATOR) 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,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end function s.spfilter2(c,e,tp) return c:IsSetCard(SET_RESONATOR) and c:GetLevel()==1 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter2(chkc,e,tp) end if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsExistingTarget(s.spfilter2,tp,LOCATION_GRAVE,0,2,e:GetHandler(),e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter2,tp,LOCATION_GRAVE,0,2,2,e:GetHandler(),e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,2,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local g=Duel.GetTargetCards(e) if ft<2 or #g~=2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end Duel.SpecialSummon(g,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 "Magical Musket" monster: Target up to 3 cards in the GYs; banish them. You can only activate 1 "Magical Musket - Dancing Needle" per turn.
--魔弾-ダンシング・ニードル --Magical Musket - Dancing Needle --Scripted by Eerie Code 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_MAGICAL_MUSKET} function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MAGICAL_MUSKET) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,3,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetChainInfo(0,CHAININFO_TARGET_CARDS) local sg=g:Filter(Card.IsRelateToEffect,nil,e) Duel.Remove(sg,POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] During your Main Phase: You can add 1 face-up "Pendulum" Pendulum Monster from your Extra Deck to your hand, then destroy this card. You can only use this effect of "PenduLuMoon" once per turn. ---------------------------------------- [ Monster Effect ] During your Main Phase: You can add up to 2 face-up Pendulum Monsters from your Extra Deck to your hand, with Levels between the Pendulum Scales of the 2 cards in your Pendulum Zones, also for the rest of this turn, until you Pendulum Summon, you cannot activate monster effects, and the effects of any cards in your Pendulum Zones are negated. You can only use this effect of "PenduLuMoon" once per turn.
--ペンデュラムーン --PenduLuMoon --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Pendulum properties Pendulum.AddProcedure(c) --Add 1 "Pendulum" Pendulum monster from the Extra Deck to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Add up to 2 Pendulum monsters from the Extra Deck to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg2) e2:SetOperation(s.thop2) c:RegisterEffect(e2) end s.listed_series={SET_PENDULUM} function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_PENDULUM) and c:IsType(TYPE_PENDULUM) 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_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_EXTRA,0,1,1,nil):GetFirst() if tc and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,tc) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.BreakEffect() Duel.Destroy(c,REASON_EFFECT) end end function s.thfilter2(c,lsc,rsc) return c:IsFaceup() and c:HasLevel() and c:IsType(TYPE_PENDULUM) and c:GetLevel()>lsc and c:GetLevel()<rsc and c:IsAbleToHand() end function s.thtg2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local lsc=Duel.GetFieldCard(tp,LOCATION_PZONE,0) local rsc=Duel.GetFieldCard(tp,LOCATION_PZONE,1) if not (lsc and rsc) then return false end lsc=lsc:GetLeftScale() rsc=rsc:GetRightScale() if lsc>rsc then lsc,rsc=rsc,lsc end return Duel.IsExistingMatchingCard(s.thfilter2,tp,LOCATION_EXTRA,0,1,nil,lsc,rsc) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) end function s.thop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Cannot activate monster effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(1,0) e1:SetValue(function(_,re) return re:IsMonsterEffect() end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Pendulum effects are negated local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetTargetRange(LOCATION_PZONE,0) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) --Reset restrictions if the player Pendulum Summons local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetLabelObject({e1,e2}) e3:SetOperation(s.checkop) e3:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e3,tp) --Add cards to the hand local lsc=Duel.GetFieldCard(tp,LOCATION_PZONE,0) local rsc=Duel.GetFieldCard(tp,LOCATION_PZONE,1) if not (lsc and rsc) then return end lsc=lsc:GetLeftScale() rsc=rsc:GetRightScale() if lsc>rsc then lsc,rsc=rsc,lsc end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectMatchingCard(tp,s.thfilter2,tp,LOCATION_EXTRA,0,1,2,nil,lsc,rsc) if #sg>0 then Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.psfilter(c,tp) return c:IsSummonPlayer(tp) and c:IsPendulumSummoned() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local ef=e:GetLabelObject() if ef and eg and eg:IsExists(s.psfilter,1,nil,tp) then ef[1]:Reset() ef[2]:Reset() e:Reset() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 Dragon monster you control; its ATK becomes doubled (until the end of this turn), then, if your opponent currently controls a Dragon monster, the activation of the targeted monster's effects cannot be negated for the rest of this turn. During your Main Phase: You can banish this card from your GY; Special Summon 1 of your Dragon Xyz Monsters that is banished or in your GY, in Defense Position. You can only use 1 "Saga of the Dragon Emperor" effect per turn, and only once that turn.
--竜皇神話 --Saga of the Dragon Emperor --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Double ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsRace(RACE_DRAGON) end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsRace,RACE_DRAGON),tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsRace,RACE_DRAGON),tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or tc:IsFacedown() then return end local c=e:GetHandler() --Double ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetAttack()*2) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) if Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_DRAGON),tp,0,LOCATION_MZONE,1,nil) then --Cannot negate activation of effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CLIENT_HINT) e2:SetCode(EFFECT_CANNOT_INACTIVATE) e2:SetRange(LOCATION_MZONE) e2:SetValue(function(e,ct) return e:GetHandler()==Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT):GetHandler() end) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsRace(RACE_DRAGON) and c:IsType(TYPE_XYZ) 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.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,e,tp) 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) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,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:
1 "Genex" Tuner + 1 or more non-Tuner monsters Once per turn, you can discard 1 card to select 1 Level 4 or lower Machine-Type monster from your Graveyard, and Special Summon it. The ATK of that monster is doubled until the End Phase, but it cannot attack your opponent directly. Remove that monster from play during your End Phase.
--A・ジェネクス・アクセル --Genex Ally Axel local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Synchro summon procedure Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_GENEX),1,1,Synchro.NonTuner(nil),1,99) --Special summon 1 level 4 or lower machine monster from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_GENEX} function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_MACHINE) 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,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not tc:IsCanBeSpecialSummoned(e,0,tp,false,false) then return end --ATK becomes doubled of original ATK local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK) e1:SetValue(tc:GetTextAttack()*2) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TOFIELD)) tc:RegisterEffect(e1) --Cannot attack directly local e2=Effect.CreateEffect(e:GetHandler()) e2:SetDescription(3207) e2:SetProperty(EFFECT_FLAG_CLIENT_HINT) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e2:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) tc:RegisterEffect(e2) --Destroy it during end phase local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetRange(LOCATION_MZONE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCondition(s.rmcon) e3:SetOperation(s.rmop) e3:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)) e3:SetCountLimit(1) tc:RegisterEffect(e3) Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Excavate the top 3 cards of your Deck and Special Summon as many "Flower Cardian" monsters among them as possible, ignoring their Summoning conditions, but their Levels become 2 and they have their effects negated. Banish the remaining cards, face-down, and if you do, lose 1000 LP for each. You can banish this card from your Graveyard and Tribute 1 monster; Special Summon 1 "Flower Cardian" monster from your hand, ignoring its Summoning conditions. You can only activate 1 "Super Koi Koi" per turn.
--超こいこい --Super Koi Koi local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_FLOWER_CARDIAN} function s.filter(c,e,tp) return c:IsSetCard(SET_FLOWER_CARDIAN) 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 return not Duel.IsPlayerAffectedByEffect(tp,30459350) and 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,0,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.IsPlayerAffectedByEffect(tp,30459350) then return end Duel.ConfirmDecktop(tp,3) local g=Duel.GetDecktopGroup(tp,3) local sg=g:Filter(s.filter,nil,e,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end if #g>0 then Duel.DisableShuffleCheck() if #sg>0 and ft>0 then if #sg>ft then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) sg=sg:Select(tp,ft,ft,nil) end g:Sub(sg) local tc=sg:GetFirst() for tc in aux.Next(sg) do if Duel.SpecialSummonStep(tc,0,tp,tp,true,false,POS_FACEUP) then if tc:HasLevel() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(2) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e3) end end Duel.SpecialSummonComplete() end Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT) local og=Duel.GetOperatedGroup() local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_REMOVED) if ct>0 then Duel.SetLP(tp,Duel.GetLP(tp)-ct*1000) end end end function s.cfilter(c,ft,tp) return ft>0 or (c:GetSequence()<5 and c:IsControler(tp)) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return ft>-1 and e:GetHandler():IsAbleToRemoveAsCost() and Duel.CheckReleaseGroup(tp,s.cfilter,1,nil,ft,tp) end Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_COST) local g=Duel.SelectReleaseGroup(tp,s.cfilter,1,1,nil,ft,tp) Duel.Release(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.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.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When an attack is declared involving your "@Ignister" monster: You can Special Summon this card from your hand, and if you do, negate that attack. While you control a Link-6 monster (Quick Effect): You can banish this card from your field or GY, then target 1 face-up card your opponent controls; negate its effects until the end of this turn. You can only use each effect of "Danmari @Ignister" once per turn.
--ダンマリ@イグニスター --Danmari @Ignister --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.negcon) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Negate effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DISABLE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_GRAVE|LOCATION_MZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.negcon2) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.negtg2) e2:SetOperation(s.negop2) c:RegisterEffect(e2) end s.listed_series={SET_IGNISTER} function s.negcon(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local at=Duel.GetAttackTarget() return a:IsControler(tp) and a:IsSetCard(SET_IGNISTER) or at and at:IsControler(tp) and at:IsFaceup() and at:IsSetCard(SET_IGNISTER) end function s.negtg(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.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then Duel.NegateAttack() end end function s.negcon2(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsLink,6),tp,LOCATION_MZONE,0,1,nil) end function s.negtg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsNegatable() end if chk==0 then return Duel.IsExistingTarget(Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_NEGATE) Duel.SelectTarget(tp,Card.IsNegatable,tp,0,LOCATION_ONFIELD,1,1,nil) end function s.negop2(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and not tc:IsDisabled() then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2) if tc:IsType(TYPE_TRAPMONSTER) then local e3=e1:Clone() e3:SetCode(EFFECT_DISABLE_TRAPMONSTER) tc:RegisterEffect(e3) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Place this card on top of the Deck. If this card is sent from the Deck to the Graveyard by a "Lightsworn" monster's effect: You can add 1 "Judgment Dragon" from your Deck to your hand.
--ライトロードの裁き --Lightsworn Judgment local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_LIGHTSWORN} s.listed_names={57774843} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToDeck() end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then c:CancelToGrave() Duel.SendtoDeck(c,nil,SEQ_DECKTOP,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_DECK) and re:IsMonsterEffect() and re:GetHandler():IsSetCard(SET_LIGHTSWORN) and (r&REASON_EFFECT)~=0 end function s.thfilter(c) return c:IsCode(57774843) 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) local tc=Duel.GetFirstMatchingCard(s.thfilter,tp,LOCATION_DECK,0,nil) if tc then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is flipped face-up: Special Summon 2 "Mecha Phantom Beast Tokens" (Machine-Type/WIND/Level 3/ATK 0/DEF 0). This card's Level is increased by the total Levels of all "Mecha Phantom Beast Tokens" you control. While you control a Token, this card cannot be destroyed by battle or card effects. You can Tribute 1 Token, then target 1 "Mecha Phantom Beast" monster in your Graveyard; Special Summon that target. You can only use this effect of "Mecha Phantom Beast Hamstrat" once per turn.
--幻獣機ハムストラット --Mecha Phantom Beast Hamstrat local s,id=GetID() function s.initial_effect(c) --Gains the levels of all "Mecha Phantom Beast Token" local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(s.lvval) c:RegisterEffect(e1) --Cannot be destroyed by battle or effects while you control a Token local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e2:SetCondition(s.indcon) e2:SetValue(1) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e3) --Special Summon 2 "Mecha Phantom Beast Token" local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_FLIP) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) --Special Summon 1 "Mecha Phantom Beast" monster from the GY local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) e5:SetProperty(EFFECT_FLAG_CARD_TARGET) e5:SetCountLimit(1,id) e5:SetCost(s.spcost2) e5:SetTarget(s.sptg2) e5:SetOperation(s.spop2) c:RegisterEffect(e5) end s.listed_series={SET_MECHA_PHANTOM_BEAST} s.listed_names={TOKEN_MECHA_PHANTOM_BEAST} function s.lvval(e,c) return Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCode,TOKEN_MECHA_PHANTOM_BEAST),c:GetControler(),LOCATION_MZONE,0,nil):GetSum(Card.GetLevel) end function s.tknfilter(c) return c:IsType(TYPE_TOKEN) or c:IsOriginalType(TYPE_TOKEN) end function s.indcon(e) return Duel.IsExistingMatchingCard(s.tknfilter,e:GetHandlerPlayer(),LOCATION_ONFIELD,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,2,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and Duel.IsPlayerCanSpecialSummonMonster(tp,TOKEN_MECHA_PHANTOM_BEAST,SET_MECHA_PHANTOM_BEAST,TYPES_TOKEN,0,0,3,RACE_MACHINE,ATTRIBUTE_WIND) then local token1=Duel.CreateToken(tp,TOKEN_MECHA_PHANTOM_BEAST) Duel.SpecialSummonStep(token1,0,tp,tp,false,false,POS_FACEUP) local token2=Duel.CreateToken(tp,TOKEN_MECHA_PHANTOM_BEAST) Duel.SpecialSummonStep(token2,0,tp,tp,false,false,POS_FACEUP) Duel.SpecialSummonComplete() end end function s.cfilter(c,tp) return c:IsType(TYPE_TOKEN) and Duel.GetMZoneCount(tp,c)>0 end function s.spcost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MECHA_PHANTOM_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, after resolving a Spell Card that was activated during your opponent's Main Phase: You can target 1 Level 4 DARK monster in your Graveyard; Special Summon that target. This card must be face-up on the field to activate and to resolve this effect.
--ダーク・ホルス・ドラゴン --Dark Horus local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() and re:IsSpellEffect() and re:IsHasType(EFFECT_TYPE_ACTIVATE) end function s.filter(c,e,tp) return c:GetLevel()==4 and c:IsAttribute(ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() 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 e:GetHandler():IsRelateToEffect(e) and e:GetHandler():IsFaceup() 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:
2 Effect Monsters You can target 1 monster you control this card points to; each time it destroys an opponent's monster by battle this turn, draw 1 card. You can only use this effect of "Trackblack" once per turn.
--トラックブラック --Trackblack --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,2) --Add effect to monsters it points to local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,g) return c:IsFaceup() and g:IsContains(c) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=e:GetHandler():GetLinkedGroup() if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc,g) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,g) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,g) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetCondition(aux.bdocon) e1:SetOperation(s.drop) tc:RegisterEffect(e1) end end function s.drop(e,tp,eg,ep,ev,re,r,rp) Duel.Draw(tp,1,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Cave Dragon" + "Lesser Fiend" (This card is always treated as an "Archfiend" card.) A Fusion Summon of this card can only be done with the above Fusion Material Monsters. Negate the effects of Flip Effect Monsters. Negate any Trap effects that target this card on the field, and if you do, destroy that Trap Card.
--デス・デーモン・ドラゴン --Fiend Skull Dragon local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,false,false,93220472,16475472) --Negate FLIP monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DISABLE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.TargetBoolFunction(Card.IsType,TYPE_FLIP)) c:RegisterEffect(e1) --Negate flip effects local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_CHAIN_SOLVING) e2:SetRange(LOCATION_MZONE) e2:SetOperation(s.disop) c:RegisterEffect(e2) --Summoner of Illusions interaction local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(id) e3:SetRange(LOCATION_MZONE) c:RegisterEffect(e3) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.material_setcode=SET_ARCHFIEND function s.disop(e,tp,eg,ep,ev,re,r,rp) if re:IsActiveType(TYPE_FLIP) then Duel.NegateEffect(ev) end if re:IsTrapEffect() and re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if g and g:IsContains(e:GetHandler()) then Duel.NegateEffect(ev) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's activation and effect cannot be negated. At the start of your Main Phase 1 or 2: Target any number of face-up cards on the field; for each targeted card, banish 1 card from your hand, or 6 cards from your Extra Deck, face-down, then return those targeted cards to the hand.
--械刀婪魔皇断 --Gordian Slicer --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Banish cards from your hand and/or from your Extra Deck face-down and return the targeted cards to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE+EFFECT_FLAG_CANNOT_INACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsMainPhase() and not Duel.CheckPhaseActivity() 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:IsAbleToHand() and chkc:IsFaceup() and chkc~=c end local ct1=Duel.GetMatchingGroupCount(Card.IsAbleToRemove,tp,LOCATION_HAND,0,c,tp,POS_FACEDOWN) local ct2=Duel.GetMatchingGroupCount(Card.IsAbleToRemove,tp,LOCATION_EXTRA,0,nil,tp,POS_FACEDOWN) if chk==0 then return (ct1>=1 or ct2>=6) and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsAbleToHand),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end local ct=ct1+(ct2//6) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsAbleToHand),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,ct,c) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_HAND|LOCATION_EXTRA) end function s.rescon(ct) return function(sg,e,tp,mg) local count=sg:FilterCount(Card.IsLocation,nil,LOCATION_HAND) local remaining=ct-count if remaining<0 then return false,true end local extracnt=sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA) local extra_needed=remaining*6 if extracnt>extra_needed then return false,true end return extracnt==extra_needed,extracnt>extra_needed end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) local ct=#tg if ct==0 then return end local g1=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_HAND,0,nil,tp,POS_FACEDOWN) local g2=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_EXTRA,0,nil,tp,POS_FACEDOWN) if (#g1+#g2//6)<ct then return end local rg=g1+g2 local sg=aux.SelectUnselectGroup(rg,e,tp,1,#rg,s.rescon(ct),1,tp,HINTMSG_REMOVE,s.rescon(ct),s.rescon(ct)) if Duel.Remove(sg,POS_FACEDOWN,REASON_EFFECT)>0 then Duel.BreakEffect() Duel.SendtoHand(tg,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, if your "Destiny HERO" monster battles and this card is in your GY: You can Special Summon this card, and if you do, your monster cannot be destroyed by that battle, also you take no battle damage from that battle. If Summoned this way, banish this card when it leaves the field. You can only use this effect of "Destiny HERO - Dreamer" once per turn.
--D-HERO ドリームガイ --Destiny HERO - Dreamer local s,id=GetID() function s.initial_effect(c) --Special summon itself from GY 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_PRE_DAMAGE_CALCULATE) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_DESTINY_HERO} function s.spcon(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end e:SetLabelObject(tc) return tc and tc:IsControler(tp) and tc:IsSetCard(SET_DESTINY_HERO) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=e:GetLabelObject() if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then if tc:IsRelateToBattle() then --Your monster cannot be destroyed in this battle local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE) tc:RegisterEffect(e1) end --Banish it if it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(3300) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e2:SetReset(RESET_EVENT|RESETS_REDIRECT) e2:SetValue(LOCATION_REMOVED) c:RegisterEffect(e2,true) --Take no battle damage from this battle local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e3:SetTargetRange(1,0) e3:SetReset(RESET_PHASE|PHASE_DAMAGE) Duel.RegisterEffect(e3,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You take no battle damage from attacks involving this card. Once per turn, this card cannot be destroyed by battle.
--マッシブ・ウォリアー --Fortress Warrior local s,id=GetID() function s.initial_effect(c) --battle indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e1:SetCountLimit(1) e1:SetValue(s.valcon) c:RegisterEffect(e1) -- local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) e2:SetValue(1) c:RegisterEffect(e2) end function s.valcon(e,re,r,rp) return (r&REASON_BATTLE)~=0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Battle Phase: Shuffle into the Deck, from your hand, field, or GY, the Fusion Materials that are listed on a "Gladiator Beast" Fusion Monster, then Special Summon that Fusion Monster from your Extra Deck, ignoring its Summoning conditions. You can only activate 1 "Gladiator Beast United" per turn. You cannot declare attacks the turn you activate this card, except with "Gladiator Beast" monsters.
--団結する剣闘獣 --Gladiator Beast United --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Fusion.CreateSummonEff(c,aux.FilterBoolFunction(Card.IsSetCard,SET_GLADIATOR),Card.IsAbleToDeck,s.fextra,Fusion.ShuffleMaterial,nil,nil,nil,0,nil,FUSPROC_NOTFUSION|FUSPROC_LISTEDMATS) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetCost(s.cost) c:RegisterEffect(e1) Duel.AddCustomActivityCounter(id,ACTIVITY_ATTACK,s.counterfilter) end s.listed_series={SET_GLADIATOR} function s.counterfilter(c) return c:IsSetCard(SET_GLADIATOR) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsBattlePhase() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_ATTACK)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ATTACK_ANNOUNCE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_OATH) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.atktg) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,1),nil) end function s.atktg(e,c) return not s.counterfilter(c) end function s.fextra(e,tp,mg) return Duel.GetMatchingGroup(Fusion.IsMonsterFilter(Card.IsAbleToDeck),tp,LOCATION_GRAVE,0,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 "Predaplant" monsters If this card is Fusion Summoned: You can add 1 "Predaplant" monster or 1 "Predap" Spell/Trap from your Deck, GY, or face-up Extra Deck to your hand. You can target 1 monster your opponent controls with a Predator Counter or 1 monster you control; Tribute it, and if you do, Special Summon 1 "Predaplant" monster from your Deck. You can only use each effect of "Predaplant Ambulomelides" once per turn.
--捕食植物アンブロメリドゥス --Predaplant Ambulomelides --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Fusion Summon procedure c:EnableReviveLimit() Fusion.AddProcFunRep(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_PREDAPLANT),2,true) --Search 1 "Predaplant" monster or 1 "Predap" Spell/Trap 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,0}) e1:SetCondition(function(e) return e:GetHandler():IsFusionSummoned() end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special Summon 1 "Predaplant" from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_RELEASE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.counter_list={COUNTER_PREDATOR} s.listed_series={SET_PREDAP,SET_PREDAPLANT} function s.thfilter(c) return c:IsAbleToHand() and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA)) and ((c:IsSetCard(SET_PREDAP) and c:IsSpellTrap()) or (c:IsSetCard(SET_PREDAPLANT) and c:IsMonster())) 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|LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA) 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|LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spcfilter(c,tp) return (c:IsControler(tp) or (c:IsFaceup() and c:GetCounter(COUNTER_PREDATOR)>0)) and c:IsReleasableByEffect() and Duel.GetMZoneCount(tp,c)>0 end function s.spfilter(c,e,tp) return c:IsSetCard(SET_PREDAPLANT) 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_MZONE) and s.spcfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.spcfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) local rg=Duel.SelectTarget(tp,s.spcfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "F.A." monster you control; increase its Level by 2 until the end of this turn. During your Main Phase, except the turn this card was sent to the GY: You can banish this card from your GY, then target 1 "F.A." monster you control; increase its Level by 2 until the end of this turn. You can only use each effect of "F.A. Downforce" once per turn.
--F.A.ダウンフォース --F.A. Downforce local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetHintTiming(TIMINGS_CHECK_MONSTER) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Increase levels from the GY local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCondition(aux.exccon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_FA} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_FA) and c:IsLevelAbove(1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(2) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 monster from your hand or field; add 1 "Azamina" card from your Deck to your hand. If a monster(s) is sent to your opponent's GY, and you control an "Azamina" monster (except during the Damage Step): You can make your opponent lose 1500 LP, and if you do, gain 1500 LP. During the End Phase, if this card is in the GY because it was sent there from the Spell & Trap Zone this turn while face-up: You can Set it. You can only use each effect of "Deception of the Sinful Spoils" once per turn.
--罪宝の欺き --Deception of the Sinful Spoils --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Add 1 "Azamina" card from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Make your opponent lose 1500 LP, and if you do, gain 1500 LP local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_RECOVER) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.lpcon) e2:SetTarget(s.lptg) e2:SetOperation(s.lpop) c:RegisterEffect(e2) --Set this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_LEAVE_GRAVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.setcon) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) end s.listed_series={SET_AZAMINA} function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,true,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,1,1,true,nil,nil) Duel.Release(g,REASON_COST) end function s.thfilter(c) return c:IsSetCard(SET_AZAMINA) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.lpconfilter(c,tp) return c:IsControler(1-tp) and c:IsMonster() 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 Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_AZAMINA),tp,LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,1500) end function s.lpop(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(1-tp,Duel.GetLP(1-tp)-1500) Duel.Recover(tp,1500,REASON_EFFECT) end function s.setcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetTurnID()==Duel.GetTurnCount() and c:IsPreviousLocation(LOCATION_STZONE) and c:IsPreviousPosition(POS_FACEUP) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() then Duel.SSet(tp,c) 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 monster to inflict 600 damage to your opponent. ● While in Defense Position: Once per turn, you can inflict 300 damage to your opponent.
--D・チャッカン --Morphtronic Datatron local s,id=GetID() function s.initial_effect(c) --damagea local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.cona) e1:SetCost(s.costa) e1:SetTarget(s.tga) e1:SetOperation(s.op) c:RegisterEffect(e1) --damaged local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCountLimit(1) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.cond) e2:SetTarget(s.tgd) e2:SetOperation(s.op) c:RegisterEffect(e2) end function s.cona(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsDisabled() and e:GetHandler():IsAttackPos() end function s.cond(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsDisabled() and e:GetHandler():IsDefensePos() end function s.costa(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,aux.TRUE,1,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,aux.TRUE,1,1,false,nil,nil) Duel.Release(g,REASON_COST) end function s.tga(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(600) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,600) end function s.tgd(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(300) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,300) end function s.op(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:
Once per turn: You can discard 1 card, then target 1 Level 7 or higher monster in your Graveyard; add that target to your hand.
--創世の預言者 --Herald of Creation local s,id=GetID() function s.initial_effect(c) --salvage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.filter(c) return c:IsLevelAbove(7) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your opponent controls at least 2 more monsters than you do, you can Special Summon this card (from your hand).
--魔導ギガサイバー --The Fiend Megacyber local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_MZONE,nil)-Duel.GetFieldGroupCount(c:GetControler(),LOCATION_MZONE,0,nil)>=2 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card is activated: Banish 1 face-up "Elemental HERO" monster you control until the End Phase; negate the activation, and if you do, destroy that card. If you control "Elemental HERO Terra Firma": You can banish this card from your GY; Special Summon 1 of your "Elemental HERO" monsters that is banished, or in your hand or GY, ignoring its Summoning conditions. You can only use this effect of "Protection of the Elements" once per turn.
--エレメントの加護 --Protection of the Elements --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_ELEMENTAL_HERO} s.listed_names={74711057} function s.condition(e,tp,eg,ep,ev,re,r,rp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and Duel.IsChainNegatable(ev) end function s.cfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ELEMENTAL_HERO) and c:IsAbleToRemoveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local tc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() if Duel.Remove(tc,POS_FACEUP,REASON_COST+REASON_TEMPORARY)>0 then tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) --Return it in the End Phase local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetLabelObject(tc) e1:SetCountLimit(1) e1:SetCondition(function(e) return e:GetLabelObject():HasFlagEffect(id) end) e1:SetOperation(function(e) Duel.ReturnToField(e:GetLabelObject()) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end 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_DESTROY,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,74711057),tp,LOCATION_ONFIELD,0,1,nil) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_ELEMENTAL_HERO) and (c:IsFaceup() or not c:IsLocation(LOCATION_REMOVED)) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED|LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED|LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_REMOVED|LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a "Flamvell" monster, except "Neo Flamvell Origin", and your opponent has 3 or less cards in their GY, you can Special Summon this card (from your hand).
--ネオフレムベル・オリジン --Neo Flamvell Origin local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetRange(LOCATION_HAND) e1:SetCondition(s.spcon) c:RegisterEffect(e1) end s.listed_series={SET_FLAMVELL} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_FLAMVELL) and c:GetCode()~=id end function s.spcon(e,c) if c==nil then return true end return Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,c:GetControler(),LOCATION_MZONE,0,1,nil) and Duel.GetFieldGroupCount(c:GetControler(),0,LOCATION_GRAVE)<=3 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Appliancer" Link Monster you control; Special Summon as many Link-1 "Appliancer" monsters from your GY as possible to your zones that monster points to, but banish them during the End Phase. You can only activate 1 "Appliancer Test" per turn.
--機塊テスト --Appliancer Test --Anime version scripted by pyrQ, updated by Larry126 local s,id=GetID() function s.initial_effect(c) --Special Summon as many Link-1 "Appliancer" monsters from your GY as possible to your zones 1 "Appliancer" Link Monster you control points to, but banish them during the End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_APPLIANCER} function s.tgfilter(c,e,tp) return c:IsSetCard(SET_APPLIANCER) and c:IsLinkMonster() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetFreeLinkedZone()) end function s.spfilter(c,e,tp,zone) return c:IsLink(1) and c:IsSetCard(SET_APPLIANCER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) 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.tgfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end local zone=tc:GetFreeLinkedZone() local ft=Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone) if not (zone>0 and 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_GRAVE,0,ft,ft,nil,e,tp,zone) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP,zone)>0 then --Banish them during the End Phase aux.DelayedOperation(g,PHASE_END,id,e,tp,function(ag) Duel.Remove(ag,POS_FACEUP,REASON_EFFECT) end,nil,nil,nil,aux.Stringid(id,1)) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Pendulum Monsters, including a "Majespecter" monster If this card is Link Summoned: You can add up to 2 face-up "Majespecter" Pendulum Monsters from your Extra Deck to your hand, then you can add up to 2 "Majespecter" Pendulum Monsters with different names from your Deck to your face-up Extra Deck, also you cannot Special Summon from the Extra Deck for the rest of this turn, except "Majespecter" or "Dracoslayer" monsters. You can only use this effect of "Majespecter Orthrus - Nue" once per turn.
--マジェスペクター・オルト --Majespecter Orthrus - Nue --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --2 Pendulum Monsters, including a "Majespecter" monster Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_PENDULUM),2,2,s.lcheck) --Add 2 "Majespecter" Pendulum Monsters to the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_TOEXTRA) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_series={SET_MAJESPECTER,SET_DRACOSLAYER} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsSetCard,1,nil,SET_MAJESPECTER,lc,sumtype,tp) end function s.thfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MAJESPECTER) and c:IsType(TYPE_PENDULUM) 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_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_EXTRA) Duel.SetPossibleOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_DECK) end function s.tefilter(c) return c:IsSetCard(SET_MAJESPECTER) and c:IsType(TYPE_PENDULUM) and not c:IsForbidden() end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() --Cannot Special Summon from the Extra Deck, except Xyz 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:SetTargetRange(1,0) e1:SetTarget(function(_,c) return not c:IsSetCard({SET_MAJESPECTER,SET_DRACOSLAYER}) and c:IsLocation(LOCATION_EXTRA) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,function(_,c) return not c:IsOriginalSetCard({SET_MAJESPECTER,SET_DRACOSLAYER}) end) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_EXTRA,0,1,2,nil) if #g==0 or Duel.SendtoHand(g,tp,REASON_EFFECT)==0 or #g:Match(Card.IsLocation,nil,LOCATION_HAND)==0 then return end Duel.ConfirmCards(1-tp,g) local dg=Duel.GetMatchingGroup(s.tefilter,tp,LOCATION_DECK,0,nil) if #dg==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end local teg=aux.SelectUnselectGroup(dg,e,tp,1,2,aux.dncheck,1,tp,HINTMSG_CONFIRM) if #teg>0 then Duel.BreakEffect() Duel.SendtoExtraP(teg,tp,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Harpie Lady" while on the field or in the GY. You can only use each of these effects of "Harpie Oracle" once per turn. ● If you control a Level 5 or higher "Harpie" monster: You can Special Summon this card from your hand. ● If this card is Normal or Special Summoned: You can add 1 Spell/Trap from your GY to your hand, that specifically lists the card "Harpie Lady Sisters" in its text, during the End Phase of this turn.
--ハーピィ・オラクル --Harpie Oracle local s,id=GetID() function s.initial_effect(c) --Add to hand 1 "Harpie" Spell/Trap 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:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetOperation(s.regtg) e1:SetOperation(s.regop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Change name to "Harpie Lady" local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_CHANGE_CODE) e3:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e3:SetValue(CARD_HARPIE_LADY) c:RegisterEffect(e3) --Special Summon local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_HAND) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.sscon) e4:SetTarget(s.sstg) e4:SetOperation(s.ssop) c:RegisterEffect(e4) end s.listed_series={SET_HARPIE} s.listed_names={CARD_HARPIE_LADY,CARD_HARPIE_LADY_SISTERS} function s.regtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,0,tp,LOCATION_GRAVE) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetCondition(s.thcon) e1:SetOperation(s.thop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.thfilter(c) return c:ListsCode(CARD_HARPIE_LADY_SISTERS) and c:IsSpellTrap() and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) 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_GRAVE,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.SendtoHand(tc,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,tc) end end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_HARPIE) and c:IsLevelAbove(5) end function s.sscon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.ssop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Insect monsters "Krawler" monsters this card points to cannot be destroyed by battle, gain 300 ATK/DEF, and if they battle your opponent's monster, any battle damage they inflict to your opponent is doubled. If this face-up card is destroyed by battle, or leaves the field because of an opponent's card effect while its owner controls it: You can target 2 "Krawler" monsters with different names in your GY; Special Summon them in face-down Defense Position.
--エクスクローラー・ニューロゴス --X-Krawler Neurogos --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Link Summon procedure: 2 Insect monsters Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_INSECT),2,2) --"Krawler" monsters this card points to cannot be destroyed by battle local e1a=Effect.CreateEffect(c) e1a:SetType(EFFECT_TYPE_FIELD) e1a:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1a:SetRange(LOCATION_MZONE) e1a:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1a:SetTarget(function(e,c) return c:IsSetCard(SET_KRAWLER) and e:GetHandler():GetLinkedGroup():IsContains(c) end) e1a:SetValue(1) c:RegisterEffect(e1a) --Gain 300 ATK/DEF local e1b=e1a:Clone() e1b:SetCode(EFFECT_UPDATE_ATTACK) e1b:SetValue(300) c:RegisterEffect(e1b) local e1c=e1b:Clone() e1c:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e1c) --If they battle your opponent's monster, any battle damage they inflict to your opponent is doubled local e1d=e1a:Clone() e1d:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1d:SetCode(EFFECT_CHANGE_BATTLE_DAMAGE) e1d:SetTarget(s.doubledamtg) e1d:SetValue(aux.ChangeBattleDamage(1,DOUBLE_DAMAGE)) c:RegisterEffect(e1d) --Special Summon 2 "Krawler" monsters with different names from your GY in face-down Defense Position 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:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_series={SET_KRAWLER} function s.doubledamtg(e,c) local bc=c:GetBattleTarget() return c:IsSetCard(SET_KRAWLER) and bc and bc:IsControler(1-e:GetHandlerPlayer()) and e:GetHandler():GetLinkedGroup():IsContains(c) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp))) and c:IsPreviousPosition(POS_FACEUP) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_KRAWLER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and g:GetClassCount(Card.GetCode)>=2 end local tg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SPSUMMON) Duel.SetTargetCard(tg) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 or (#tg>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft>0 and ft<#tg then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) tg=tg:Select(tp,ft,ft,nil) end if #tg>0 and Duel.SpecialSummon(tg,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then Duel.ConfirmCards(1-tp,tg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you take damage from the effect of a monster your opponent controls, inflict the same amount of damage to your opponent.
--ドッペル・ゲイナー --Doppelganger 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) --damage local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCategory(CATEGORY_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EVENT_DAMAGE) e2:SetCondition(s.damcon) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT)~=0 and re:GetHandler():IsLocation(LOCATION_MZONE) and re:GetHandler():IsControler(1-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(ev) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,ev) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 LIGHT Machine Union monster from your Deck to your hand. Once per turn, if a LIGHT Machine Union monster(s) is Normal or Special Summoned to your field (except during the Damage Step): You can target 1 of those monsters; equip 1 appropriate LIGHT Machine Union monster, with a different name, from your Deck to that monster, but the Union monster you equipped cannot be Special Summoned this turn. You can only activate 1 "Union Hangar" per turn.
--ユニオン格納庫 --Union Hangar local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Equip 1 appropriate LIGHT Machine Union monster from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,2)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_CUSTOM+id) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) local g=Group.CreateGroup() g:KeepAlive() e2:SetLabelObject(g) --Equip register local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetRange(LOCATION_FZONE) e3:SetLabelObject(e2) e3:SetOperation(s.regop) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e4) end s.listed_card_types={TYPE_UNION} function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_UNION) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.tgfilter(c,e,tp,chk) return c:IsRace(RACE_MACHINE) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsType(TYPE_UNION) and c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsControler(tp) and c:IsCanBeEffectTarget(e) and (chk or Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_DECK,0,1,nil,c)) end function s.eqfilter(c,ec) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_MACHINE) and c:IsType(TYPE_UNION) and c:CheckUnionTarget(ec) and aux.CheckUnionEquip(c,ec) and not c:IsCode(ec:GetCode()) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local tg=eg:Filter(s.tgfilter,nil,e,tp,false) if #tg>0 then for tc in aux.Next(tg) do tc:RegisterFlagEffect(id,RESET_CHAIN,0,1) end local g=e:GetLabelObject():GetLabelObject() if Duel.GetCurrentChain()==0 then g:Clear() end g:Merge(tg) g:Remove(function(c) return c:GetFlagEffect(id)==0 end,nil) e:GetLabelObject():SetLabelObject(g) if Duel.GetFlagEffect(tp,id)==0 then Duel.RegisterFlagEffect(tp,id,RESET_CHAIN,0,1) Duel.RaiseSingleEvent(e:GetHandler(),EVENT_CUSTOM+id,e,0,tp,tp,0) end end end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local g=e:GetLabelObject():Filter(s.tgfilter,nil,e,tp,false) if chkc then return g:IsContains(chkc) and s.tgfilter(chkc,e,tp,true) end if chk==0 then Duel.ResetFlagEffect(tp,id) for tc in aux.Next(g) do tc:ResetFlagEffect(id) end return #g>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 end if #g==1 then Duel.SetTargetCard(g:GetFirst()) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local tc=g:Select(tp,1,1,nil) Duel.SetTargetCard(tc) end end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_DECK,0,1,1,nil,tc):GetFirst() if ec and Duel.Equip(tp,ec,tc) then aux.SetUnionState(ec) --Cannot be Special Summoned this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,3)) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESETS_STANDARD_PHASE_END) ec:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal Summoned: Look at the top 3 cards of your Deck, you can reveal 1 Ritual Monster or 1 Ritual Spell Card among them and add it to your hand, also after that, place any remaining cards on the top of your Deck in any order.
--リチュア・チェイン --Gishki Chain 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_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsType(TYPE_RITUAL) and c:IsAbleToHand() end function s.operation(e,tp,eg,ep,ev,re,r,rp,chk) if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)<3 then return end local g=Duel.GetDecktopGroup(tp,3) Duel.ConfirmCards(tp,g) if g:IsExists(s.filter,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:FilterSelect(tp,s.filter,1,1,nil) Duel.DisableShuffleCheck() Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) Duel.BreakEffect() Duel.SortDecktop(tp,tp,2) else Duel.SortDecktop(tp,tp,3) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters in your Main Monster Zone: You can Special Summon this card from your hand. (Quick Effect): You can activate 1 of these effects, by revealing monster(s) in your hand with the listed Attribute(s); ● EARTH: This card cannot be destroyed by battle this turn. ● EARTH & FIRE: Destroy all Spells/Traps in this card's column. You can only use each effect of "Vanquish Soul Pantera" once per turn, and cannot activate more than 1 in the same Chain.
--VSパンテラ --Vanquish Soul Pantera --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(function(_,tp) return Duel.GetFieldGroupCount(tp,LOCATION_MMZONE,0)==0 end) e1:SetCost(Cost.HardOncePerChain(id)) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Activate 1 of these effects, by revealing monster(s) in your hand with the listed Attribute(s) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCost(Cost.HardOncePerChain(id)) e2:SetTarget(s.vstg) e2:SetOperation(s.vsop) c:RegisterEffect(e2) 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.vscostfilter(c,att) return c:IsAttribute(att) and not c:IsPublic() end function s.vsrescon(sg) return sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_EARTH)>0 and sg:FilterCount(Card.IsAttribute,nil,ATTRIBUTE_FIRE)>0 end function s.vstg(e,tp,eg,ep,ev,re,r,rp,chk) local cg1=Duel.GetMatchingGroup(s.vscostfilter,tp,LOCATION_HAND,0,nil,ATTRIBUTE_EARTH) local b1=#cg1>0 and (Duel.IsAbleToEnterBP() or Duel.IsBattlePhase()) local cg2=cg1+Duel.GetMatchingGroup(s.vscostfilter,tp,LOCATION_HAND,0,nil,ATTRIBUTE_FIRE) local colg=e:GetHandler():GetColumnGroup():Match(Card.IsSpellTrap,nil) local b2=#colg>0 and aux.SelectUnselectGroup(cg2,e,tp,1,2,s.vsrescon,0) if chk==0 then return b1 or b2 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,2)}, {b2,aux.Stringid(id,3)}) e:SetLabel(op) if op==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=cg1:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) e:SetCategory(0) elseif op==2 then local g=aux.SelectUnselectGroup(cg2,e,tp,1,2,s.vsrescon,1,tp,HINTMSG_CONFIRM,s.vsrescon) Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) e:SetCategory(CATEGORY_DESTROY) Duel.SetOperationInfo(0,CATEGORY_DESTROY,colg,#colg,tp,0) end end function s.vsop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local op=e:GetLabel() if op==1 then --This card cannot be destroyed by battle this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3000) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) elseif op==2 then --Destroy all Spells/Traps in this card's column local colg=c:GetColumnGroup():Match(Card.IsSpellTrap,nil) if c:IsSpellTrap() then colg:AddCard(c) end if #colg>0 then Duel.Destroy(colg,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Effect Monsters You cannot Summon/Set monsters to any Extra Monster Zone this card points to. Gains 200 ATK for each banished card. If another monster is Special Summoned to a zone a Link Monster points to, while this monster is on the field: Banish all cards on the field. Once per turn, during the Standby Phase of the next turn after this card was banished by its own effect: Special Summon this banished card.
--トポロジック・ゼロヴォロス --Topologic Zeroboros --Scripted by AlphaKretin and andré local s,id=GetID() function s.initial_effect(c) --Link summon procedure Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2) c:EnableReviveLimit() --Disable zones local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_FORCE_MZONE) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE) e1:SetTargetRange(1,0) e1:SetValue(s.znval) c:RegisterEffect(e1) --ATK up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(s.atkval) c:RegisterEffect(e2) --Banish all cards on field local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_REMOVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.rmcon) e3:SetTarget(s.rmtg) e3:SetOperation(s.rmop) c:RegisterEffect(e3) --Special summon itself local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e4:SetCode(EVENT_REMOVE) e4:SetOperation(s.spreg) c:RegisterEffect(e4) local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,1)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e5:SetRange(LOCATION_REMOVED) e5:SetCode(EVENT_PHASE|PHASE_STANDBY) e5:SetCondition(s.spcon) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) e5:SetLabelObject(e4) c:RegisterEffect(e5) end function s.znval(e) return ~(e:GetHandler():GetLinkedZone()&ZONES_EMZ) end function s.atkval(e,c) return Duel.GetFieldGroupCount(c:GetControler(),LOCATION_REMOVED,LOCATION_REMOVED)*200 end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) if eg:IsContains(e:GetHandler()) then return false end local g=Duel.GetMatchingGroup(Card.IsType,tp,LOCATION_MZONE,LOCATION_MZONE,nil,TYPE_LINK) for tc in aux.Next(g) do if aux.zptgroupcon(eg,nil,tc) then return true end end return false end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end function s.spreg(e,tp,eg,ep,ev,re,r,rp) if re and re:GetHandler()==e:GetHandler() then e:SetLabel(Duel.GetTurnCount()) e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,2) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and c:GetFlagEffect(id)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) c:ResetFlagEffect(id) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned while you control a "Sunavalon" Link Monster: You can target 1 Level 4 or lower Plant Normal Monster in your GY; Special Summon it. You can banish this card in your GY and 1 Link Monster you control; if you have 2 or more Plant Link Monsters with the same name as each other in your GY, Special Summon 1 of them. You can only use each effect of "Sunseed Twin" once per turn.
--聖種の天双芽 --Sunseed Twin --Scripted by Eerie Code, anime script by Playmaker 772211 and Larry126 local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Level 4 or lower Plant Normal Monster 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_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(s.normalspcon) e1:SetTarget(s.normalsptg) e1:SetOperation(s.normalspop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Special Summon 1 Plant Link Monster from your GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCost(s.linkspcost) e3:SetTarget(s.linksptg) e3:SetOperation(s.linkspop) c:RegisterEffect(e3) end s.listed_series={SET_SUNAVALON} function s.normalspconfilter(c) return c:IsSetCard(SET_SUNAVALON) and c:IsLinkMonster() and c:IsFaceup() end function s.normalspcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.normalspconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.normalspfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_PLANT) and c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.normalsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.normalspfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.normalspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.normalspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.normalspop(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.linkspcostfilter(c,tp) return c:IsLinkMonster() and c:IsAbleToRemoveAsCost() and Duel.GetMZoneCount(tp,c)>0 end function s.linkspcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.linkspcostfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.linkspcostfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.Remove((g+c),POS_FACEUP,REASON_COST) end function s.linkspfilter(c,e,tp) return c:IsRace(RACE_PLANT) and c:IsLinkMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,c,c:GetCode()) end function s.linksptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.linkspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.linkspop(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.linkspfilter,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:
If a face-up "Fire King" monster(s) you control is destroyed by card effect (except during the Damage Step): You can Special Summon this card from your hand. If this card is destroyed and sent to the GY: You can destroy 1 card in your hand or field. You can only use this effect of "Fire King Avatar Yaksha" once per turn.
--炎王獣 ヤクシャ --Fire King Avatar Yaksha local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_DESTROYED) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_FIRE_KING} function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and c:IsSetCard(SET_FIRE_KING) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,nil) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD|LOCATION_HAND,0,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_ONFIELD|LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] During the End Phase: You can add 1 Ritual Spell from your Deck or GY to your hand, then return this card to the hand. You can only use this effect of "Odd-Eyes Pendulumgraph Dragon" once per turn. ---------------------------------------- [ Monster Effect ] You can Ritual Summon this card with "Odd-Eyes Advent". Must be either Ritual Summoned, or Pendulum Summoned from your hand. Each time your opponent Special Summons a monster(s) from the Extra Deck, inflict 300 damage to them. Once per turn, when your opponent activates a Spell Card or effect (Quick Effect): You can place this card in your Pendulum Zone, and if you do, negate that effect, then, if you placed this Ritual Summoned card in the Pendulum Zone, you can Special Summon 1 "Odd-Eyes" monster from your Extra Deck.
--オッドアイズ・ペンデュラムグラフ・ドラゴン --Odd-Eyes Pendulumgraph Dragon --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Revive limit c:EnableUnsummonable() local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_REVIVE_LIMIT) e0:SetCondition(function(e) return not e:GetHandler():IsLocation(LOCATION_HAND) end) c:RegisterEffect(e0) --Special Summon condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(s.splimit) c:RegisterEffect(e1) --Search 1 Ritual Spell from your Deck or GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_PZONE) e2:SetCountLimit(1,id) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Damage when the opponent Special Summons from the Extra Deck local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.damcon) e3:SetOperation(s.damop) c:RegisterEffect(e3) --Negate an opponent's Spell Card or effect local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DISABLE+CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_QUICK_O) e4:SetCode(EVENT_CHAINING) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCondition(s.discon) e4:SetTarget(s.distg) e4:SetOperation(s.disop) c:RegisterEffect(e4) end s.listed_names={16494704} --Odd-Eyes Advent s.listed_series={SET_ODD_EYES} function s.splimit(e,se,sp,st) return (st&SUMMON_TYPE_RITUAL)==SUMMON_TYPE_RITUAL or ((st&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM and e:GetHandler():IsLocation(LOCATION_HAND)) end function s.thfilter(c) return c:IsRitualSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK|LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,2,tp,LOCATION_DECK|LOCATION_GRAVE|LOCATION_PZONE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() 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 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and g:GetFirst():IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,g) Duel.BreakEffect() if Duel.SendtoHand(c,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,c) end end end function s.damfilter(c,tp) return c:IsSummonPlayer(1-tp) and c:IsSummonLocation(LOCATION_EXTRA) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.damfilter,1,nil,tp) end function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Damage(1-tp,300,REASON_EFFECT) end function s.discon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and re:IsSpellEffect() and Duel.IsChainDisablable(ev) end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsType(TYPE_PENDULUM) and Duel.CheckPendulumZones(tp) end Duel.SetOperationInfo(0,CATEGORY_DISABLE,eg,1,0,0) if c:IsRitualSummoned() then Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end end function s.spfilter(c,e,tp,mc) return c:IsSetCard(SET_ODD_EYES) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsImmuneToEffect(e) then return end if not Duel.CheckPendulumZones(tp) then Duel.SendtoGrave(c,REASON_RULE,nil,PLAYER_NONE) else local sg=Group.CreateGroup() if c:IsRitualSummoned() then sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_EXTRA,0,nil,e,tp,c) end if Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) and Duel.NegateEffect(ev) and #sg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=sg:Select(tp,1,1,nil):GetFirst() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If your monster(s) that was originally FIRE is destroyed by battle or card effect: You can Special Summon this card from your GY (if it was there when the monster was destroyed) or hand (even if not). If this card is Normal or Special Summoned: You can destroy 1 FIRE Beast, Beast-Warrior, or Winged Beast monster in your hand, Deck, or face-up field, except "Sacred Fire King Garunix", and if you do, this card gains ATK equal to half the destroyed monster's ATK it had there, until the end of this turn. You can only use each effect of "Sacred Fire King Garunix" once per turn.
--聖炎王 ガルドニクス --Sacred Fire King Garunix --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself if a FIRE monster is destroyed local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e1:SetCode(EVENT_DESTROYED) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Destroy 1 FIRE monster and increase this card's ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end s.listed_names={id} function s.spconfilter(c,tp) return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsOriginalAttribute(ATTRIBUTE_FIRE) and c:IsPreviousControler(tp) and not c:IsPreviousLocation(LOCATION_SZONE) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not (c:IsLocation(LOCATION_GRAVE) and eg:IsContains(c)) 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.desfilter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and (c:IsFaceup() or not c:IsLocation(LOCATION_MZONE)) and not c:IsCode(id) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local tc=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_MZONE,0,1,1,nil):GetFirst() if tc then local atk=tc:GetAttack()//2 local c=e:GetHandler() if Duel.Destroy(tc,REASON_EFFECT)>0 and c:IsFaceup() and c:IsRelateToEffect(e) then c:UpdateAttack(atk,RESETS_STANDARD_DISABLE_PHASE_END) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When you take battle damage while this card is in your Graveyard: Banish it from your Graveyard, then if there is a FIRE monster other than "Volcanic Counter" in your Graveyard, inflict damage to your opponent equal to the amount of battle damage you took.
--ヴォルカニック・カウンター --Volcanic Counter 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_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetRange(LOCATION_GRAVE) 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 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,e:GetHandler(),1,0,0) end function s.filter(c) return c:IsAttribute(ATTRIBUTE_FIRE) and c:GetCode()~=id end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsPlayerAffectedByEffect(e:GetHandlerPlayer(),CARD_SPIRIT_ELIMINATION) and Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT)~=0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) then Duel.Damage(1-tp,ev,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card in your Monster Zone is destroyed by battle or Spell effect and sent to your Graveyard: You can target 1 face-up monster your opponent controls; equip this card to that target. While this card is equipped to a monster by this effect, take control of that monster. When this card leaves the field, destroy the equipped monster.
--グレイドル・アリゲーター --Graydle Alligator local s,id=GetID() function s.initial_effect(c) --equip local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_EQUIP+CATEGORY_LEAVE_GRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.eqcon) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) end function s.eqcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and re and re:IsSpellEffect())) and c:IsReason(REASON_DESTROY) and c:IsPreviousControler(tp) and c:IsPreviousLocation(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 aux.CheckStealEquip(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(aux.CheckStealEquip,tp,0,LOCATION_MZONE,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,aux.CheckStealEquip,tp,0,LOCATION_MZONE,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_EQUIP,e:GetHandler(),1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function s.eqlimit(e,c) return c==e:GetLabelObject() 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 and aux.CheckStealEquip(tc,e,tp) and Duel.Equip(tp,c,tc,true) then --Add Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(s.eqlimit) e1:SetLabelObject(tc) c:RegisterEffect(e1) --control local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_SET_CONTROL) e2:SetValue(tp) e2:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e2) --Destroy local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_LEAVE_FIELD_P) e3:SetOperation(s.checkop) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e4:SetCode(EVENT_LEAVE_FIELD) e4:SetOperation(s.desop) e4:SetReset(RESET_EVENT|RESET_OVERLAY|RESET_TOFIELD) e4:SetLabelObject(e3) c:RegisterEffect(e4) end end function s.checkop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsDisabled() then e:SetLabel(1) else e:SetLabel(0) end end function s.desop(e,tp,eg,ep,ev,re,r,rp) e:Reset() if e:GetLabelObject():GetLabel()~=0 then return end local tc=e:GetHandler():GetEquipTarget() if tc and tc:IsLocation(LOCATION_MZONE) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card declares an attack: It gains 500 ATK until the end of the Battle Phase.
--ファーニマル・ライオ --Fluffal Leo local s,id=GetID() function s.initial_effect(c) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_BATTLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can target 1 other Plant-Type monster on the field that has a Level; this card's Level becomes that monster's current Level, until the end of this turn.
--コピー・プラント --Copy Plant local s,id=GetID() function s.initial_effect(c) --Change this card's Level local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) end function s.lvfilter(c,lvl) return c:IsFaceup() and c:IsRace(RACE_PLANT) and c:HasLevel() and not c:IsLevel(lvl) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() local lvl=c:GetLevel() if chkc then return chkc~=c and chkc:IsLocation(LOCATION_MZONE) and s.lvfilter(chkc,lvl) end if chk==0 then return lvl>0 and Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,c,lvl) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,c,lvl) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not (c:IsFaceup() and c:IsRelateToEffect(e)) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Change this card's Level local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(tc:GetLevel()) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 card, then declare 1 Attribute, except WATER; Special Summon this card from your hand to either field, then this card becomes that Attribute (until the end of this turn), then if you Special Summoned this card to your opponent's field, you can Special Summon 1 Level 4 or lower Fiend monster with an original Attribute other than the declared one, from your hand or GY to your field, also for the rest of this turn, you cannot Special Summon from the Extra Deck, except Fiend monsters. You can only use this effect of "Dipsea Fiend" once per turn.
--ディプシーデビル --Dipsea Fiend --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand to either field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,c) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD,c) 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)) or (Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp)) end local att=Duel.AnnounceAttribute(tp,1,ATTRIBUTE_ALL&~ATTRIBUTE_WATER) e:SetLabel(att) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spfilter(c,e,tp,attr) return c:IsLevelBelow(4) and c:IsRace(RACE_FIEND) and not c:IsOriginalAttribute(attr) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local attr=e:GetLabel() if c:IsRelateToEffect(e) and attr>0 then local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) local b2=Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) local target_player=op==1 and tp or 1-tp if Duel.SpecialSummon(c,0,tp,target_player,false,false,POS_FACEUP)>0 then Duel.BreakEffect() --This card becomes the declared Attribute until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_ATTRIBUTE) e1:SetValue(attr) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) local g=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,nil,e,tp,attr) if c:IsAttribute(attr) and target_player==1-tp and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end end --Cannot Special Summon from the Extra Deck, except Fiend Monsters local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,4)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e2:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e2:SetTargetRange(1,0) e2:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(RACE_FIEND) end) e2:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e2,tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Draw Phase, if this card is in your Graveyard and you control no monsters, instead of conducting your normal draw: You can Special Summon this card, and if you do, banish it when it leaves the field.
--焔虎 --Flame Tiger local s,id=GetID() function s.initial_effect(c) --Special summon itself from GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_PREDRAW) e1:SetRange(LOCATION_GRAVE) 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 tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetDrawCount(tp)>0 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 e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end local dt=Duel.GetDrawCount(tp) if dt~=0 then _replace_count=0 _replace_max=dt local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_DRAW_COUNT) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_DRAW) e1:SetValue(0) Duel.RegisterEffect(e1,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() _replace_count=_replace_count+1 if _replace_count<=_replace_max and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)~=0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) e1:SetValue(LOCATION_REMOVED) c:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card you control is destroyed by battle or card effect and sent to your Graveyard: You can Special Summon 1 "Yang Zing" monster from your Deck in Defense Position, except "Bi'an, Earth of the Yang Zing". You can only use this effect of "Bi'an, Earth of the Yang Zing" once per turn. Once per turn, during your opponent's Main Phase or Battle Phase, you can: Immediately after this effect resolves, Synchro Summon 1 Synchro Monster, using only "Yang Zing" monsters you control (this is a Quick Effect). A Synchro Monster that used this card as a Synchro Material cannot be destroyed by battle.
--地竜星-ヘイカン --Bi'an, Earth of the Yang Zing 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) --synchro effect local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMING_BATTLE_START|TIMING_BATTLE_END) e2:SetCountLimit(1) e2:SetCondition(s.sccon) e2:SetTarget(s.sctg) e2:SetOperation(s.scop) c:RegisterEffect(e2) --effect gain local e3=Effect.CreateEffect(c) e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_BE_MATERIAL) e3:SetCondition(s.indcon) e3:SetOperation(s.indop) c:RegisterEffect(e3) end s.listed_names={id} s.listed_series={SET_YANG_ZING} function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp) end function s.filter(c,e,tp) return c:IsSetCard(SET_YANG_ZING) and not c:IsCode(id) 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) Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end function s.sccon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) and (Duel.IsMainPhase() or Duel.IsBattlePhase()) end function s.mfilter(c) return c:IsFaceup() and c:IsSetCard(SET_YANG_ZING) end function s.sctg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local mg=Duel.GetMatchingGroup(s.mfilter,tp,LOCATION_MZONE,0,nil) return Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,nil,mg) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.scop(e,tp,eg,ep,ev,re,r,rp) local mg=Duel.GetMatchingGroup(s.mfilter,tp,LOCATION_MZONE,0,nil) local g=Duel.GetMatchingGroup(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,nil,nil,mg) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SynchroSummon(tp,sg:GetFirst(),nil,mg) end end function s.indcon(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO end function s.indop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) 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:
3 Level 4 monsters Once per turn, during either player's turn: You can detach 1 Xyz Material from this card, then target 1 monster your opponent controls; change its battle position. (Flip monsters' effects are not activated.)
--ブリキの大公 --Tin Archduke local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,4,3) c:EnableReviveLimit() --tohand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCountLimit(1) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetRange(LOCATION_MZONE) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end function s.filter(c) return c:IsCanChangePosition() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.op(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,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During the Main Phase: Fusion Summon 1 Fusion Monster from your Extra Deck, using monsters from your hand or field as material, including a "Memento" monster. If a monster(s) in your possession was destroyed by card effect this turn, you can also shuffle "Memento" monsters from your GY into the Deck as material. During your Main Phase: You can banish this card from your GY; destroy 1 monster you control, and if you do, add 1 "Memento" Spell/Trap from your Deck to your hand. You can only use each effect of "Mementotlan Fusion" once per turn.
--冥骸融合-メメント・フュージョン --Mementotlan Fusion --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Fusion Summon 1 Fusion Monster, including 1 "Memento" monster as material local e1=Fusion.CreateSummonEff({handler=c,extrafil=s.fextra,extratg=s.extratg,extraop=s.extraop}) e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetCountLimit(1,id) c:RegisterEffect(e1) --Destroy 1 "Memento" monster you control and search 1 "Memento" Spell/Trap local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Register destruction of monsters aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_DESTROY) ge1:SetOperation(s.checkop) Duel.RegisterEffect(ge1,0) end) end s.listed_series={SET_MEMENTO} function s.checkfilter(c) return (c:IsPreviousLocation(LOCATION_MZONE) or (c:IsMonster() and not c:IsPreviousLocation(LOCATION_ONFIELD))) and c:IsReason(REASON_EFFECT) end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.checkfilter,nil) if #g==0 then return end for p=0,1 do if g:IsExists(Card.IsPreviousControler,1,nil,p) and not Duel.HasFlagEffect(p,id) then Duel.RegisterFlagEffect(p,id,RESET_PHASE|PHASE_END,0,1) end end end function s.extramatfilter(c) return c:IsSetCard(SET_MEMENTO) and c:IsAbleToDeck() end function s.checkmat(tp,sg,fc) return sg:IsExists(Card.IsSetCard,1,nil,SET_MEMENTO) end function s.fextra(e,tp,mg) local sg=nil if Duel.HasFlagEffect(tp,id) then sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.extramatfilter),tp,LOCATION_GRAVE,0,nil) end return sg,s.checkmat end function s.extratg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) end function s.extraop(e,tc,tp,sg) local rg=sg:Filter(Card.IsLocation,nil,LOCATION_GRAVE) if #rg>0 then Duel.HintSelection(rg,true) Duel.SendtoDeck(rg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT|REASON_MATERIAL|REASON_FUSION) sg:RemoveCard(rg) end end function s.thfilter(c) return c:IsSetCard(SET_MEMENTO) and c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,0,nil) if chk==0 then return #g>0 and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,LOCATION_MZONE) 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_DESTROY) local desg=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_MZONE,0,1,1,nil) if Duel.Destroy(desg,REASON_EFFECT)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local hg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #hg>0 then Duel.SendtoHand(hg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,hg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During damage calculation, if your monster battles an opponent's monster with a higher ATK: Pay LP equal to the difference in ATK; your monster gains ATK equal to that difference +300, during damage calculation only.
--プライドの咆哮 --Prideful Roar local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_PRE_DAMAGE_CALCULATE) 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) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end if not tc then return false end local bc=tc:GetBattleTarget() if tc and bc then local dif=bc:GetAttack()-tc:GetAttack() e:SetLabel(dif) return dif>0 else return false end end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,e:GetLabel()) end Duel.PayLPCost(tp,e:GetLabel()) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(1-tp) then tc=Duel.GetAttackTarget() end local bc=tc:GetBattleTarget() local dif=bc:GetAttack()-tc:GetAttack() if dif>0 and tc:IsRelateToBattle() and bc:IsRelateToBattle() and tc:IsFaceup() and bc:IsFaceup() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) e1:SetValue(dif+300) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 10 monsters Once per turn: You can detach 1 material from this card; destroy all Spells/Traps your opponent controls. Your opponent cannot activate Spell/Trap Cards in response to this effect's activation.
--超次元ロボ ギャラクシー・デストロイヤー --Superdimensional Robot Galaxy Destroyer local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,10,3) c:EnableReviveLimit() --damage 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:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_ONFIELD,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetChainLimit(s.climit) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end function s.climit(e,lp,tp) return lp==tp or not e:IsHasType(EFFECT_TYPE_ACTIVATE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during the End Phase: Change the battle positions of all face-up monsters the turn player controls.
--悪夢の迷宮 --Labyrinth of Nightmare 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) --position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,Duel.GetTurnPlayer(),LOCATION_MZONE,0,1,nil) end local g=Duel.GetMatchingGroup(Card.IsFaceup,Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,Duel.GetTurnPlayer(),LOCATION_MZONE,0,nil) Duel.ChangePosition(g,POS_FACEUP_DEFENSE,0,POS_FACEUP_ATTACK,0) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Fusion, Synchro, Xyz, or Link Monster + 1 Spellcaster monster Must first be either Fusion Summoned, or Special Summoned (from your Extra Deck) by sending the correct Fusion Material Monster Cards you control to the GY. Once per turn, when a monster declares an attack: You can target it; negate the attack, and if you do, this card gains ATK equal to that monster's ATK (until the end of this turn), then you can return that monster to the hand.
--精霊コロゾ --Magistus Chorozo --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:AddMustFirstBeFusionSummoned() --Fusion Materials: 1 Fusion, Synchro, Xyz, or Link Monster + 1 Spellcaster monster Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsType,TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ|TYPE_LINK),aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER)) Fusion.AddContactProc(c,function(tp) return Duel.GetMatchingGroup(Card.IsAbleToGraveAsCost,tp,LOCATION_ONFIELD,0,nil) end,function(g) Duel.SendtoGrave(g,REASON_COST|REASON_MATERIAL) end,nil,nil,nil,nil,false) --Negate an attack and make this card gain ATK equal to the attacking monster's until the end of the turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end s.miracle_synchro_fusion=true function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ac=Duel.GetAttacker() if chkc then return chkc==ac end if chk==0 then return ac:IsOnField() and ac:IsCanBeEffectTarget(e) end Duel.SetTargetCard(ac) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,ac,1,tp,0) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetAttacker() if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.NegateAttack() and c:IsRelateToEffect(e) and c:IsFaceup() then local atk=tc:GetAttack() if atk<=0 then return end local prev_atk=c:GetAttack() --This card gains ATK equal to that monster's until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(atk) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) Duel.AdjustInstantly(c) if prev_atk>=c:GetAttack() then return end if tc:IsAbleToHand() and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.SendtoHand(tc,nil,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is sent to the Graveyard because of a card effect or being destroyed by battle: You can add 1 "Archfiend" card from your Deck to your hand, except "Archfiend Heiress". You can only use the effect of "Archfiend Heiress" once per turn.
--トリック・デーモン --Archfiend Heiress local s,id=GetID() function s.initial_effect(c) --spsummon 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_DAMAGE_STEP) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetCode(EVENT_TO_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end s.listed_series={SET_ARCHFIEND} function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_EFFECT) or c:IsReason(REASON_BATTLE) end function s.thfilter(c) return c:IsSetCard(SET_ARCHFIEND) and c:GetCode()~=id and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 8 monsters This card can attack your opponent directly while it has Xyz Material. When this card inflicts battle damage to your opponent: You can target 1 face-up monster your opponent controls; destroy it. Once per turn, during either player's turn, when a Spell/Trap Card, or another monster's effect, is activated: Detach 1 Xyz Material from this card; negate the activation.
--No.23 冥界の霊騎士ランスロット --Number 23: Lancelot, Dark Knight of the Underworld local s,id=GetID() function s.initial_effect(c) --Xyz summon Xyz.AddProcedure(c,nil,8,2) c:EnableReviveLimit() --Direct attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetCondition(s.dacon) c:RegisterEffect(e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_BATTLE_DAMAGE) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Negate local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_NEGATE) e3:SetType(EFFECT_TYPE_QUICK_F) e3:SetCode(EVENT_CHAINING) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.discon) e3:SetCost(Cost.DetachFromSelf(1)) e3:SetTarget(s.distg) e3:SetOperation(s.disop) c:RegisterEffect(e3) aux.DoubleSnareValidity(c,LOCATION_MZONE) end s.xyz_number=23 function s.dacon(e) return e:GetHandler():GetOverlayCount()>0 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp 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 chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.Destroy(tc,REASON_EFFECT) end end function s.discon(e,tp,eg,ep,ev,re,r,rp) return (re:IsHasType(EFFECT_TYPE_ACTIVATE) or re:IsMonsterEffect()) and re:GetHandler()~=e:GetHandler() end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 monster; Special Summon from your Deck, 1 monster with the same original Type, Attribute, Level, and ATK/DEF as the Tributed monster, but with a different original name. If you Tributed a monster Special Summoned from the Extra Deck, you can Special Summon a monster from your Extra Deck instead that meets those same criteria. You can only use this effect of "Nightmell the Dark Bonder" once per turn.
--悪醒師ナイトメルト --Nightmell the Dark Bonder --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spfilter(c,e,tp,cc,sumloc,race,att,lv,atk,def,code) if c:IsLocation(LOCATION_EXTRA) and (sumloc~=LOCATION_EXTRA or Duel.GetLocationCountFromEx(tp,tp,cc,c)<1) then return false end return c:HasLevel() and not c:IsOriginalCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and c:IsOriginalRace(race) and c:IsOriginalAttribute(att) and c:GetOriginalLevel()==lv and c:GetTextAttack()==atk and c:GetTextDefense()==def end function s.getprops(c) return c:GetSummonLocation(),c:GetOriginalRace(),c:GetOriginalAttribute(),c:GetOriginalLevel(),c:GetTextAttack(),c:GetTextDefense(),c:GetOriginalCode() end function s.spcostfilter(c,e,tp) local loc=Duel.GetMZoneCount(tp,c)>0 and LOCATION_DECK|LOCATION_EXTRA or LOCATION_EXTRA return c:HasLevel() and Duel.IsExistingMatchingCard(s.spfilter,tp,loc,0,1,nil,e,tp,c,s.getprops(c)) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.spcostfilter,1,false,nil,nil,e,tp) end local rc=Duel.SelectReleaseGroupCost(tp,s.spcostfilter,1,1,false,nil,nil,e,tp):GetFirst() e:SetLabelObject(rc) Duel.Release(rc,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local rc=e:GetLabelObject() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_EXTRA,0,1,1,nil,e,tp,nil,s.getprops(rc)) 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:
"Zombie World" in the Field Zone cannot be destroyed by card effects, also neither player can target it with card effects. (Quick Effect): You can banish this card from your field or GY; activate 1 "Zombie World" directly from your hand or Deck. You can only use this effect of "Necroworld Banshee" once per turn.
--屍界のバンシー --Necroworld Banshee local s,id=GetID() function s.initial_effect(c) --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_FZONE,LOCATION_FZONE) e1:SetTarget(aux.TargetBoolFunction(Card.IsCode,4064256)) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) c:RegisterEffect(e2) --activate Zombie World local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e3:SetCode(EVENT_FREE_CHAIN) e3:SetCountLimit(1,id) e3:SetCost(Cost.SelfBanish) e3:SetTarget(s.actg) e3:SetOperation(s.acop) c:RegisterEffect(e3) end s.listed_names={4064256} function s.filter(c,tp) return c:IsCode(4064256) and c:GetActivateEffect() and c:GetActivateEffect():IsActivatable(tp,true,true) end function s.actg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,tp) end end function s.acop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,tp):GetFirst() Duel.ActivateFieldSpell(tc,e,tp,eg,ep,ev,re,r,rp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute this card; Special Summon 1 Level 7 or lower "Red-Eyes" monster from your Deck. If this card is in your GY: You can target 1 Level 7 or lower "Red-Eyes" monster in your GY; shuffle it into the Deck, and if you do, add this card to your hand. You can only use 1 "The Black Stone of Legend" effect per turn, and only once that turn.
--伝説の黒石 --The Black Stone of Legend local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --to deck local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_TODECK+CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end s.listed_series={SET_RED_EYES} function s.spfilter(c,e,tp) return c:IsSetCard(SET_RED_EYES) and c:IsLevelBelow(7) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if e:GetHandler():GetSequence()<5 then ft=ft+1 end if chk==0 then return ft>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then 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.tdfilter(c) return c:IsSetCard(SET_RED_EYES) and c:IsLevelBelow(7) and c:IsAbleToDeck() end function s.tdtg(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 e:GetHandler():IsAbleToHand() and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local c=e:GetHandler() if tc and tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) and c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "Meklord" monster you control; your opponent takes no battle damage from attacks involving that face-up monster until the end of this turn, also its ATK becomes (permanently) the combined original ATK of all "Meklord" monsters you currently control. If a "Meklord" monster(s) you control would be destroyed by battle or card effect, you can banish this card from your GY instead. You can only activate 1 "Meklord Deflection" per turn.
--機皇統制 --Meklord Deflection --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destruction replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end s.listed_series={SET_MEKLORD} function s.atkfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_MEKLORD) and (c:GetAttack()~=c:GetBaseAttack() or Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_MEKLORD),tp,LOCATION_MZONE,0,1,c)) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsSetCard(SET_MEKLORD) end if chk==0 then return Duel.IsExistingTarget(s.atkfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectTarget(tp,s.atkfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,tc,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) and tc:IsFaceup() then local atk=0 local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_MEKLORD),tp,LOCATION_MZONE,0,nil) for bc in aux.Next(g) do atk=atk+bc:GetBaseAttack() end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(atk) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_NO_BATTLE_DAMAGE) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_MEKLORD) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT|REASON_BATTLE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 face-up Xyz Monster your opponent controls and 1 face-up Xyz Monster you control; switch control of both monsters.
--エクシーズ・リバーサル --Xyz Reversal local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_CONTROL) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsAbleToChangeControler() 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_MZONE,1,nil) and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g2=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g1=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_CONTROL,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 a=g:GetFirst() local b=g:GetNext() if a:IsRelateToEffect(e) and b:IsRelateToEffect(e) then Duel.SwapControl(a,b) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 2 "Cyber Dragons". Special Summon 1 "Cyber Laser Dragon" from your hand, Deck, or Graveyard.
--フォトン・ジェネレーター・ユニット --Photon Generator Unit local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Cyber Laser Dragon" 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={4162088,CARD_CYBER_DRAGON} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsCode,2,false,aux.ReleaseCheckMMZ,nil,CARD_CYBER_DRAGON) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsCode,2,2,false,aux.ReleaseCheckMMZ,nil,CARD_CYBER_DRAGON) Duel.Release(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCode(4162088) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-2 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP) g:GetFirst():CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card must attack if able. When this face-up Attack Position card is selected as an attack target, change it to Defense Position. When this card is Normal or Special Summoned, select 1 monster on the field, and change its battle position.
--カラクリ参謀 弐四八 --Karakuri Strategist mdl 248 "Nishipachi" 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) --to defense local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e3:SetCode(EVENT_BE_BATTLE_TARGET) e3:SetCondition(s.poscon) e3:SetOperation(s.posop) c:RegisterEffect(e3) --pos local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_POSITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetType(EFFECT_TYPE_TRIGGER_F+EFFECT_TYPE_SINGLE) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetTarget(s.tg) e4:SetOperation(s.op) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e5) end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsAttackPos() end 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) end end function s.filter(c) return c:IsCanChangePosition() end function s.tg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.op(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and 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:
If you control a "Super Quant" monster, except "Super Quantal Fairy Zetan", and this card is in your hand: You can Special Summon this card, then you can make this card's Level the same as 1 "Super Quant" monster you control. You can Tribute this card and send 1 "Super Quant" card from your Deck to the GY, except a DARK monster; Special Summon 1 "Super Quant" monster from your Deck, except "Super Quantal Fairy Zetan". You can only use each effect of "Super Quantal Fairy Zetan" once per turn.
--超量妖精ゼータン --Super Quantal Fairy Zetan --scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card, then you can make its Level become the Level of 1 "Super Quant" monster you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.hspcon) e1:SetTarget(s.hsptg) e1:SetOperation(s.hspop) c:RegisterEffect(e1) --Special Summon 1 "Super Quant" monster from your Deck, except "Super Quantal Fairy Zetan" 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.AND(Cost.SelfTribute,s.dspcost)) e2:SetTarget(s.dsptg) e2:SetOperation(s.dspop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_SUPER_QUANT} function s.hspconfilter(c) return c:IsFaceup() and c:IsSetCard(SET_SUPER_QUANT) and not c:IsCode(id) end function s.hspcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.hspconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.hsptg(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) Duel.SetPossibleOperationInfo(0,CATEGORY_LVCHANGE,c,1,tp,0) end function s.lvfilter(c,lv) return c:IsFaceup() and c:IsSetCard(SET_SUPER_QUANT) and c:HasLevel() and not c:IsLevel(lv) end function s.hspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)==0 then return end local g=Duel.GetMatchingGroup(s.lvfilter,tp,LOCATION_MZONE,0,c,c:GetLevel()) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,2)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local sc=g:Select(tp,1,1,nil):GetFirst() if sc then Duel.HintSelection(sc) Duel.BreakEffect() --This card's Level becomes that monster's local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(sc:GetLevel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.dspcostfilter(c,e,tp) return c:IsSetCard(SET_SUPER_QUANT) and not c:IsAttribute(ATTRIBUTE_DARK) and c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(s.dspfilter,tp,LOCATION_DECK,0,1,c,e,tp) end function s.dspfilter(c,e,tp) return c:IsSetCard(SET_SUPER_QUANT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.dspcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.dspcostfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.dspcostfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) Duel.SendtoGrave(g,REASON_COST) end function s.dsptg(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_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:
If this card is Tribute Summoned: Special Summon 1 "Ice Coffin Token" (Aqua/WATER/Level 1/ATK 1000/DEF 0) in Attack Position to your opponent's field. This Token cannot be Tributed for a Tribute Summon.
--氷結界のロイヤル・ナイト --Royal Knight of the Ice Barrier local s,id=GetID() function s.initial_effect(c) --Special summon 1 token to opponent's field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={66661679} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsTributeSummoned() 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,0) Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,tp,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,1000,0,1,RACE_AQUA,ATTRIBUTE_WATER,POS_FACEUP_ATTACK,1-tp) then local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummonStep(token,0,tp,1-tp,false,false,POS_FACEUP_ATTACK) --Cannot be tributed for a tribute summon local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3304) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UNRELEASABLE_SUM) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) token:RegisterEffect(e1,true) Duel.SpecialSummonComplete() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Special Summon 1 "Aquaactress" monster from your hand.
--アクアアクトレス・グッピー --Aquaactress Guppy local s,id=GetID() function s.initial_effect(c) --spsummon local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_AQUAACTRESS} function s.filter(c,e,tp) return c:IsSetCard(SET_AQUAACTRESS) 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.filter,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.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: You can target 1 "Shaddoll" monster you control; that face-up monster is unaffected by monster effects this turn, except its own. If this card is sent to the GY by card effect: You can target 1 Effect Monster on the field; neither player can activate that target's effects on the field this turn. You can only use 1 "Nehshaddoll Genius" effect per turn, and only once that turn.
--星なる影 ゲニウス --Nehshaddoll Genius --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Targeted "Shaddoll" monster becomes unaffected by monster effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.immtg) e1:SetOperation(s.immop) c:RegisterEffect(e1) --Targeted monster cannot activate its effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end --Lists "Shaddoll" archetype s.listed_series={SET_SHADDOLL} --Check for "Shaddoll" monster function s.immfilter(c) return c:IsSetCard(SET_SHADDOLL) and c:IsFaceup() end --Activation legality function s.immtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.immfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.immfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.immfilter,tp,LOCATION_MZONE,0,1,1,nil) end --Make your "Shaddoll" monster becomes unaffected by monster effects function s.immop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() then --Unaffected by monster effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3101) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.efilter) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end --Unaffected by other monster effects function s.efilter(e,te) return te:IsMonsterEffect() and te:GetOwner()~=e:GetHandler() end --If sent to GY by card effect function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_EFFECT) 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:IsFaceup() and chkc:IsType(TYPE_EFFECT) end if chk==0 then return Duel.IsExistingTarget(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end --Targeted monster cannot activate its effects function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_EFFECT) then --Cannot activate its effects this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3302) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent must play with their hand revealed.
--マインド・オン・エア --Mind on Air local s,id=GetID() function s.initial_effect(c) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_PUBLIC) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,LOCATION_HAND) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Once per turn: You can banish 1 Tuner from your hand, GY, or face-up field, then target 1 card on the field; destroy it. If this Synchro Summoned card is destroyed by card effect and sent to the GY: You can target 1 of your banished Tuners; add it to your hand.
--灼銀の機竜 --Vermillion Dragon Mech local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Destroy 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.descost) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Add 1 of your banished Tuners to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.cfilter(c,tp) return (c:IsLocation(LOCATION_HAND|LOCATION_GRAVE) or c:IsFaceup()) and c:IsType(TYPE_TUNER) and c:IsAbleToRemoveAsCost() and (c:IsLocation(LOCATION_HAND) or aux.SpElimFilter(c,true,true)) and Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c+c:GetEquipGroup()) end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,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.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsSynchroSummoned() end function s.thfilter(c) return c:IsFaceup() and c:IsType(TYPE_TUNER) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_REMOVED) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 banished LIGHT or DARK monster; Special Summon it to your field, but negate its effects, also for the rest of this turn, you cannot Special Summon monsters from the Extra Deck, except LIGHT or DARK Synchro Monsters. If this card is sent to the GY as Synchro Material: You can target cards your opponent controls, up to the number of other monsters used for the Synchro Summon; banish them. You can only use each effect of "Chaos Mirage Dragon" once per turn.
--カオス・ミラージュ・ドラゴン --Chaos Mirage Dragon --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon 1 LIGHT or DARK monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Banish cards from opponent's field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_BE_MATERIAL) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.rmcon) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then --Negate its effects local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetValue(RESET_TURN_SET) tc:RegisterEffect(e2) end Duel.SpecialSummonComplete() --Cannot Special Summon monsters from the Extra Deck, except LIGHT or DARK Synchro monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) Duel.RegisterEffect(e1,tp) --Clock Lizard check aux.addTempLizardCheck(c,tp,s.lizfilter) end function s.splimit(e,c) return c:IsLocation(LOCATION_EXTRA) and not (c:IsType(TYPE_SYNCHRO) and c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK)) end function s.lizfilter(e,c) return not c:IsOriginalType(TYPE_SYNCHRO) or not c:IsAttribute(ATTRIBUTE_LIGHT|ATTRIBUTE_DARK) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and r==REASON_SYNCHRO end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=e:GetHandler():GetReasonCard():GetMaterialCount()-1 if chk==0 then return ct>0 and Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_ONFIELD,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can attack your opponent directly. If this card attacks, it is changed to Defense Position at the end of the Battle Phase. This card's battle position cannot be changed until the end of your next turn, except with a card effect.
--ゴブリン暗殺部隊 --Goblin Black Ops local s,id=GetID() function s.initial_effect(c) --to defense local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_BATTLE) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(s.poscon) e1:SetOperation(s.posop) c:RegisterEffect(e1) --direct local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DIRECT_ATTACK) c:RegisterEffect(e2) end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetAttackedCount()>0 end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsAttackPos() then Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_COPY_INHERIT) e1:SetReset(RESETS_STANDARD_PHASE_END,3) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This monster gets the following effect(s) while there is a monster(s) with the following Attribute(s) on the field: ● WATER: Control of this card cannot switch. ● EARTH: Negate the effect of an Effect Monster that this card destroyed by battle.
--エレメント・ソルジャー --Element Soldier local s,id=GetID() function s.initial_effect(c) --control local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_CHANGE_CONTROL) e1:SetCondition(s.ctlcon) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_BATTLED) e2:SetCondition(s.discon) e2:SetOperation(s.disop) c:RegisterEffect(e2) end function s.filter(c,att) return c:IsFaceup() and c:IsAttribute(att) end function s.ctlcon(e) return Duel.IsExistingMatchingCard(s.filter,0,LOCATION_MZONE,LOCATION_MZONE,1,nil,ATTRIBUTE_WATER) end function s.discon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and bc:IsStatus(STATUS_BATTLE_DESTROYED) and not c:IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,ATTRIBUTE_EARTH) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_EXC_GRAVE) bc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD_EXC_GRAVE) bc:RegisterEffect(e2) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Choose 1 of these effects; apply that effect, but skip your next Battle Phase. ● If your opponent adds a card(s) from their Deck to their hand, except during the Draw Phase: discard 1 random card from their hand, then banish the top 2 cards of their Deck. ● Special Summon 1 "Runick" monster from your Extra Deck to the Extra Monster Zone. You can only activate 1 "Runick Dispelling" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--解呪の神碑 --Runick Dispelling --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon local e1,e2=Effect.CreateMysteruneQPEffect(c,id,CATEGORY_TOGRAVE+CATEGORY_HANDES,s.tgtg,s.tgop,2,EFFECT_FLAG_DELAY,EVENT_TO_HAND) e1:SetCondition(s.tgcon) c:RegisterEffect(e1) c:RegisterEffect(e2) end s.listed_series={SET_RUNICK} function s.tgconfilter(c,tp) return c:IsControler(1-tp) and c:IsPreviousLocation(LOCATION_DECK) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentPhase()~=PHASE_DRAW and eg:IsExists(s.tgconfilter,1,nil,tp) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,1-tp,1) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_HAND) if #g>0 then local sg=g:RandomSelect(1-tp,1) return #sg>0 and Duel.SendtoGrave(sg,REASON_EFFECT|REASON_DISCARD)>0 end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Increase the Life Points of both players by 1000 points.
--恵みの雨 --Rain of Mercy local s,id=GetID() function s.initial_effect(c) --recover local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_RECOVER) e1:SetCode(EVENT_FREE_CHAIN) 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_RECOVER,nil,0,PLAYER_ALL,1000) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Recover(tp,1000,REASON_EFFECT) Duel.Recover(1-tp,1000,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 "Metaphys" card from your hand, and if you do, draw 1 card. Once per turn, if your "Metaphys" card in its owner's possession is banished: Apply this effect depending on whose turn it is. ● Your turn: All monsters on the field lose 500 ATK/DEF, except "Metaphys" monsters. ● Opponent's turn: Change the battle positions of all monsters on the field, except "Metaphys" monsters.
--アシンメタファイズ --Asymmetaphys 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_REMOVE+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCountLimit(1) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) --atk/def local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetCode(EVENT_REMOVE) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1) e3:SetCondition(s.atkcon) e3:SetOperation(s.atkop) c:RegisterEffect(e3) --position local e4=e3:Clone() e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_POSITION) e4:SetCondition(s.poscon) e4:SetTarget(s.postg) e4:SetOperation(s.posop) c:RegisterEffect(e4) end s.listed_series={SET_METAPHYS} function s.drfilter(c) return c:IsSetCard(SET_METAPHYS) and c:IsAbleToRemove() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(s.drfilter,tp,LOCATION_HAND,0,1,nil) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_HAND) 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 p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.drfilter,tp,LOCATION_HAND,0,1,1,nil) if #g>0 and Duel.Remove(g,POS_FACEUP,REASON_EFFECT)>0 then Duel.Draw(p,d,REASON_EFFECT) end end function s.effilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_METAPHYS) and c:IsControler(tp) end function s.effcon(e,tp,eg,ep,ev,re,r,rp) return eg and eg:IsExists(s.effilter,1,nil,tp) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return s.effcon(e,tp,eg,ep,ev,re,r,rp) and Duel.IsTurnPlayer(tp) end function s.atkfilter(c) return c:IsFaceup() and not c:IsSetCard(SET_METAPHYS) end function s.posfilter(c) return c:IsCanChangePosition() and not (c:IsFaceup() and c:IsSetCard(SET_METAPHYS)) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) for tc in aux.Next(g) do 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(-500) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return s.effcon(e,tp,eg,ep,ev,re,r,rp) and Duel.GetTurnPlayer()~=tp end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local sg=Duel.GetMatchingGroup(s.posfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #sg>0 then Duel.ChangePosition(sg,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,POS_FACEUP_ATTACK,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent activates a monster effect while you control this Special Summoned monster (Quick Effect): You can Tribute this card; negate the activation, and if you do, destroy it. If this card is sent from the field to the GY: You can Special Summon 1 Thunder monster from your hand in Defense Position. You can only use each effect of "Thunderclap Monk" once per turn.
--封狼雷坊 --Thunderclap Monk --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Negate activation 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_MZONE) e1:SetCondition(s.condition) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfTribute) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --Special summon thunder monster from hand, optional trigger effect local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and re:IsMonsterEffect() and e:GetHandler():IsSpecialSummoned() and Duel.IsChainNegatable(ev) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) if re:GetHandler():IsDestructable() and re:GetHandler():IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.spfilter(c,e,tp) return c:IsRace(RACE_THUNDER) 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.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_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 Beast-Warrior-Type "Bujin" monster, then target 1 "Bujin" monster with a different name in your Graveyard; Special Summon that target.
--武神逐 --Bujinfidel local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_BUJIN} function s.rfilter(c,e,tp,ft) return c:IsSetCard(SET_BUJIN) and c:IsRace(RACE_BEASTWARRIOR) and (ft>0 or (c:GetSequence()<5 and c:IsControler(tp))) and (c:IsFaceup() or c:IsControler(tp)) and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,c:GetCode(),e,tp) end function s.spfilter(c,code,e,tp) return c:IsSetCard(SET_BUJIN) and not c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) return true end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e:GetLabel(),e,tp) end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then if e:GetLabel()~=1 then return false end e:SetLabel(0) return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.rfilter,1,false,nil,nil,e,tp,ft) end local g=Duel.SelectReleaseGroupCost(tp,s.rfilter,1,1,false,nil,nil,e,tp,ft) local code=g:GetFirst():GetCode() e:SetLabel(code) Duel.Release(g,REASON_COST) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,code,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,1,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with any "Gishki" Ritual Spell Card. Once per turn: You can pay 1000 Life Points; draw 1 card, and if you do, reveal it, then, if it was a "Gishki" monster, shuffle 1 card from the field into the Deck.
--イビリチュア・ジールギガス --Gishki Zielgigas local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --draw local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.PayLP(1000)) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GISHKI} function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.Draw(tp,1,REASON_EFFECT)==0 then return end local tc=Duel.GetOperatedGroup():GetFirst() Duel.ConfirmCards(1-tp,tc) if tc:IsSetCard(SET_GISHKI) and tc:IsMonster() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local dg=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SendtoDeck(dg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end Duel.ShuffleHand(tp) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Apply 1 of these effects, or if you activated this card during the Battle Phase, you can apply any of them, in sequence. ● Add 1 Level 4 or lower FIRE Dragon monster from your Deck to your hand. ● Special Summon 1 FIRE Dragon monster from your hand. You can only activate 1 "Sangen Kaimen" per turn.
--燦幻開門 --Sangen Kaimen --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Apply one of these effects OR both of them local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetHintTiming(0,TIMING_BATTLE_PHASE|TIMING_BATTLE_STEP_END|TIMING_BATTLE_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.thfilter(c) return c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_FIRE) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) if chk==0 then return b1 or b2 end e:SetLabel(Duel.IsBattlePhase() and 1 or 0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) local b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) local bp=e:GetLabel()==1 local op=nil if not bp then op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) end local breakeffect=false if (op and op==1) or (bp and b1 and (not b2 or Duel.SelectYesNo(tp,aux.Stringid(id,3)))) then --Add 1 Level 4 or lower FIRE Dragon monster from your Deck to your hand 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) Duel.ShuffleHand(tp) b2=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end breakeffect=true end if (op and op==2) or (bp and b2 and (not breakeffect or Duel.SelectYesNo(tp,aux.Stringid(id,4)))) then --Special Summon 1 FIRE Dragon monster from your hand 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 if breakeffect then Duel.BreakEffect() end Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) on the field is destroyed by battle or an opponent's card effect: You can Special Summon this card from your hand. If a "T.G." monster(s) you control would be destroyed by battle or card effect, you can banish this card from your field or GY instead. You can only use each effect of "T.G. Metal Skeleton" once per turn.
--TG メタル・スケルトン --T.G. Metal Skeleton local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetRange(LOCATION_HAND) e1:SetCode(EVENT_DESTROYED) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Destruction replacement for a "T.G." monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_GRAVE|LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end s.listed_series={SET_TG} function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_MZONE) and (c:IsReason(REASON_BATTLE) or (c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp)) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.repfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_TG) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) and c:IsReason(REASON_EFFECT|REASON_BATTLE) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsStatus(STATUS_DESTROY_CONFIRMED) and c:IsAbleToRemove() and eg:IsExists(s.repfilter,1,nil,tp) end return Duel.SelectEffectYesNo(tp,c,96) end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Remove(e:GetHandler(),POS_FACEUP,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] If you Pendulum Summon a monster(s): Place this card on either the top or bottom of the Deck. ---------------------------------------- [ Monster Effect ] When you draw this card: You can reveal it; during your Main Phase this turn, you can conduct 1 Pendulum Summon of a monster(s) from your hand in addition to your Pendulum Summon. (You can only gain this effect once per turn.)
--彗聖の将-ワンモア・ザ・ナイト --Moissa Knight, the Comet General --scripted by Naim local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --Place this card on either the top or bottom of the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_PZONE) e1:SetCondition(s.tdcon) e1:SetTarget(s.tdtg) e1:SetOperation(s.tdop) c:RegisterEffect(e1) --During your Main Phase this turn, you can conduct 1 Pendulum Summon of a monster(s) from your hand in addition to your Pendulum Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_DRAW) e2:SetCondition(function(e,tp) return Pendulum.PlayerCanGainAdditionalPendulumSummon(tp,id) end) e2:SetCost(Cost.SelfReveal) e2:SetOperation(function(e,tp) Pendulum.GrantAdditionalPendulumSummon(e:GetHandler(),nil,tp,LOCATION_HAND,aux.Stringid(id,2),aux.Stringid(id,3),id) end) c:RegisterEffect(e2) end function s.tdconfilter(c,tp) return c:IsPendulumSummoned() and c:IsSummonPlayer(tp) end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tdconfilter,1,nil,tp) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsAbleToDeck() then local seq_op=0 if Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 then seq_op=Duel.SelectOption(tp,aux.Stringid(id,4),aux.Stringid(id,5)) end Duel.SendtoDeck(c,nil,seq_op,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase: You can Special Summon 1 monster "Fur Hire" from your hand, except "Bravo, Fighter Fur Hire". If a monster "Fur Hire" is Special Summoned to your field while you control this monster (except during the Damage Step): You can have all monsters "Fur Hire" currently on the field gain 500 ATK/DEF until the end of this turn. You can only use each effect of "Bravo, Fighter Fur Hire" once per turn.
--空牙団の闘士 ブラーヴォ --Bravo, Fighter Fur Hire local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --atk up local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.atkcon) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_FUR_HIRE} function s.spfilter(c,e,tp) return c:IsSetCard(SET_FUR_HIRE) 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.cfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_FUR_HIRE) and c:IsControler(tp) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.cfilter,1,nil,tp) end function s.atkfilter(c) return c:IsFaceup() and c:IsSetCard(SET_FUR_HIRE) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if #tg>0 then local sc=tg:GetFirst() for sc in aux.Next(tg) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(500) sc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) sc:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Change all Effect Monsters on the field to Defense Position. Until the end of this turn, the original DEF of those monsters becomes 0, also their battle positions cannot be changed.
--アヌビスの呪い --Curse of Anubis local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER) e1:SetTarget(s.postg) e1:SetOperation(s.posop) c:RegisterEffect(e1) end function s.filter(c) return c:IsPosition(POS_FACEUP_ATTACK) and c:IsType(TYPE_EFFECT) and c:IsCanChangePosition() end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) Duel.ChangePosition(g,POS_FACEUP_DEFENSE,0,POS_FACEUP_DEFENSE,0) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_BASE_DEFENSE) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION) 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 target 1 WATER monster you control; equip this card from your hand or field to it. An "Icejade" monster equipped with this card can attack while in Defense Position. If it does, apply its DEF for damage calculation. While this card is equipped to a monster: You can target 1 monster your opponent controls with ATK less than or equal to the equipped monster's DEF; Special Summon this card, and if you do, return that targeted monster to the hand. You can only use this effect of "Icejade Creation Kingfisher" once per turn.
--氷水艇キングフィッシャー --Icejade Creation Kingfisher --Scripted by Hatter 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_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) --Attack while in defense position local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_DEFENSE_ATTACK) e2:SetCondition(s.atkcon) e2:SetValue(1) c:RegisterEffect(e2) --Return to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_SZONE) e3:SetCountLimit(1,id) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget() end) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_ICEJADE} function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and c~=chkc and chkc:IsFaceup() and chkc:IsAttribute(ATTRIBUTE_WATER) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WATER),tp,LOCATION_MZONE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsAttribute,ATTRIBUTE_WATER),tp,LOCATION_MZONE,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_EQUIP,c,1,0,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 and tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Equip(tp,c,tc,true) --Equip limit local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_EQUIP_LIMIT) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetValue(function(e,c)return c==e:GetLabelObject()end) e1:SetLabelObject(tc) c:RegisterEffect(e1) else Duel.SendtoGrave(c,REASON_RULE) end end function s.atkcon(e) return e:GetHandler():GetEquipTarget():IsSetCard(SET_ICEJADE) end function s.thfilter(c,def) return c:IsFaceup() and c:IsAttackBelow(def) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local def=c:GetEquipTarget():GetDefense() if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_MZONE) and s.thfilter(chkc,def) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(s.thfilter,tp,0,LOCATION_MZONE,1,nil,def) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,0,LOCATION_MZONE,1,1,nil,def) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local def=c:GetEquipTarget():GetDefense() local tc=Duel.GetFirstTarget() if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and tc and tc:IsFaceup() and tc:IsControler(1-tp) and tc:IsRelateToEffect(e) and tc:IsAttackBelow(def) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end