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:
You can discard 1 card, then target 1 card on the field; roll a six-sided die, and destroy that target unless you roll a 1 or 6.
--スナイプストーカー --Snipe Hunter local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DICE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.roll_dice=true function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then local d=Duel.TossDice(tp,1) if d~=1 and d~=6 then Duel.Destroy(tc,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 Level 4 or lower monster in your GY; Special Summon that target. Increase its Level by 1 and ATK/DEF by 100. When that monster is destroyed, destroy this card.
--強化蘇生 --Powerful Rebirth local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCondition(s.descon) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.filter(c,e,tp) return c:IsLevelBelow(4) 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.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if c:IsRelateToEffect(e) and tc:IsRelateToEffect(e) and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then c:SetCardTarget(tc) Duel.SpecialSummonComplete() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(100) e1:SetReset(RESET_EVENT|RESETS_STANDARD) e1:SetCondition(s.rcon) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EFFECT_UPDATE_LEVEL) e3:SetValue(1) tc:RegisterEffect(e3) end end function s.rcon(e) return e:GetOwner():IsHasCardTarget(e:GetHandler()) and not e:GetHandler():IsImmuneToEffect(e) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetHandler():GetFirstCardTarget() return tc and eg:IsContains(tc) and tc:IsReason(REASON_DESTROY) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1 or more non-Tuner Synchro Monsters When this card declares an attack on an opponent's monster: This card gains 400 ATK for each EARTH Warrior-Type Synchro Monster you control, until the end of the Damage Step. When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can activate 1 of these effects; ● Special Summon that monster to your side of the field. ● Take control of 1 face-up monster your opponent controls.
--ゴヨウ・キング --Goyo King local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsType,TYPE_SYNCHRO),1,99) c:EnableReviveLimit() --atk up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.atkcon) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCondition(aux.bdogcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.synchro_nt_required=1 function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttackTarget()~=nil 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 ct=Duel.GetMatchingGroupCount(s.filter,tp,LOCATION_MZONE,0,nil) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*400) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE|RESET_PHASE|PHASE_DAMAGE) c:RegisterEffect(e1) end end function s.filter(c) return c:IsFaceup() and c:IsRace(RACE_WARRIOR) and c:IsAttribute(ATTRIBUTE_EARTH) and c:IsType(TYPE_SYNCHRO) end function s.ctfilter(c) return c:IsFaceup() and c:IsControlerCanBeChanged() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() local b1=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and bc:IsCanBeSpecialSummoned(e,0,tp,false,false) local b2=Duel.IsExistingMatchingCard(s.ctfilter,tp,0,LOCATION_MZONE,1,nil) if chk==0 then return b1 or b2 end local op=0 if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(id,1)) else op=Duel.SelectOption(tp,aux.Stringid(id,2))+1 end if op==0 then Duel.SetTargetCard(bc) e:SetCategory(CATEGORY_SPECIAL_SUMMON) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,bc,1,0,0) else e:SetCategory(CATEGORY_CONTROL) end e:SetLabel(op) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 then local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectMatchingCard(tp,s.ctfilter,tp,0,LOCATION_MZONE,1,1,nil) local tc=g:GetFirst() if tc then Duel.GetControl(tc,tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can either: Target 1 face-up "Vylon" monster you control; equip this card to that target, OR: Unequip this card and Special Summon it in face-up Attack Position. While equipped by this effect, if the equipped monster destroys an opponent's monster by battle: You can target 1 Level 4 or lower "Vylon" monster in your Graveyard; Special Summon that target. (A monster can only be equipped with 1 Union Monster at a time. If the equipped monster would be destroyed, destroy this card instead.)
--ヴァイロン・テセラクト --Vylon Tesseract local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsSetCard,SET_VYLON),true,false) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.gspcon) e1:SetTarget(s.gsptg) e1:SetOperation(s.gspop) c:RegisterEffect(e1) end s.listed_series={SET_VYLON} function s.gspcon(e,tp,eg,ep,ev,re,r,rp) return aux.IsUnionState(e) and e:GetHandler():GetEquipTarget()==eg:GetFirst() end function s.gfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsSetCard(SET_VYLON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.gsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.gfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.gfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.gfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.gspop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"Tearlaments Kitkallos" + 1 "Tearlaments" monster Other Aqua monsters you control cannot be destroyed by battle. You can only use each of the following effects of "Tearlaments Rulkallos" once per turn. When your opponent activates a card or effect that includes an effect that Special Summons a monster(s) (Quick Effect): You can negate the activation, and if you do, destroy it, then, send 1 "Tearlaments" card from your hand or face-up field to the GY. If this Fusion Summoned card is sent to the GY by a card effect: You can Special Summon this card.
--ティアラメンツ・ルルカルス --Tearlaments Rulkallos --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --"Tearalaments Chaetocaros" + 1 "Tearalaments" monster Fusion.AddProcMix(c,true,true,92731385,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_TEARLAMENTS)) --Battle protection local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(function(e,c) return c~=e:GetHandler() and c:IsRace(RACE_AQUA) end) e1:SetValue(1) c:RegisterEffect(e1) --Negate effect activation local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_TOGRAVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.negcon) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Special Summon this card local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_TEARLAMENTS} function s.negcon(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) and Duel.IsChainNegatable(ev) end function s.tgfilter(c) return c:IsSetCard(SET_TEARLAMENTS) and (c:IsFaceup() or c:IsLocation(LOCATION_HAND)) and c:IsAbleToGrave() end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_ONFIELD) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if not (Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re)) or Duel.Destroy(eg,REASON_EFFECT)<1 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) if #g>0 then Duel.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFusionSummoned() and c:IsReason(REASON_EFFECT) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only use each of the following effects of "Therion "Bull" Ain" once per turn. ● You can target 1 "Therion" monster or 1 Warrior monster in your GY; Special Summon this card from your hand, and if you do, equip that monster to this card. ● You can target 1 "Therion" card you control and 1 card your opponent controls; destroy them. A "Therion" monster equipped with this card gains 700 ATK, also it can activate the 2nd effect listed above as if it were "Therion "Bull" Ain".
--セリオンズ“ブルズ”アイン --Therion "Bull" Ain --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) aux.AddEREquipLimit(c,nil,s.eqval,Card.EquipByEffectAndLimitRegister,e1) --Destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Equipped monster gains ATK local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetCondition(function(e) return e:GetHandler():GetEquipTarget():IsSetCard(SET_THERION) end) e3:SetValue(700) c:RegisterEffect(e3) --Equipped monster gains effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e4:SetRange(LOCATION_SZONE) e4:SetTargetRange(LOCATION_MZONE,0) e4:SetTarget(function(e,c) return c==e:GetHandler():GetEquipTarget() and c:IsSetCard(SET_THERION) end) e4:SetLabelObject(e2) c:RegisterEffect(e4) end s.listed_series={SET_THERION} function s.eqfilter(c) return c:IsMonster() and (c:IsSetCard(SET_THERION) or c:IsRace(RACE_WARRIOR)) end function s.eqval(ec,c,tp) return ec:IsControler(tp) and s.eqfilter(ec) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.eqfilter(chkc) and not chkc:IsForbidden() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingTarget(aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectTarget(tp,aux.AND(s.eqfilter,aux.NOT(Card.IsForbidden)),tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,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 c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and tc:IsRelateToEffect(e) and tc:IsMonster() and not tc:IsForbidden() then c:EquipByEffectAndLimitRegister(e,tp,tc) end end function s.desfilter(c,e,tp) return c:IsCanBeEffectTarget(e) and (c:IsControler(1-tp) or (c:IsFaceup() and c:IsSetCard(SET_THERION))) end function s.desrescon(sg,e,tp,mg) return sg:FilterCount(Card.IsControler,nil,tp)==1 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local rg=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil,e,tp) if chk==0 then return aux.SelectUnselectGroup(rg,e,tp,2,2,s.desrescon,0) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) local g=aux.SelectUnselectGroup(rg,e,tp,2,2,s.desrescon,1,tp,HINTMSG_DESTROY) Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters: You can Special Summon 1 "Rose Dragon" monster or 1 Plant monster from your hand. You can only use this effect of "White Rose Cloister" once per turn. During your Draw Phase, before you draw: You can declare 1 card type (Monster, Spell, or Trap); reveal the top card of your Deck, and if it is the declared card type, apply this effect for the rest of this turn (even if this card leaves the field). ● Level 7 or higher Synchro Monsters you control gain 1000 ATK.
--白薔薇の回廊 --White Rose Cloister --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --excavate local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_PREDRAW) e3:SetRange(LOCATION_FZONE) e3:SetCondition(s.condition) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end s.listed_series={SET_ROSE_DRAGON} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.spfilter(c,e,tp) return (c:IsSetCard(SET_ROSE_DRAGON) or c:IsRace(RACE_PLANT)) 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 not e:GetHandler():IsRelateToEffect(e) or 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.condition(e,tp,eg,ep,ev,re,r,rp) return tp==Duel.GetTurnPlayer() and Duel.GetFieldGroupCount(tp,LOCATION_DECK,0)>0 end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CARDTYPE) local op=Duel.SelectOption(tp,70,71,72) if op==0 then e:SetLabel(TYPE_MONSTER) elseif op==1 then e:SetLabel(TYPE_SPELL) else e:SetLabel(TYPE_TRAP) end end function s.operation(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local rc=Duel.GetDecktopGroup(tp,1):GetFirst() if not rc then return end Duel.ConfirmDecktop(tp,1) if rc:IsType(e:GetLabel()) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.atktg) e1:SetValue(1000) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end end function s.atktg(e,c) return c:IsLevelAbove(7) and c:IsType(TYPE_SYNCHRO) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card on the field is destroyed by battle or card effect: You can target 1 monster on the field; it cannot be destroyed by battle this turn. You can only use each of the following effects of "Protecting Spirit Loagaeth" once per turn. If an effect of a Fairy monster you control is activated (except during the Damage Step): You can Special Summon this card from your hand. You can target 1 face-up card your opponent controls and 1 Attack Position monster you control; banish that opponent's card, and if you do, change your monster to Defense Position.
--守護天霊ロガエス --Protecting Spirit Loagaeth --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Apply a "it cannot be destroyed by battle this turn" effect on 1 monster on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_DESTROYED) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) and r&(REASON_BATTLE|REASON_EFFECT)>0 end) e1:SetTarget(s.indestg) e1:SetOperation(s.indesop) 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:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Banish 1 face-up card your opponent controls and change 1 Attack Position monster you control to Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_REMOVE+CATEGORY_POSITION) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.rmtg) e3:SetOperation(s.rmop) c:RegisterEffect(e3) end function s.indestg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingTarget(aux.NOT(Card.IsHasEffect),tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,EFFECT_INDESTRUCTABLE_BATTLE) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO) Duel.SelectTarget(tp,aux.NOT(Card.IsHasEffect),tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,EFFECT_INDESTRUCTABLE_BATTLE) end function s.indesop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --It cannot be destroyed by battle this turn local e1=Effect.CreateEffect(e:GetHandler()) 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) tc:RegisterEffect(e1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local trig_race,trig_loc,trig_ctrl=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_RACE,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_CONTROLER) return trig_race and trig_race&RACE_FAIRY>0 and trig_loc==LOCATION_MZONE and trig_ctrl==tp end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.tgfilter(c,e,tp) return ((c:IsControler(1-tp) and c:IsAbleToRemove() and c:IsFaceup()) or (c:IsControler(tp) and c:IsAttackPos() and c:IsCanChangePosition())) and c:IsCanBeEffectTarget(e) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_MZONE,LOCATION_ONFIELD,nil,e,tp) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dpcheck(Card.GetControler),0) end local tg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dpcheck(Card.GetControler),1,tp,HINTMSG_TARGET) Duel.SetTargetCard(tg) local rmg,posg=tg:Split(Card.IsControler,nil,1-tp) e:SetLabelObject(rmg:GetFirst()) Duel.SetOperationInfo(0,CATEGORY_REMOVE,rmg,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_POSITION,posg,1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 then return end local rm_tc=e:GetLabelObject() if rm_tc:IsRelateToEffect(e) and rm_tc:IsControler(1-tp) and Duel.Remove(rm_tc,POS_FACEUP,REASON_EFFECT)>0 and rm_tc:IsLocation(LOCATION_REMOVED) then local pos_tc=(tg-rm_tc):GetFirst() if pos_tc and pos_tc:IsRelateToEffect(e) and pos_tc:IsControler(tp) then Duel.ChangePosition(pos_tc,POS_FACEUP_DEFENSE) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this face-up card on the field would be destroyed by a card effect, you can pay 500 LP instead. This effect can only be used once while this card is face-up on the field. If this card is destroyed by a card effect and sent to the Graveyard: You can Special Summon 1 "Archfiend" monster from your hand.
--デーモンの巨神 --Archfiend Giant local s,id=GetID() function s.initial_effect(c) --destroy replace local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EFFECT_DESTROY_REPLACE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_NO_TURN_RESET) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.reptg) e1:SetCountLimit(1) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_TO_GRAVE) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end s.listed_series={SET_ARCHFIEND} function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsReason(REASON_EFFECT) and Duel.CheckLPCost(tp,500) end if Duel.SelectEffectYesNo(tp,c,96) then Duel.PayLPCost(tp,500) return true else return false end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return (e:GetHandler():GetReason()&(REASON_DESTROY|REASON_EFFECT))==(REASON_DESTROY|REASON_EFFECT) end function s.filter(c,e,tp) return c:IsSetCard(SET_ARCHFIEND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,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:
2+ Tuners or 1 Tuner Synchro Monster + "Clear Wing Synchro Dragon" Must be Synchro Summoned. Once per turn, when another card, or its effect, is activated (Quick Effect): You can negate the activation, and if you do, destroy that card, and if you destroyed a monster, this card gains ATK equal to that monster's original ATK until the end of this turn. If this face-up Synchro Summoned card in its owner's control leaves the field by an opponent's card: You can Special Summon 1 "Clear Wing" monster from your Extra Deck.
--クリスタルクリアウィング・オーバー・シンクロ・ドラゴン --Crystal Clear Wing Over Synchro Dragon --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 2+ Tuners or 1 Tuner Synchro Monster + "Clear Wing Synchro Dragon" local synchro_proc0=Synchro.AddProcedure(c,nil,2,99,aux.FilterSummonCode(82044279),1,1) local synchro_proc1=Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_SYNCHRO),1,1,aux.FilterSummonCode(82044279),1,1) synchro_proc0:SetDescription(aux.Stringid(id,0)) synchro_proc1:SetDescription(aux.Stringid(id,1)) c:AddMustBeSynchroSummoned() --Negate the activation of another card or effect and destroy it local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Special Summon 1 "Clear Wing" monster from your Extra Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,3)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) --Multiple Tuner check local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_MATERIAL_CHECK) e3:SetValue(s.valcheck) c:RegisterEffect(e3) end s.material={82044279} s.listed_names={82044279} --"Clear Wing Synchro Dragon" s.listed_series={SET_CLEAR_WING} s.synchro_nt_required=1 s.synchro_tuner_required=1 function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) local rc=re:GetHandler() if chk==0 then return rc~=e:GetHandler() end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) if rc:IsRelateToEffect(re) and rc:IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,tp,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) local rc=re:GetHandler() if Duel.NegateActivation(ev) and rc:IsRelateToEffect(re) then local atk=rc:IsMonster() and rc:GetTextAttack() or 0 if atk<0 then atk=0 end local c=e:GetHandler() if Duel.Destroy(rc,REASON_EFFECT)>0 and atk>0 and c:IsRelateToEffect(e) and c:IsFaceup() then --This card gains ATK equal to that monster's original ATK 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) end end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousPosition(POS_FACEUP) and c:IsSynchroSummoned() and c:IsPreviousControler(tp) and rp==1-tp end function s.spfilter(c,e,tp) return c:IsSetCard(SET_CLEAR_WING) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsType,2,nil,TYPE_TUNER) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_MULTIPLE_TUNERS) e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)|RESET_PHASE|PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 "Elemental HERO Bladedge" to target 1 monster your opponent controls; destroy that target and inflict damage to your opponent equal to that target's original ATK.
--エッジ・ハンマー --Edge Hammer local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_names={59793705} function s.cfilter(c) return c:IsCode(59793705) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) local dg=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,0,LOCATION_MZONE,nil,e) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,aux.ReleaseCheckTarget,nil,dg) end local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,aux.ReleaseCheckTarget,nil,dg) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local atk=tc:GetAttack() if Duel.Destroy(tc,REASON_EFFECT)>0 then local dam=tc:GetBaseAttack() Duel.Damage(1-tp,dam,REASON_EFFECT) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) is sent from the hand to the GY, while this card is in your GY (except during the Damage Step): You can Special Summon this card, but place it on the bottom of the Deck when it leaves the field. You can only use this effect of "Vanguard of the Underground Emperor" once per turn.
--地底王の尖兵 --Vanguard of the Underground Emperor --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_TO_GRAVE) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spconfilter(c) return c:IsMonster() and c:IsPreviousLocation(LOCATION_HAND) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.spconfilter,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_GRAVE) 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 --Return to the bottom of the Deck if it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3301) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_DECKBOT) e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Summoned: You can add 1 "Triangle O" from your Deck to your hand, then if this card is in Attack Position, change it to Defense Position. You can only use this effect of "Cabrera Stone" once per turn. If this card is destroyed by battle or card effect: Take 1000 damage.
--カブレラストーン --Cabrera Stone --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Search 1 "Triangle O" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) --Take 2000 damage local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCode(EVENT_DESTROYED) e4:SetCondition(function(e) return e:GetHandler():IsReason(REASON_BATTLE|REASON_EFFECT) end) e4:SetTarget(s.damtg) e4:SetOperation(s.damop) c:RegisterEffect(e4) end s.listed_names={11489642} --Triangle O function s.thfilter(c) return c:IsCode(11489642) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_POSITION,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 g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,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) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsDefensePos() then return end Duel.BreakEffect() Duel.ChangePosition(c,POS_FACEUP_DEFENSE) end end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1000) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,tp,1000) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card can only be Ritual Summoned with the Ritual Spell Card, "Synthesis Spell". When this card inflicts Battle Damage to your opponent, inflict 200 damage to your opponent for each Normal Monster in your Graveyard.
--ライカン・スロープ --Lycanthrope local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_BATTLE_DAMAGE) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end s.listed_names={72446038} function s.damcon(e,tp,eg,ep,ev,re,r,rp) return ep~=tp end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local dam=Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_NORMAL)*200 Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(dam) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local dam=Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_NORMAL)*200 Duel.Damage(p,dam,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] You cannot Pendulum Summon monsters, except "Nekroz" and "Zefra" monsters. This effect cannot be negated. ---------------------------------------- [ Monster Effect ] You can Tribute this card from your hand or face-up from your side of the field; Tribute monsters from your hand or field, then Ritual Summon 1 "Nekroz" Ritual Monster from your hand whose Level exactly equals the total Levels of those monsters. You can only use this effect of "Zefrasaber, Swordmaster of the Nekroz" once per turn.
--剣聖の影霊衣-セフィラセイバー --Zefrasaber, Swordmaster of the Nekroz local s,id=GetID() function s.initial_effect(c) Pendulum.AddProcedure(c) --You cannot Pendulum Summon monsters, except "Nekroz" and "Zefra" monsters, this effect cannot be negated local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_FIELD) e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE) e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e0:SetRange(LOCATION_PZONE) e0:SetTargetRange(1,0) e0:SetTarget(function(e,c,sump,sumtype,sumpos,targetp) return (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM and not c:IsSetCard({SET_NEKROZ,SET_ZEFRA}) end) c:RegisterEffect(e0) local ritual_target_params={handler=c,lvtype=RITPROC_EQUAL,filter=function(ritual_c) return ritual_c:IsSetCard(SET_NEKROZ) and ritual_c~=c end,forcedselection=s.forcedselection} local ritual_operation_params={handler=c,lvtype=RITPROC_EQUAL,filter=function(ritual_c) return ritual_c:IsSetCard(SET_NEKROZ) end} --Tribute monsters from your hand or field, then Ritual Summon 1 "Nekroz" Ritual Monster from your hand whose Level exactly equals the total Levels of those monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RELEASE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.SelfTribute) e1:SetTarget(Ritual.Target(ritual_target_params)) e1:SetOperation(Ritual.Operation(ritual_operation_params)) c:RegisterEffect(e1) end s.listed_series={SET_NEKROZ,SET_ZEFRA} function s.forcedselection(e,tp,g,sc) local c=e:GetHandler() return not g:IsContains(c),g:IsContains(c) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Level 3 or lower Normal Monster you control battles, during the Damage Step you can pay Life Points in multiples of 100. The ATK of the opponent's monster is reduced by the amount of Life Points you paid, until the End Phase. (You cannot pay more Life Points than the ATK of the opponent's monster.)
--窮鼠の進撃 --Attack of the Cornered Rat 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) --atkup local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(TIMING_DAMAGE_STEP) e2:SetRange(LOCATION_SZONE) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetCondition(s.condition) e2:SetCost(s.cost) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local phase=Duel.GetCurrentPhase() if phase~=PHASE_DAMAGE or Duel.IsDamageCalculated() then return false end local a=Duel.GetAttacker() local d=Duel.GetAttackTarget() if not d then return false end if d:IsControler(tp) then a,d=d,a end e:SetLabelObject(d) return a:IsFaceup() and a:IsLevelBelow(3) and a:IsType(TYPE_NORMAL) and a:IsRelateToBattle() and d:IsFaceup() and d:IsRelateToBattle() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then for _,eff in pairs({Duel.IsPlayerAffectedByEffect(tp,EFFECT_LPCOST_CHANGE)}) do local val=eff:GetValue() if (type(val)=='integer' and val==0) or (type(val)=='function' and (val(eff,e,tp,100)~=100)) then return false end end return e:GetHandler():GetFlagEffect(id)==0 and Duel.CheckLPCost(tp,100) and e:GetLabelObject():IsAttackAbove(100) end local lp=Duel.GetLP(tp) local atk=e:GetLabelObject():GetAttack() local t={} for i=1,math.floor(math.min(lp,atk)/100) do t[i]=i*100 end Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local pay=Duel.AnnounceNumber(tp,table.unpack(t)) Duel.PayLPCost(tp,pay) e:SetLabel(-pay) e:GetHandler():RegisterFlagEffect(id,RESET_PHASE|PHASE_DAMAGE,0,1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tc=e:GetLabelObject() if chkc then return chkc==tc end if chk==0 then return tc:IsCanBeEffectTarget(e) end Duel.SetTargetCard(tc) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetFirstTarget() if not e:GetHandler():IsRelateToEffect(e) or not bc or not bc:IsRelateToEffect(e) or not bc:IsControler(1-tp) then return end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetOwnerPlayer(tp) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(e:GetLabel()) bc:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Select 1 monster in your hand and show it to your opponent, then roll a six-sided die. If the result is 1, send the selected monster to the Graveyard. If the result is 2-6, the Level of the selected monster becomes equal to the result until the end of this turn.
--レベル変換実験室 --Level Conversion Lab local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.tg) e1:SetOperation(s.op) c:RegisterEffect(e1) end s.roll_dice=true function s.tg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsMonster,tp,LOCATION_HAND,0,1,nil) end end function s.op(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,Card.IsMonster,tp,LOCATION_HAND,0,1,1,nil) if #g>0 then Duel.ConfirmCards(1-tp,g) local ct=Duel.TossDice(tp,1) if ct==1 then Duel.SendtoGrave(g,REASON_EFFECT) else local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(ct) e1:SetReset(RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TOFIELD)) g:GetFirst():RegisterEffect(e1) Duel.ShuffleHand(tp) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 3 Rock-Type monsters Once per turn, during either player's turn: You can detach 1 Xyz Material from this card, then target 1 face-up monster your opponent controls; its ATK becomes 0, and if it does, its effects are negated. These effects last until the end of this turn. Once per turn: You can target 1 monster on the field with 0 ATK; destroy it.
--ゴルゴニック・ガーディアン --Gorgonic Guardian local s,id=GetID() function s.initial_effect(c) --Xyz summon Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_ROCK),3,2) c:EnableReviveLimit() --Negate effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMINGS_CHECK_MONSTER) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Destroy monster local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.filter(c) return c:IsFaceup() and c:GetAttack()>0 end function s.negtg(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_OPSELECTED,1-tp,e:GetDescription()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectTarget(tp,s.filter,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DISABLE,g,1,0,0) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:GetAttack()>0 then Duel.NegateRelatedChain(tc,RESET_TURN_SET) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE) e2:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_DISABLE_EFFECT) e3:SetValue(RESET_TURN_SET) e3:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e3) end end function s.desfilter(c) return c:IsFaceup() and c:GetAttack()==0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.desfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can banish 1 Trap from your GY; add from your GY to your hand, 1 Trap with a different original name from that banished card. You can only use this effect of "Redeemable Jar" once per turn.
--リターナブル瓶 --Redeemable Jar --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --Add to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_FREE_CHAIN) e2:SetCountLimit(1,id) e2:SetHintTiming(0,TIMING_END_PHASE) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end function s.thfilter(c,code) return c:IsTrap() and not c:IsOriginalCode(code) and c:IsAbleToHand() end function s.rmfilter(c,tp) return c:IsTrap() and c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,c,c:GetOriginalCode()) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_GRAVE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local tg=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp):GetFirst() Duel.Remove(tg,POS_FACEUP,REASON_COST) e:SetLabel(tg:GetOriginalCode()) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,0,LOCATION_GRAVE) end function s.thop(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE,0,1,1,nil,e:GetLabel()) 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:
3 Level 4 monsters Once per turn, you can activate 1 of these effects. ● Detach 3 Xyz Materials from this card; destroy all other face-up monsters on the field. ● Detach 5 Xyz Materials from this card; destroy all cards your opponent controls.
--No.91 サンダー・スパーク・ドラゴン --Number 91: Thunder Spark Dragon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 4 monsters Xyz.AddProcedure(c,nil,4,3) --Activate 1 of these effects 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.Choice( {Cost.DetachFromSelf(3),aux.Stringid(id,1),s.desmonscheck}, {Cost.DetachFromSelf(5),aux.Stringid(id,2),s.desallcheck} )) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.xyz_number=91 function s.desmonscheck(e,tp,eg,ep,ev,re,r,rp,chk) return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end function s.desallcheck(e,tp,eg,ep,ev,re,r,rp,chk) return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>0 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=e:GetLabel()==1 and Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) or Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local exc=c:IsRelateToEffect(e) and c or nil local g=e:GetLabel()==1 and Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,exc) or Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned by its own effect. You can banish "Armed Dragon" monsters from your field and/or GY whose total Levels equal 10; Special Summon this card from your hand, then you can add 1 "White Veil" from your Deck to your hand. You can only use this effect of "Armed Dragon LV10 White" once per turn. You take no effect damage. At the start of the Damage Step, if this card attacks: You can destroy 1 card on the field.
--アームド・ドラゴン LV10-ホワイト --Armed Dragon LV10 White --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Must be Special Summoned via own effect local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) e0:SetValue(0) c:RegisterEffect(e0) --Special Summon by banishing "Armed Dragon" monsters whose total levels equal 10 local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND+CATEGORY_SEARCH) 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) --You take no effect damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(EFFECT_CHANGE_DAMAGE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(1,0) e2:SetValue(s.damval) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_NO_EFFECT_DAMAGE) c:RegisterEffect(e3) --Destroy 1 card on the field if this card attacks local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BATTLE_START) e4:SetCountLimit(1,{id,1}) e4:SetCondition(s.descon) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_names={49306994} --White Veil s.LVnum=10 s.LVset=SET_ARMED_DRAGON function s.rescon(sg,e,tp,mg,c) local sum=sg:GetSum(Card.GetLevel) return aux.ChkfMMZ(1)(sg,nil,tp) and sum==10,sum>10 end function s.cfilter(c) return c:IsAbleToRemoveAsCost() and c:HasLevel() and c:IsSetCard(SET_ARMED_DRAGON) and aux.SpElimFilter(c,true,true) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil) if chk==0 then return aux.SelectUnselectGroup(g,e,tp,1,#g,s.rescon,0) end local rg=aux.SelectUnselectGroup(g,e,tp,1,#g,s.rescon,1,tp,HINTMSG_REMOVE,s.rescon,nil,false) Duel.Remove(rg,POS_FACEUP,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,true,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c) return c:IsCode(49306994) and c:IsAbleToHand() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,true,false,POS_FACEUP)~=0 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then c:CompleteProcedure() Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.damval(e,re,val,r,rp,rc) return (r&REASON_EFFECT)==0 and val or 0 end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetAttacker()==e:GetHandler() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,PLAYER_ALL,LOCATION_ONFIELD) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g,true) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a Level 3 or lower Thunder-Type monster. It gains 800 ATK, also its effects are negated. Each time it inflicts battle damage to your opponent: Draw 1 card.
--エレキャッシュ --Wattjustment local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,s.filter) --Atk up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(800) c:RegisterEffect(e2) --Disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_DISABLE) c:RegisterEffect(e3) --atkup local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,0)) e4:SetCategory(CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e4:SetCode(EVENT_DAMAGE) e4:SetRange(LOCATION_SZONE) e4:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e4:SetCondition(s.drcon) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end function s.filter(c) return c:IsLevelBelow(3) and c:IsRace(RACE_THUNDER) end function s.drcon(e,tp,eg,ep,ev,re,r,rp,chk) return ep~=tp and r==REASON_BATTLE and eg:GetFirst()==e:GetHandler():GetEquipTarget() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true 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:
When a "Marincess" Link Monster you control destroys an opponent's monster by battle: Inflict damage to your opponent equal to the Link Rating of that monster you control x 400, then, if you destroyed an opponent's Link Monster by that battle while you controlled a Link-2 or higher "Marincess" monster, inflict damage to your opponent equal to that destroyed monster's Link Rating x 500. You can only activate 1 "Marincess Current" per turn. If you control a Link-3 or higher "Marincess" monster, you can activate this card from your hand.
--海晶乙女潮流 --Marincess Current --scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Inflict Damage 400x the Link Rating of monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_BATTLE_DESTROYING) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) --Can be activated from the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_TRAP_ACT_IN_HAND) e2:SetCondition(s.actcon) c:RegisterEffect(e2) end s.listed_series={SET_MARINCESS} function s.cfilter(c,tp) return c:IsFaceup() and c:IsSetCard(SET_MARINCESS) and c:IsLinkMonster() and c:IsControler(tp) end function s.damcon(e,tp,eg,ep,ev,re,r,rp) return s.cfilter(eg:GetFirst(),tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:GetFirst():IsRelateToBattle() end Duel.SetTargetPlayer(1-tp) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,eg:GetFirst():GetLink()*400) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ac=eg:GetFirst() Duel.Damage(p,ac:GetLink()*400,REASON_EFFECT) if Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil,tp):IsExists(Card.IsLinkAbove,1,nil,2) and ac:GetBattleTarget():IsLinkMonster() and ac:GetLink()>0 then Duel.BreakEffect() Duel.Damage(p,ac:GetBattleTarget():GetLink()*500,REASON_EFFECT) end end function s.actfilter(c) return c:IsFaceup() and c:IsSetCard(SET_MARINCESS) and c:IsLinkMonster() and c:IsLinkAbove(3) end function s.actcon(e) return Duel.IsExistingMatchingCard(s.actfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
For each Equip Card equipped to this card, it gains 1 additional attack during each Battle Phase.
--重装武者-ベン・ケイ --Armed Samurai - Ben Kei local s,id=GetID() function s.initial_effect(c) --multi attack local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_EXTRA_ATTACK) e1:SetValue(s.val) c:RegisterEffect(e1) end function s.val(e,c) return c:GetEquipCount() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Special Summon this card (from your hand) by detaching 1 material from a monster you control. If Summoned this way, you cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 4 Xyz Monsters. You can only Special Summon "Star Ryzeal" once per turn this way. If this card is Special Summoned: You can Set 1 "Ryzeal" Spell/Trap from your Deck. You can only use this effect of "Star Ryzeal" once per turn.
--スター・ライゼオル --Star Ryzeal --scripted by Naim local s,id=GetID() function s.initial_effect(c) --You can Special Summon this card (from your hand) by detaching 1 material from a monster you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.selfspcon) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Set 1 "Ryzeal" Spell/Trap from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end s.listed_series={SET_RYZEAL} function s.selfspcon(e,c) if c==nil then return true end local tp=e:GetHandlerPlayer() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.CheckRemoveOverlayCard(tp,1,0,1,REASON_COST) end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk,c) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVEXYZ) local g=Duel.GetOverlayGroup(tp,1,0):Select(tp,0,1,nil) if #g>0 then g:KeepAlive() e:SetLabelObject(g) return true end return false end function s.selfspop(e,tp,eg,ep,ev,re,r,rp,c) local g=e:GetLabelObject() if not g then return end local xyzc=g:GetFirst():GetOverlayTarget() Duel.SendtoGrave(g,REASON_COST) Duel.RaiseSingleEvent(xyzc,EVENT_DETACH_MATERIAL,e,0,0,0,0) Duel.RaiseEvent(xyzc,EVENT_DETACH_MATERIAL,e,REASON_EFFECT,tp,tp,0) --You cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 4 Xyz 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_OATH+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) and c:IsRank(4)) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --"Clock Lizard" check aux.addTempLizardCheck(c,tp,function(e,c) return not (c:IsOriginalType(TYPE_XYZ) and c:IsOriginalRank(4)) end) end function s.setfilter(c) return c:IsSetCard(SET_RYZEAL) and c:IsSpellTrap() and c:IsSSetable() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_DECK,0,1,nil) end end function s.setop(e,tp,eg,ep,ev,re,r,rp) 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 Duel.SSet(tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
5 Spellcaster monsters Must be Fusion Summoned. If this card is Fusion Summoned using 5 Spellcaster monsters with different names: You can destroy all cards your opponent controls. This face-up card on the field cannot be Tributed, nor used as Fusion Material, also it cannot be destroyed by card effects.
--クインテット・マジシャン --Quintet Magician --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcFunRep(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_SPELLCASTER),5,true) --spsummon 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(aux.fuslimit) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) 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) --cannot release local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e4:SetRange(LOCATION_MZONE) e4:SetCode(EFFECT_UNRELEASABLE_SUM) e4:SetValue(1) c:RegisterEffect(e4) local e5=e4:Clone() e5:SetCode(EFFECT_UNRELEASABLE_NONSUM) c:RegisterEffect(e5) --cannot be fusion material local e6=e4:Clone() e6:SetCode(EFFECT_CANNOT_BE_FUSION_MATERIAL) c:RegisterEffect(e6) --indes local e7=e4:Clone() e7:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e7) end function s.valcheck(e,c) local g=c:GetMaterial():Filter(Card.IsRace,nil,RACE_SPELLCASTER) if g:GetClassCount(Card.GetCode)==5 then e:GetLabelObject():SetLabel(1) end end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsFusionSummoned() and e:GetLabel()==1 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if chk==0 then return #g>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetFieldGroup(tp,0,LOCATION_ONFIELD) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Spell/Trap Card, or monster effect, that targets exactly 1 "Graydle" monster you control (and no other cards) is activated: Activate 1 of these effects; ● The activated effect becomes "Destroy that monster". ● Negate the activation, and if you do, destroy that card.
--グレイドル・コンバット --Graydle Combat local s,id=GetID() function s.initial_effect(c) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_GRAYDLE} function s.condition(e,tp,eg,ep,ev,re,r,rp) if not (re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) and (re:IsMonsterEffect() or re:IsHasType(EFFECT_TYPE_ACTIVATE))) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) if not g or #g~=1 then return false end local tc=g:GetFirst() e:SetLabelObject(tc) return tc:IsControler(tp) and tc:IsLocation(LOCATION_MZONE) and tc:IsFaceup() and tc:IsSetCard(SET_GRAYDLE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local tc=e:GetLabelObject() local b1=tc:IsLocation(LOCATION_MZONE) local b2=Duel.IsChainNegatable(ev) if chk==0 then return tc and (b1 or b2) end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}) e:SetLabel(op) if op==1 then e:SetCategory(0) else e:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sel=e:GetLabel() if sel==1 then --The activated effect becomes "Destroy that monster" Duel.ChangeChainOperation(ev,s.repop) else --Negate the activation, and if you do, destroy that card if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end end function s.repop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end if e:IsHasType(EFFECT_TYPE_ACTIVATE) then e:GetHandler():CancelToGrave(false) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Tribute Summoned, you can Special Summon "Des Frog"(s) from your hand or Deck up to the number of "T.A.D.P.O.L.E."(s) in your Graveyard.
--デスガエル --Des Frog local s,id=GetID() function s.initial_effect(c) --Special Summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_names={10456559} function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsTributeSummoned() end function s.filter(c,e,tp) return c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,10456559) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local ct=Duel.GetMatchingGroupCount(Card.IsCode,tp,LOCATION_GRAVE,0,nil,10456559) if ft<ct then ct=ft end if ct<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,ct,nil,e,tp) 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 this card in the Monster Zone is Tributed: You can target 1 card on the field; destroy it.
--サイコ・エース --Psychic Ace --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_RELEASE) e1:SetCondition(s.descon) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc~=e:GetHandler() end if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can Special Summon 1 Level 4 or lower Insect monster from your hand. You can banish 1 Level 4 or lower Insect monster from your hand, GY, or face-up field, then target 1 face-up monster you control; increase its Level by the Level of the banished monster, until the end of this turn. You can only use each effect of "Dragonbite" once per turn.
--竜咬蟲 --Dragonbite --Scripted by Zefile local s,id=GetID() function s.initial_effect(c) --Special Summon 1 Level 4 or lower Insect from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,{id,1}) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Increase Level local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,2}) e2:SetCost(s.lvcost) e2:SetTarget(s.lvtg) e2:SetOperation(s.lvop) c:RegisterEffect(e2) end function s.spfilter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_INSECT) 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 (not c:IsOnField() or c:IsFaceup()) and c:IsRace(RACE_INSECT) and c:IsLevelBelow(4) and c:IsAbleToRemoveAsCost() and Duel.IsExistingTarget(aux.AND(Card.IsFaceup,Card.HasLevel),tp,LOCATION_MZONE,0,1,c) and aux.SpElimFilter(c,true,true) end function s.lvcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND|LOCATION_MZONE|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_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) e:SetLabel(g:GetFirst():GetLevel()) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() and chkc:HasLevel() end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,aux.AND(Card.IsFaceup,Card.HasLevel),tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g,1,0,0) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() then --Increase Level local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetValue(e:GetLabel()) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned, unless you control a "Ghostrick" monster. Once per turn: You can change this card to face-down Defense Position. When this card is flipped face-up: You can target 1 "Ghostrick" monster on the field; this turn, it cannot be destroyed by battle or card effects.
--ゴーストリック・イエティ --Ghostrick Yeti local s,id=GetID() function s.initial_effect(c) --Cannot be normal summoned if player controls no "Ghostrick" monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_SUMMON) e1:SetCondition(s.sumcon) c:RegisterEffect(e1) --Change itself to face-down defense position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.postg) e2:SetOperation(s.posop) c:RegisterEffect(e2) --Targeted "Ghostrick" monster cannot be destroyed by battle or card effect local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_REMOVE) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e3:SetCode(EVENT_FLIP) e3:SetTarget(s.indestg) e3:SetOperation(s.indesop) c:RegisterEffect(e3) end s.listed_series={SET_GHOSTRICK} function s.sfilter(c) return c:IsFaceup() and c:IsSetCard(SET_GHOSTRICK) end function s.sumcon(e) return not Duel.IsExistingMatchingCard(s.sfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.posop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end function s.indestg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.sfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.sfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,s.sfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.indesop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Cannot be destroyed by battle or card effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3008) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) tc:RegisterEffect(e2) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Neither player can Special Summon monsters, except DARK monsters.
--深淵の結界像 --Barrier Statue of the Abyss local s,id=GetID() function s.initial_effect(c) --disable spsummon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTargetRange(1,1) e1:SetTarget(s.sumlimit) c:RegisterEffect(e1) end function s.sumlimit(e,c,sump,sumtype,sumpos,targetp) return c:GetAttribute()~=ATTRIBUTE_DARK end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Tribute 1 monster; Special Summon 2 "Heraldic Beast" monsters from your Deck in Defense Position, also you cannot Special Summon monsters from the Extra Deck for the rest of this turn after this card resolves, except Psychic or Machine monsters. You can only activate 1 "Charged-Up Heraldry" per turn.
--顕現する紋章 --Charged-Up Heraldry --scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Special Summon 2 "Heraldic Beast" monsters from your Deck in Defense Position local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_HERALDIC_BEAST} function s.spcheck(sg,tp,exg,dg) return Duel.GetMZoneCount(tp,sg)>=2 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(-100) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,false,s.spcheck,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,s.spcheck,nil) Duel.Release(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_HERALDIC_BEAST) 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 local cost_chk=e:GetLabel()==-100 e:SetLabel(0) return (cost_chk or Duel.GetLocationCount(tp,LOCATION_MZONE,0)>=2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) if #g==2 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end local c=e:GetHandler() --You cannot Special Summon monsters from the Extra Deck for the rest of this turn after this card resolves, except Psychic or Machine 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(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(RACE_PSYCHIC|RACE_MACHINE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) --"Clock Lizard" check aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalRace(RACE_PSYCHIC|RACE_MACHINE) end) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Tribute Summoned by Tributing 2 "Steelswarm" monsters: Activate 1 of these effects. ● Destroy all monsters on the field, except this card. ● Destroy all Spell and Trap Cards on the field.
--インヴェルズ・ガザス --Steelswarm Caucastag local s,id=GetID() function s.initial_effect(c) --summon success local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --tribute check local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_MATERIAL_CHECK) e2:SetValue(s.valcheck) e2:SetLabelObject(e1) c:RegisterEffect(e2) end s.listed_series={SET_STEELSWARM} s.listed_names={62729173} function s.valcheck(e,c) local g=c:GetMaterial() if g:IsExists(Card.IsSetCard,2,nil,SET_STEELSWARM) or g:IsExists(Card.IsCode,1,nil,62729173) then e:GetLabelObject():SetLabel(1) else e:GetLabelObject():SetLabel(0) end end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsTributeSummoned() and e:GetLabel()==1 end function s.sfilter(c) return c:IsSpellTrap() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local op=0 local g1=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) local g2=Duel.GetMatchingGroup(s.sfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) if #g1>0 and #g2>0 then op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 elseif #g1>0 then op=Duel.SelectOption(tp,aux.Stringid(id,1))+1 elseif #g2>0 then op=Duel.SelectOption(tp,aux.Stringid(id,2))+2 end if op==1 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,#g1,0,0) elseif op==2 then Duel.SetOperationInfo(0,CATEGORY_DESTROY,g2,#g2,0,0) end e:SetLabel(op) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==1 then local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) Duel.Destroy(g,REASON_EFFECT) elseif e:GetLabel()==2 then local g=Duel.GetMatchingGroup(s.sfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when an opponent's monster with an A-Counter(s) declares an attack. Destroy all Attack Position monsters your opponent controls.
--細胞爆破ウイルス --Cell Explosion Virus local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.counter_list={COUNTER_A} function s.condition(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() return a:IsControler(1-tp) and a:GetCounter(COUNTER_A)>0 end function s.filter(c) return c:IsAttackPos() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The first time each Ritual Summoned monster would be destroyed by battle each turn, it is not destroyed. If a "Megalith" monster is Special Summoned (except during the Damage Step): You can target 1 Ritual Monster in your GY; add it to your hand. You can only use this effect of "Megalith Portal" once per turn.
--メガリス・ポータル --Megalith Portal 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) --indes local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_INDESTRUCTABLE_COUNT) e2:SetRange(LOCATION_FZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetTarget(aux.TargetBoolFunction(Card.IsSummonType,SUMMON_TYPE_RITUAL)) e2:SetValue(s.indct) c:RegisterEffect(e2) --to hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1,id) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_series={SET_MEGALITH} function s.indct(e,re,r,rp) if (r&REASON_BATTLE)~=0 then return 1 else return 0 end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsSetCard,1,nil,SET_MEGALITH) end function s.thfilter(c) return c:IsRitualMonster() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ monsters, including a Pendulum Monster Gains 100 ATK for each face-up Pendulum Monster in your Extra Deck. The activated effects of Pendulum Monsters this card points to cannot be negated. Once per turn, when your opponent activates a card or effect (Quick Effect): You can Special Summon 1 "Solfachord" card with an odd Pendulum Scale from your Pendulum Zone to your zone this card points to, and if you do, negate the activation, then you can add 1 "Solfachord" Pendulum Monster with an even Pendulum Scale from your Deck to your face-up Extra Deck.
--グランドレミコード・クーリア --GranSolfachord Coolia --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --2+ monsters, including a Pendulum Monster Link.AddProcedure(c,nil,2,3,s.lcheck) --Gains 100 ATK for each face-up Pendulum Monster in the Extra Deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.atkval) c:RegisterEffect(e1) --Activated effects of Pendulum Monsters this card points to cannot be negated local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_DISEFFECT) e2:SetRange(LOCATION_MZONE) e2:SetValue(s.effval) c:RegisterEffect(e2) local e2a=Effect.CreateEffect(c) e2a:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2a:SetCode(EVENT_CHAINING) e2a:SetRange(LOCATION_MZONE) e2a:SetLabelObject(e2) e2a:SetOperation(s.checkop) c:RegisterEffect(e2a) --Special Summon 1 "Solfachord" card with an odd Pendulum Scale local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_NEGATE+CATEGORY_TOEXTRA) e3:SetType(EFFECT_TYPE_QUICK_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e3:SetCode(EVENT_CHAINING) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_series={SET_SOLFACHORD} function s.lcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsType,1,nil,TYPE_PENDULUM,lc,sumtype,tp) end function s.atkval(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsType,TYPE_PENDULUM),e:GetHandlerPlayer(),LOCATION_EXTRA,0,nil)*100 end function s.effval(e,ct) local te=Duel.GetChainInfo(ct,CHAININFO_TRIGGERING_EFFECT) local effs=e:GetLabelObject() return effs and effs[te:GetFieldID()]==e:GetHandler():GetFieldID() end function s.checkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local e2=e:GetLabelObject() if Duel.GetCurrentChain()==1 then e2:SetLabelObject({}) end if re:IsActiveType(TYPE_PENDULUM) and c:GetLinkedGroup():IsContains(re:GetHandler()) then e2:GetLabelObject()[re:GetFieldID()]=c:GetFieldID() end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and rp==1-tp and Duel.IsChainNegatable(ev) end function s.spfilter(c,e,tp,zone) return c:IsSetCard(SET_SOLFACHORD) and c:IsOddScale() 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) if chk==0 then local zone=e:GetHandler():GetLinkedZone(tp) return Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_PZONE,0,1,nil,e,tp,zone) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_PZONE) Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_DECK) end function s.tefilter(c) return c:IsSetCard(SET_SOLFACHORD) and c:IsType(TYPE_PENDULUM) and c:IsEvenScale() and not c:IsForbidden() end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local zone=e:GetHandler():GetLinkedZone(tp) if Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_PZONE,0,1,1,nil,e,tp,zone) if #sg==0 or Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP,zone)==0 or not Duel.NegateActivation(ev) then return end if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:GetHandler():IsRelateToEffect(re) then Duel.SendtoGrave(eg,REASON_EFFECT) end local g=Duel.GetMatchingGroup(s.tefilter,tp,LOCATION_DECK,0,nil) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELECT) local pg=g:Select(tp,1,1,nil) if #pg>0 then Duel.BreakEffect() Duel.SendtoExtraP(pg,tp,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Your opponent cannot target other Spellcaster monsters you control with card effects. (Quick Effect): You can discard 1 Spell, then target 1 face-up card your opponent controls; destroy it. You can only use this effect of "Witchcrafter Haine" once per turn.
--ウィッチクラフト・ハイネ --Witchcrafter Haine --scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Cannot target local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(LOCATION_MZONE,0) e1:SetTarget(s.tgtg) e1:SetValue(aux.tgoval) c:RegisterEffect(e1) --destroy local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetCost(aux.WitchcrafterDiscardCost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end function s.tgtg(e,c) return c:IsRace(RACE_SPELLCASTER) and c~=e:GetHandler() end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can Normal Summon 1 Level 4 LIGHT Thunder-Type monster from your hand, except "Pahunder", as an additional Normal Summon.
--OToサンダー --Pahunder local s,id=GetID() function s.initial_effect(c) --summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c) return c:IsRace(RACE_THUNDER) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:GetLevel()==4 and c:GetCode()~=id and c:IsSummonable(true,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.Summon(tp,tc,true,nil) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Target 1 "HERO" Fusion Monster you control; return it to the Extra Deck, then Special Summon from your Extra Deck, 1 "Masked HERO" monster with the same Level as that monster's original Level, but with a different name. (This Special Summon is treated as a Special Summon with "Mask Change".)
--フォーム・チェンジ --Form Change local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_MASKED_HERO,SET_HERO} function s.spfilter(c,code,lv,e,tp,mc) return c:GetLevel()==lv and c:IsSetCard(SET_MASKED_HERO) and not c:IsCode(code) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.filter(c,e,tp) return c:IsFaceup() and c:IsSetCard(SET_HERO) and c:IsType(TYPE_FUSION) and c:IsAbleToExtra() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,c:GetCode(),c:GetOriginalLevel(),e,tp,c) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local code=tc:GetCode() local lv=tc:GetOriginalLevel() if Duel.SendtoDeck(tc,nil,SEQ_DECKTOP,REASON_EFFECT)==0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,code,lv,e,tp) if #g>0 then Duel.BreakEffect() Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEUP) g:GetFirst():CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card's name becomes "Amazoness Queen" while on the field or in the GY. If this card is Normal or Special Summoned: You can add 1 "Amazoness" Spell/Trap from your Deck to your hand. You can only use this effect of "Amazoness Princess" once per turn. When this card declares an attack: You can send 1 other card from your hand or field to the GY; Special Summon 1 "Amazoness" monster from your Deck in Defense Position, except "Amazoness Princess".
--アマゾネス王女 --Amazoness Princess local s,id=GetID() function s.initial_effect(c) --This card's name becomes "Amazoness Queen" while on the field or in the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) e1:SetValue(15951532) c:RegisterEffect(e1) --Add 1 "Amazoness" Spell/Trap from your Deck to your hand local e2a=Effect.CreateEffect(c) e2a:SetDescription(aux.Stringid(id,0)) e2a:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2a:SetProperty(EFFECT_FLAG_DELAY) e2a:SetCode(EVENT_SUMMON_SUCCESS) e2a:SetCountLimit(1,id) e2a:SetTarget(s.thtg) e2a:SetOperation(s.thop) c:RegisterEffect(e2a) local e2b=e2a:Clone() e2b:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2b) --Special Summon 1 "Amazoness" monster from your Deck in Defense Position, except "Amazoness Princess" local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_ATTACK_ANNOUNCE) e3:SetCost(s.spcost) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={15951532,id} --"Amazoness Queen" s.listed_series={SET_AMAZONESS} function s.thfilter(c) return c:IsSetCard(SET_AMAZONESS) and c:IsSpellTrap() 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.spcostfilter(c,tp) return Duel.GetMZoneCount(tp,c)>0 and c:IsAbleToGraveAsCost() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,c,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,c,tp) Duel.SendtoGrave(g,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_AMAZONESS) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Ultimate Crystal" monster + 7 "Crystal Beast" monsters Must be Special Summoned (from your Extra Deck) during a Duel you Special Summoned an "Ultimate Crystal" monster, by banishing the above monsters from your field and/or GY. While 7 or more of your "Crystal Beast" monsters with different names are banished, this card gains 7000 ATK. If this card has not battled this turn (Quick Effect): You can Tribute this card; shuffle as many cards on the field as possible into the Deck, and if you do, Special Summon any number of your banished "Crystal Beast" monsters.
--究極宝玉神 レインボー・ドラゴン オーバー・ドライブ --Ultimate Crystal Rainbow Dragon Overdrive --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --1 "Ultimate Crystal" Monster + 7 "Crystal Beast" Monsters Fusion.AddProcMixRep(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_CRYSTAL_BEAST),7,7,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_ULTIMATE_CRYSTAL)) Fusion.AddContactProc(c,s.contactfil,s.contactop,s.contactlim,s.contactcon) --Register "Ultimate Crystal" Special Summon aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_SPSUMMON_SUCCESS) ge1:SetOperation(s.regop) Duel.RegisterEffect(ge1,0) end) --Cannot be Special Summoned by other ways local e0=Effect.CreateEffect(c) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e0:SetType(EFFECT_TYPE_SINGLE) e0:SetCode(EFFECT_SPSUMMON_CONDITION) c:RegisterEffect(e0) --Gains 700 ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(s.atkcon) e1:SetValue(7000) c:RegisterEffect(e1) --Shuffle as many cards into the Deck as possible and Special Summon "Crystal Beast" monsters local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E|TIMING_MAIN_END) e2:SetCondition(function(e) return e:GetHandler():GetBattledGroupCount()==0 end) e2:SetCost(Cost.SelfTribute) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end s.listed_series={SET_ULTIMATE_CRYSTAL,SET_CRYSTAL_BEAST} s.material_setcode={SET_ULTIMATE_CRYSTAL,SET_CRYSTAL_BEAST} function s.contactfil(tp) local loc=Duel.IsPlayerAffectedByEffect(tp,CARD_SPIRIT_ELIMINATION) and LOCATION_MZONE or LOCATION_MZONE|LOCATION_GRAVE return Duel.GetMatchingGroup(Card.IsAbleToRemoveAsCost,tp,loc,0,nil) end function s.contactop(g) Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_MATERIAL) end function s.contactlim(e) return e:GetHandler():IsLocation(LOCATION_EXTRA) end function s.contactcon(tp) return Duel.GetFlagEffect(tp,id)>0 end function s.regop(e,tp,eg,ep,ev,re,r,rp) for ec in eg:Iter() do if ec:IsSetCard(SET_ULTIMATE_CRYSTAL) and ec:IsFaceup() then Duel.RegisterFlagEffect(ec:GetSummonPlayer(),id,0,0,0) end end end function s.cbfilter(c) return c:IsFaceup() and c:IsSetCard(SET_CRYSTAL_BEAST) end function s.atkcon(e) return Duel.GetMatchingGroup(s.cbfilter,e:GetHandlerPlayer(),LOCATION_REMOVED,0,nil):GetClassCount(Card.GetCode)>=7 end function s.spfilter(c,e,tp) return s.cbfilter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,c) if chk==0 then return #g>0 and Duel.GetMZoneCount(tp,g+c)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_REMOVED,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_REMOVED) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) if #g<=0 or Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)<=0 then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,ft,nil,e,tp) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ "Marincess" monsters You can send 1 WATER monster from your hand to your GY; add 1 "Marincess" Trap from your Deck to your hand. If only your opponent controls a monster: You can banish this card from your GY; Special Summon WATER Link Monsters from your GY whose combined Link Ratings equal exactly 3. You can only use each effect of "Marincess Coral Triangle" once per turn. You cannot Special Summon monsters the turn you activate either of this card's effects, except WATER monsters.
--海晶乙女コーラルトライアングル --Marincess Coral Triangle --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_MARINCESS),2) --Search 1 "Marincess" Trap local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,{id,0}) e1:SetCost(s.thcost) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) --Special Summon from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) end s.listed_series={SET_MARINCESS} function s.counterfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetTargetRange(1,0) e1:SetTarget(s.splimit) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) return not c:IsAttribute(ATTRIBUTE_WATER) end function s.thcfilter(c) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsMonster() and c:IsAbleToGraveAsCost() end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.IsExistingMatchingCard(s.thcfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.thcfilter,1,1,REASON_COST) s.cost(e,tp,eg,ep,ev,re,r,rp,1) end function s.thfilter(c) return c:IsSetCard(SET_MARINCESS) and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 and Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,0) and aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) end s.cost(e,tp,eg,ep,ev,re,r,rp,1) aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,1) end function s.spfilter(c,e,tp) return c:IsType(TYPE_LINK) and c:IsAttribute(ATTRIBUTE_WATER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.rescon(sg,e,tp,mg) return sg:GetSum(Card.GetLink)==3 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then local tg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,e:GetHandler(),e,tp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) return ft>0 and #tg>0 and aux.SelectUnselectGroup(tg,e,tp,1,ft,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end local tg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp) if #tg<=0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local sg=aux.SelectUnselectGroup(tg,e,tp,1,ft,s.rescon,1,tp,HINTMSG_SPSUMMON,s.rescon) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Your opponent cannot activate any Spell Cards until the end of the End Phase of the next turn.
--ソニックジャマー --Sonic Jammer local s,id=GetID() function s.initial_effect(c) --flip local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetDescription(aux.Stringid(id,1)) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetTargetRange(0,1) e1:SetValue(s.aclimit) e1:SetReset(RESET_PHASE|PHASE_END,2) Duel.RegisterEffect(e1,tp) end function s.aclimit(e,re,tp) return re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You cannot Special Summon from the Extra Deck for the rest of this turn after this card resolves, except "Mikanko" monsters, also send 1 "Mikanko" card from your Deck to the GY, except "Mikanko Divine Dance - Futahashira no Uzu no Miko", then you can Set 1 "Mikanko" Spell/Trap from your Deck, except "Mikanko Divine Dance - Futahashira no Uzu no Miko". You can banish this card from your GY and detach 1 material from a monster you control; Special Summon 1 "Mikanko" Ritual Monster from your hand or Deck. You can only use 1 "Mikanko Divine Dance - Futahashira no Uzu no Miko" effect per turn, and only once that turn.
--御巫神舞-二貴子 --Mikanko Divine Dance - Futahashira no Uzu no Miko --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Send 1 "Mikanko" card from your Deck to the GY, except "Mikanko Divine Dance - Futahashira no Uzu no Miko", then you can Set 1 "Mikanko" Spell/Trap from your Deck, except "Mikanko Divine Dance - Futahashira no Uzu no Miko" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Special Summon 1 "Mikanko" Ritual Monster from your hand or Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.AND(Cost.SelfBanish,s.spcost)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_MIKANKO} function s.tgfilter(c) return c:IsSetCard(SET_MIKANKO) and c:IsAbleToGrave() and not c:IsCode(id) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.setfilter(c) return c:IsSetCard(SET_MIKANKO) and c:IsSpellTrap() and c:IsSSetable() and not c:IsCode(id) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local dg=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #dg>0 and Duel.SendtoGrave(dg,REASON_EFFECT)>0 and dg:GetFirst():IsLocation(LOCATION_GRAVE) then local g=Duel.GetMatchingGroup(s.setfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SET) local sg=g:Select(tp,1,1,nil) if #sg>0 then Duel.BreakEffect() Duel.SSet(tp,sg) end end end if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end --You cannot Special Summon from the Extra Deck for the rest of this turn after this card resolves, except "Mikanko" 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:IsSetCard(SET_MIKANKO) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckRemoveOverlayCard(tp,1,0,1,REASON_COST) end Duel.RemoveOverlayCard(tp,1,0,1,1,REASON_COST) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_MIKANKO) and c:IsRitualMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,true) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,true,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned with "Legend of Heart". When this card is Special Summoned: You can target 1 face-up Spell/Trap on the field; banish that target. Once per turn, when this card is targeted for an attack: You can target 1 Effect Monster in your GY; until the End Phase of your next turn, this card's name becomes that target's original name, and replace this effect with that target's original effects.
--伝説の騎士 ヘルモス --Legendary Knight Hermos local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --cannot special summon local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) c:RegisterEffect(e1) --remove local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) --copy local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BE_BATTLE_TARGET) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetTarget(s.cptg) e3:SetOperation(s.cpop) c:RegisterEffect(e3) end function s.rmfilter(c) return c:IsSpellTrap() and c:IsAbleToRemove() and c:IsFaceup() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and s.rmfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.rmfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,s.rmfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsSpellTrap() then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end function s.cpfilter(c) return c:IsType(TYPE_EFFECT) end function s.cptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.cpfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.cpfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.cpfilter,tp,LOCATION_GRAVE,0,1,1,nil) end function s.cpop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and c:IsFaceup() and c:IsRelateToEffect(e) then local code=tc:GetCode() local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetValue(code) e1:SetReset(RESETS_STANDARD_PHASE_END|RESET_SELF_TURN) c:RegisterEffect(e1) c:CopyEffect(code,RESETS_STANDARD_PHASE_END|RESET_SELF_TURN) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains 100 ATK for each of your banished Fish, Sea Serpent, and Aqua-Type monsters.
--スピアフィッシュソルジャー --Spearfish Soldier local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.atkup) c:RegisterEffect(e1) end function s.atkfilter(c) return c:IsFaceup() and c:IsRace(RACE_FISH|RACE_AQUA|RACE_SEASERPENT) end function s.atkup(e,c) return Duel.GetMatchingGroupCount(s.atkfilter,c:GetControler(),LOCATION_REMOVED,0,nil)*100 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
[ Pendulum Effect ] Once per turn, before damage calculation, if your "D/D/D" Fusion Monster battles an opponent's monster: You can make that opponent's monster lose 1000 ATK until the end of this turn (even if this card leaves the field). ---------------------------------------- [ Monster Effect ] 2 "D/D/D" monsters You can target 1 Attack Position monster your opponent controls; destroy it, and if you do, inflict damage to your opponent equal to half its original ATK. You can only use this effect of "D/D/D Super Doom King Purple Armageddon" once per turn. Before damage calculation, if an opponent's monster battles: You can make its ATK become equal to its original ATK until the end of the Damage Step. If this card in the Monster Zone is destroyed: You can place this card in your Pendulum Zone.
--DDD超死偉王パープリッシュ・ヘル・アーマゲドン --D/D/D Super Doom King Purple Armageddon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Pendulum.AddProcedure(c,false) Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_DDD),2) --Make an opponent's monster lose 1000 ATK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_CONFIRM) e1:SetRange(LOCATION_PZONE) e1:SetCountLimit(1) e1:SetCondition(s.atkcon1) e1:SetOperation(s.atkop1) c:RegisterEffect(e1) --Destroy 1 Attack Position monster your opponent controls and inflict damage to your opponent equal to half its original ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCountLimit(1,id) e2:SetRange(LOCATION_MZONE) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Make the ATK of an opponent's monster become equal to its original ATK until the end of the Damage Step local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_ATKCHANGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_CONFIRM) e3:SetRange(LOCATION_MZONE) e3:SetCondition(s.atkcon2) e3:SetOperation(s.atkop2) c:RegisterEffect(e3) --Place this card in your Pendulum Zone local e6=Effect.CreateEffect(c) e6:SetDescription(aux.Stringid(id,3)) e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e6:SetCode(EVENT_DESTROYED) e6:SetProperty(EFFECT_FLAG_DELAY) e6:SetCondition(s.pencon) e6:SetTarget(s.pentg) e6:SetOperation(s.penop) c:RegisterEffect(e6) end s.listed_series={SET_DDD} function s.atkcon1(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=a:GetBattleTarget() if not a or not d then return false end if a:IsControler(1-tp) then a,d=d,a end return a:IsFaceup() and a:IsRelateToBattle() and a:IsSetCard(SET_DDD) and a:IsType(TYPE_FUSION) and d and d:IsFaceup() and d:IsRelateToBattle() and d:GetAttack()>0 and a:GetControler()~=d:GetControler() end function s.atkop1(e,tp,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=a:GetBattleTarget() if a:IsControler(1-tp) then a,d=d,a end if e:GetHandler():IsRelateToEffect(e) and d:IsFaceup() and d:IsRelateToBattle() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-1000) e1:SetReset(RESETS_STANDARD_PHASE_END) d:RegisterEffect(e1) end end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsPosition(POS_FACEUP_ATTACK) end if chk==0 then return Duel.IsExistingTarget(Card.IsPosition,tp,0,LOCATION_MZONE,1,nil,POS_FACEUP_ATTACK) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsPosition,tp,0,LOCATION_MZONE,1,1,nil,POS_FACEUP_ATTACK) local atk=math.floor(g:GetFirst():GetBaseAttack()/2) if atk<0 then atk=0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then local atk=math.floor(tc:GetBaseAttack()/2) if atk<0 then atk=0 end if Duel.Destroy(tc,REASON_EFFECT)~=0 then Duel.Damage(1-tp,atk,REASON_EFFECT) end end end function s.atkcon2(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local d=a:GetBattleTarget() if a:IsControler(tp) then a,d=d,a end return a and a:IsControler(1-tp) and a:GetAttack()~=a:GetBaseAttack() end function s.atkop2(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsControler(tp) then tc=tc:GetBattleTarget() end if tc and tc:IsFaceup() and tc:GetAttack()~=tc:GetBaseAttack() then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(tc:GetBaseAttack()) e1:SetReset(RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_DAMAGE_CAL) tc:RegisterEffect(e1) end end function s.pencon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() end function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) 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() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
● While in Attack Position: This card gains 800 ATK for each Equip Card equipped to it. ● While in Defense Position: This card gains 800 DEF for each Equip Card equipped to it.
--D・ビデオン --Morphtronic Videon local s,id=GetID() function s.initial_effect(c) --atk local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetCondition(s.cona) e1:SetValue(s.val) c:RegisterEffect(e1) --def local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetCondition(s.cond) c:RegisterEffect(e2) end function s.cona(e) return e:GetHandler():IsAttackPos() end function s.cond(e) return e:GetHandler():IsDefensePos() end function s.val(e,c) return c:GetEquipCount()*800 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Draw Phase, each time you draw a "Six Samurai" Monster Card(s): You can reveal it; Special Summon it.
--神速の具足 --Swiftstrike Armor local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e1) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetRange(LOCATION_SZONE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DRAW) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_SIX_SAMURAI} function s.spcon(e,tp,eg,ep,ev,re,r,rp) return ep==tp and Duel.IsPhase(PHASE_DRAW) end function s.filter(c,e,tp) return c:IsSetCard(SET_SIX_SAMURAI) and c:IsMonster() and not c:IsPublic() 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 eg:IsExists(s.filter,1,nil,e,tp) end local g=eg:Filter(s.filter,nil,e,tp) if #g==1 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) Duel.SetTargetCard(g) else Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sg=g:Select(tp,1,1,nil) Duel.ConfirmCards(1-tp,sg) Duel.ShuffleHand(tp) Duel.SetTargetCard(sg) 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 not e:GetHandler():IsRelateToEffect(e) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can only Special Summon "Dinovatus Docus(s)" once per turn. If you control 2 or more Dinosaur monsters: You can Special Summon this card from your hand. You can Tribute 1 Level 4 or lower monster; Special Summon 1 Dinosaur monster from your Deck that is 2 Levels higher or lower than the Tributed monster had on the field, but destroy it during the End Phase. You can only use this effect of "Dinovatus Docus" once per turn.
--ディノベーダー・ドクス --Dinovatus Docus --scripted by Naim local s,id=GetID() function s.initial_effect(c) --You can only Special Summon "Dinovader Docus" once per turn c:SetSPSummonOnce(id) --Special Summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCondition(function(e,tp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_DINOSAUR),tp,LOCATION_MZONE,0,2,nil) end) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Special Summon 1 Dinosaur monster from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCost(s.dspcost) e2:SetTarget(s.dsptg) e2:SetOperation(s.dspop) c:RegisterEffect(e2) end s.listed_names={id} function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.dspcostfilter(c,e,tp) return c:IsLevelBelow(4) and Duel.GetMZoneCount(tp,c)>0 and Duel.IsExistingMatchingCard(s.dspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,c:GetLevel()) end function s.dspfilter(c,e,tp,lv) return c:IsRace(RACE_DINOSAUR) and c:IsLevel(lv-2,lv+2) 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.CheckReleaseGroupCost(tp,s.dspcostfilter,1,false,nil,nil,e,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.dspcostfilter,1,1,false,nil,nil,e,tp) e:SetLabel(g:GetFirst():GetLevel()) Duel.Release(g,REASON_COST) end function s.dsptg(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) 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 tc=Duel.SelectMatchingCard(tp,s.dspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,e:GetLabel()):GetFirst() if tc and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)>0 then --Destroy it during the End Phase aux.DelayedOperation(tc,PHASE_END,id,e,tp,function(dg) Duel.Destroy(dg,REASON_EFFECT) end,nil,0,nil,aux.Stringid(id,2)) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand: You can target 1 WATER monster in your Main Monster Zone; destroy that monster you control, and if you do, Special Summon this card to the zone that monster was in, then you can destroy all face-up cards your opponent controls in this card's column. You can only use this effect of "Tsuru-Puru-Purun" once per turn.
--ツルプルプルン --Tsuru-Puru-Purun --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon this card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end function s.spfilter(c,tp) return c:IsAttribute(ATTRIBUTE_WATER) and c:IsFaceup() and Duel.GetMZoneCount(tp,c,tp,LOCATION_REASON_TOFIELD,1<<c:GetSequence())>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MMZONE) and chkc:IsControler(tp) and s.spfilter(chkc,tp) end local c=e:GetHandler() if chk==0 then return Duel.IsExistingTarget(s.spfilter,tp,LOCATION_MMZONE,0,1,nil,tp) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_MMZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,1-tp,LOCATION_ONFIELD) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsControler(tp)) then return end local seq=tc:GetSequence() local c=e:GetHandler() if Duel.Destroy(tc,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,1<<seq)>0 then local g=c:GetColumnGroup():Filter(aux.FaceupFilter(Card.IsControler,1-tp),nil) if #g==0 or not Duel.SelectYesNo(tp,aux.Stringid(id,1)) then return end Duel.BreakEffect() Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Spell Cards, and their effects on the field, cannot be activated. Negate all Spell effects on the field.
--マジック・キャンセラー --Spell Canceller local s,id=GetID() function s.initial_effect(c) --cannot trigger local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(1,1) e1:SetValue(s.aclimit) c:RegisterEffect(e1) --disable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DISABLE) e2:SetRange(LOCATION_MZONE) e2:SetTargetRange(LOCATION_SZONE,LOCATION_SZONE) e2:SetTarget(s.distg) c:RegisterEffect(e2) --disable effect local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_CHAIN_SOLVING) e3:SetRange(LOCATION_MZONE) e3:SetOperation(s.disop) c:RegisterEffect(e3) end function s.aclimit(e,re,tp) return re:IsSpellEffect() and (re:GetHandler():IsOnField() or re:IsHasType(EFFECT_TYPE_ACTIVATE)) end function s.distg(e,c) return c:IsSpell() end function s.disop(e,tp,eg,ep,ev,re,r,rp) local tl=Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION) if (tl&LOCATION_SZONE)~=0 and re:IsSpellEffect() then Duel.NegateEffect(ev) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Special Summons a monster(s) from the Main Deck or GY: Banish it face-down.
--電網の落とし穴 --Network Trap Hole 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_SPSUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.filter(c,tp) return not c:IsSummonPlayer(tp) and (c:IsSummonLocation(LOCATION_DECK) or c:IsSummonLocation(LOCATION_GRAVE)) and c:IsAbleToRemove(tp,POS_FACEDOWN) and c:IsLocation(LOCATION_MZONE) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=eg:Filter(s.filter,nil,tp) local ct=#g if chk==0 then return ct>0 end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,ct,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.filter,nil,tp):Filter(Card.IsRelateToEffect,nil,e) if #g>0 then Duel.Remove(g,POS_FACEDOWN,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can send 1 "Slushy" from your Deck to the GY. If you have 3 copies of "Slushy" total, either banished and/or in your GY (combined): You can banish this card from your GY, then target 1 Level 5 or higher Sea Serpent monster in your GY; Special Summon that target. You can only use this effect of "Slushy" once per turn.
--フラッピィ --Slushy local s,id=GetID() function s.initial_effect(c) --send to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --spsummon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCondition(s.spcon) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.tgfilter(c) return c:IsCode(id) and c:IsAbleToGrave() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.cfilter(c) return c:IsCode(id) and c:IsFaceup() end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetMatchingGroupCount(s.cfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,nil)==3 end function s.filter(c,e,tp) return c:IsLevelAbove(5) and c:IsRace(RACE_SEASERPENT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,e:GetHandler(),e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
All face-up Psychic-Type monsters you controlled when this card was activated gain 300 ATK for each of your Psychic-Type monsters that is removed from play when this card resolves. During the End Phase, remove from play all monsters that were affected by this effect.
--超能力増幅器 --ESP Amplifier local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) 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) if Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated() then return false end return true end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_PSYCHIC),tp,LOCATION_MZONE,0,1,nil) end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local sg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_PSYCHIC),tp,LOCATION_MZONE,0,nil) local c=e:GetHandler() local tc=sg:GetFirst() local atk=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsRace,RACE_PSYCHIC),tp,LOCATION_REMOVED,0,nil)*300 for tc in aux.Next(sg) do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(atk) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e2:SetCode(EVENT_PHASE+PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetReset(RESETS_STANDARD_PHASE_END) e2:SetCountLimit(1) e2:SetOperation(s.rmop) tc:RegisterEffect(e2) end 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:
1 Tuner + 1+ non-Tuner Synchro Monsters If this card is Synchro Summoned: You can target cards your opponent controls, up to the number of Synchro Monsters in your GY; destroy them, and if you do, this card gains 1000 ATK for each card destroyed. If this Synchro Summoned card is destroyed: You can Special Summon up to 3 Level 8 or lower "Warrior", "Synchron", and/or "Stardust" Synchro Monsters with different names from your GY. You can only use each effect of "Satellite Warrior" once per turn.
--サテライト・ウォリアー --Satellite Warrior local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner Synchro Monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsType,TYPE_SYNCHRO),1,99) --Destroy cards your opponent controls up to the number of Synchro Monsters in your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Special Summon up to 3 "Warrior", "Stardust" or "Synchron" monster from the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end s.synchro_nt_required=1 s.listed_series={SET_WARRIOR,SET_SYNCHRON,SET_STARDUST} 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.GetMatchingGroupCount(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_SYNCHRO) 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) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,1000) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 then return end local ct=Duel.Destroy(tg,REASON_EFFECT) local c=e:GetHandler() if ct>0 and c:IsFaceup() and c:IsRelateToEffect(e) then --This card gains 1000 ATK for each card destroyed local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(ct*1000) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsSynchroSummoned() end function s.spfilter(c,e,tp) return c:IsLevelBelow(8) and c:IsSetCard({SET_WARRIOR,SET_SYNCHRON,SET_STARDUST}) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp) if #g==0 then return end ft=math.min(ft,3) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local sg=aux.SelectUnselectGroup(g,e,tp,1,ft,aux.dncheck,1,tp,HINTMSG_SPSUMMON) if #sg>0 then Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 "Lightsworn" monster from your hand or GY, then target 1 face-up monster on the field; it loses ATK and DEF equal to the banished monster's Level x 300, until the end of this turn. Once per turn, if your other "Lightsworn" monster's effect is activated: Send the top 2 cards of your Deck to the GY.
--トワイライトロード・ジェネラル ジェイン --Jain, Twilightsworn General local s,id=GetID() function s.initial_effect(c) --reduce atk local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCountLimit(1) e1:SetCost(s.atkcost) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) --mill local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DECKDES) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCondition(s.ddcon) e2:SetTarget(s.ddtg) e2:SetOperation(s.ddop) c:RegisterEffect(e2) end s.listed_series={SET_LIGHTSWORN} function s.atkcfilter(c) return c:IsSetCard(SET_LIGHTSWORN) and c:IsLevelAbove(1) and c:IsAbleToRemoveAsCost() and (c:IsLocation(LOCATION_HAND) or aux.SpElimFilter(c,true)) and Duel.IsExistingTarget(Card.IsFaceup,0,LOCATION_MZONE,LOCATION_MZONE,1,c) end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkcfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.atkcfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil) e:SetLabel(g:GetFirst():GetLevel()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then local lv=e:GetLabel() local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(-lv*300) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) tc:RegisterEffect(e2) end end function s.ddcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=re:GetHandler() return re:IsMonsterEffect() and rc~=c and rc:IsSetCard(SET_LIGHTSWORN) and rc:IsControler(tp) end function s.ddtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,2) end function s.ddop(e,tp,eg,ep,ev,re,r,rp) Duel.DiscardDeck(tp,2,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in your hand or GY: You can reveal 1 Level 9 monster in your hand, except "QQ Enneagon"; Special Summon both this card and the revealed monster in Defense Position, also you cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 9 or higher Xyz Monsters. You can only use this effect of "QQ Enneagon" once per turn. A Rank 9 or higher Xyz Monster that has this card as material gains this effect. ● This card gains 900 ATK/DEF.
--QQエニアゴン --QQ Enneagon --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) --Special Summon both this card from your hand or GY and 1 Level 9 monster from your hand in Defense Position local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --A Rank 9 or higher Xyz Monster that has this card as material gains this effect: ● This card gains 900 ATK/DEF. local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_XMATERIAL) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.xmatcon) e2:SetValue(900) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e3) end s.listed_names={id} function s.spcostfilter(c,e,tp) return c:IsLevel(9) and not c:IsPublic() and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp):GetFirst() Duel.ConfirmCards(1-tp,rc) e:SetLabelObject(rc) Duel.ShuffleHand(tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end local rc=e:GetLabelObject() Duel.SetTargetCard(rc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,Group.FromCards(c,rc),2,tp,0) end function s.spfilter(c,e,tp) return c:IsRelateToEffect(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local g=Group.FromCards(c,Duel.GetFirstTarget()) if g:FilterCount(s.spfilter,nil,e,tp)==2 and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end --You cannot Special Summon from the Extra Deck for the rest of this turn, except Rank 9 or higher 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(e,c) return c:IsLocation(LOCATION_EXTRA) and not (c:IsType(TYPE_XYZ) and c:IsRankAbove(9)) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end function s.xmatcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsRankAbove(9) and c:IsType(TYPE_XYZ) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Declare a Level between 1 and 12; each player tosses a coin, and if both are Heads, the Levels of all face-up monsters you currently control become the declared Level. If both are tails, you lose Life Points equal to the declared Level x 500.
--大金星!? --BIG Win!? local s,id=GetID() function s.initial_effect(c) --Change level of all face-up monsters OR lose LP local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COIN) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.toss_coin=true function s.cfilter(c) return c:IsFaceup() and not c:IsType(TYPE_XYZ) end function s.target(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_LVRANK) local lv=Duel.AnnounceLevel(tp) Duel.SetTargetParam(lv) Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,PLAYER_ALL,2) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local lv=Duel.GetChainInfo(0,CHAININFO_TARGET_PARAM) local coin1=Duel.TossCoin(tp,1) local coin2=Duel.TossCoin(1-tp,1) if coin1==COIN_HEADS and coin2==COIN_HEADS then local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) for tc in g:Iter() do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) e1:SetValue(lv) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end elseif coin1==COIN_TAILS and coin2==COIN_TAILS then local lp=Duel.GetLP(tp) Duel.SetLP(tp,lp-lv*500) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Must be Special Summoned with "The Fang of Critias", using "Mirror Force". When a monster(s) you control is targeted for an attack or by an opponent's card effect (except during the Damage Step) (Quick Effect): You can destroy all cards your opponent controls. * The above text is unofficial and describes the card's functionality in the OCG.
--ミラーフォース・ドラゴン --Mirror Force Dragon local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Special Summon Condition local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) c:RegisterEffect(e1) --Destroy monsters local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_BE_BATTLE_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCondition(s.descon1) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(EVENT_BECOME_TARGET) e3:SetCondition(s.descon2) c:RegisterEffect(e3) end s.material_trap=44095762 function s.tgfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) end function s.descon1(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.tgfilter,1,nil,tp) end function s.descon2(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and eg:IsExists(s.tgfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) and not e:GetHandler():IsStatus(STATUS_CHAINING) end local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.TRUE,tp,0,LOCATION_ONFIELD,nil) Duel.Destroy(g,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Draw cards equal to the number of "Number" Xyz Monsters with different names you control. You can only activate 1 "Memories of Hope" per turn.
--希望の記憶 --Memories of Hope --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_NUMBER} function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_NUMBER) and c:IsType(TYPE_XYZ) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) local ct=g:GetClassCount(Card.GetCode) if chk==0 then return ct>0 and Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(ct) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local g=Duel.GetMatchingGroup(s.filter,tp,LOCATION_MZONE,0,nil) local ct=g:GetClassCount(Card.GetCode) Duel.Draw(p,ct,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Only a monster with an ATK of 1000 points or less can be equipped with this card. During damage calculation, increase the ATK of the monster equipped with this card by 2500 points if the opponent's monster that battles it is in Attack Position and its ATK is 2500 or more, OR if the opponent's monster that battles it is in Defense Position and its DEF is 2500 or more.
--バスターランチャー --Buster Rancher local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsAttackBelow,1000),s.eqlimit) --Atk,def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetCondition(s.atkcon) e2:SetValue(2500) c:RegisterEffect(e2) end function s.eqlimit(e,c) return Duel.IsPhase(PHASE_DAMAGE_CAL) or c:IsAttackBelow(1000) end function s.atkcon(e) local ec=e:GetHandler():GetEquipTarget() if not ec:IsRelateToBattle() then return end local bc=ec:GetBattleTarget() return Duel.IsPhase(PHASE_DAMAGE_CAL) and bc and ((bc:IsAttackPos() and bc:IsAttackAbove(2500)) or (bc:IsDefensePos() and bc:IsDefenseAbove(2500))) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can banish 1 Fish, Sea Serpent, or Aqua monster from your hand, then target 1 face-up card your opponent controls; destroy that target, then banish this card until your next Standby Phase.
--エアジャチ --Airorca local s,id=GetID() function s.initial_effect(c) --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.descost) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.cfilter(c) return c:IsRace(RACE_FISH|RACE_SEASERPENT|RACE_AQUA) and c:IsAbleToRemoveAsCost() 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,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) then Duel.BreakEffect() if Duel.Remove(c,0,REASON_EFFECT|REASON_TEMPORARY)==0 then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetLabelObject(c) e1:SetCondition(s.retcon) e1:SetOperation(s.retop) e1:SetReset(RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN) Duel.RegisterEffect(e1,tp) end end function s.retcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(tp) end function s.retop(e,tp,eg,ep,ev,re,r,rp) Duel.ReturnToField(e:GetLabelObject()) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a monster(s) would be Summoned, OR when a Spell/Trap Card, or monster effect, is activated that includes an effect that Special Summons a monster(s): Pay 2000 LP; negate the Summon or activation, and if you do, destroy it.
--神の警告 --Solemn Warning local s,id=GetID() function s.initial_effect(c) --Activate(summon) local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON) e1:SetCondition(s.condition1) e1:SetCost(s.cost1) e1:SetTarget(s.target1) e1:SetOperation(s.activate1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON) c:RegisterEffect(e3) --Activate(effect) local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e4:SetType(EFFECT_TYPE_ACTIVATE) e4:SetCode(EVENT_CHAINING) e4:SetCondition(s.condition2) e4:SetCost(s.cost2) e4:SetTarget(s.target2) e4:SetOperation(s.activate2) c:RegisterEffect(e4) end function s.condition1(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain(true)==0 end function s.cost1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,2000) else Duel.PayLPCost(tp,2000) end end function s.target1(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,eg,#eg,0,0) Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,#eg,0,0) end function s.activate1(e,tp,eg,ep,ev,re,r,rp) Duel.NegateSummon(eg) Duel.Destroy(eg,REASON_EFFECT) end function s.condition2(e,tp,eg,ep,ev,re,r,rp) if not Duel.IsChainNegatable(ev) then return false end if not re or (not re:IsMonsterEffect() and not re:IsHasType(EFFECT_TYPE_ACTIVATE)) then return false end return re:IsHasCategory(CATEGORY_SPECIAL_SUMMON) end function s.cost2(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckLPCost(tp,2000) else Duel.PayLPCost(tp,2000) end end function s.target2(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.activate2(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard 1 other "Salamangreat" card; Special Summon this card from your hand. You can only use this effect of "Salamangreat Tiger" once per turn. If this card you control would be used as Synchro Material for a FIRE monster, you can treat it as a non-Tuner. Once per turn: You can increase or decrease this card's Level by 1.
--転生炎獣ティガー --Salamangreat Tiger --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Can be treated as a non-tuner for the Synchro Summon of a FIRE monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetCode(EFFECT_NONTUNER) e2:SetRange(LOCATION_MZONE) e2:SetValue(function(_,sc) return sc and sc:IsAttribute(ATTRIBUTE_FIRE) end) c:RegisterEffect(e2) --Increase or decrease this card's Level by 1 local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_LVCHANGE) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.lvtg) e3:SetOperation(s.lvop) c:RegisterEffect(e3) end s.listed_series={SET_SALAMANGREAT} function s.cfilter(c) return c:IsSetCard(SET_SALAMANGREAT) and c:IsDiscardable() end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,c) end Duel.DiscardHand(tp,s.cfilter,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) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:HasLevel() end Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,c,1,tp,0) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) and c:HasLevel() then local op=Duel.SelectEffect(tp, {true,aux.Stringid(id,2)}, {c:IsLevelAbove(2),aux.Stringid(id,3)}) local lvl=op==2 and -1 or 1 --Increase or decrease this card's Level by 1 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(lvl) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a monster that is not a "Burning Abyss" monster, destroy this card. You can only use 1 of these effects of "Scarm, Malebranche of the Burning Abyss" per turn, and only once that turn. ● If you control no Spell/Trap Cards: You can Special Summon this card from your hand. ● During the End Phase, if this card is in the Graveyard because it was sent there this turn: You can add 1 Level 3 DARK Fiend-Type monster from your Deck to your hand, except "Scarm, Malebranche of the Burning Abyss".
--彼岸の悪鬼 スカラマリオン --Scarm, Malebranche of the Burning Abyss local s,id=GetID() function s.initial_effect(c) --self destroy local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SELF_DESTROY) e1:SetCondition(s.sdcon) c:RegisterEffect(e1) --Special Summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCondition(s.sscon) e2:SetTarget(s.sstg) e2:SetOperation(s.ssop) c:RegisterEffect(e2) --to grave local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetCode(EVENT_TO_GRAVE) e3:SetOperation(s.regop) c:RegisterEffect(e3) --search local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_PHASE+PHASE_END) e4:SetCountLimit(1,id) e4:SetRange(LOCATION_GRAVE) e4:SetCondition(s.thcon) e4:SetTarget(s.thtg) e4:SetOperation(s.thop) c:RegisterEffect(e4) end s.listed_series={SET_BURNING_ABYSS} s.listed_names={id} function s.sdfilter(c) return not c:IsFaceup() or not c:IsSetCard(SET_BURNING_ABYSS) end function s.sdcon(e) return Duel.IsExistingMatchingCard(s.sdfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.filter(c) return c:IsSpellTrap() end function s.sscon(e,tp,eg,ep,ev,re,r,rp) return not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end function s.sstg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.ssop(e,tp,eg,ep,ev,re,r,rp) 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.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) end function s.thfilter(c) return c:GetLevel()==3 and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_FIEND) and not c:IsCode(id) and c:IsAbleToHand() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():GetFlagEffect(id)>0 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:
1 Tuner + 1 or more non-Tuner "Gusto" monsters Once per turn: You can shuffle 2 "Gusto" monsters from your Graveyard into the Main Deck to target 1 face-up monster your opponent controls; destroy that target.
--ダイガスタ・ガルドス --Daigusto Gulldos local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsSetCard,SET_GUSTO),1,99) c:EnableReviveLimit() --destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_GUSTO} function s.costfilter(c) return c:IsSetCard(SET_GUSTO) and c:IsMonster() and c:IsAbleToDeckAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_GRAVE,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_GRAVE,0,2,2,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must first be Special Summoned (from your hand) while your opponent controls a "Kaiju" monster. You can only control 1 "Kaiju" monster. Once per turn: You can remove 2 Kaiju Counters from anywhere on the field; equip 1 "Kaiju" monster from your hand or Graveyard to this card. This card gains ATK equal to the combined original ATK of the "Kaiju" monsters equipped to it by this effect.
--対壊獣用決戦兵器スーパーメカドゴラン --Super Anti-Kaiju War Machine Mecha-Dogoran local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() c:SetUniqueOnField(1,0,aux.FilterBoolFunction(Card.IsSetCard,SET_KAIJU),LOCATION_MZONE) --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) --equip local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCategory(CATEGORY_EQUIP) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.eqcost) e2:SetTarget(s.eqtg) e2:SetOperation(s.eqop) c:RegisterEffect(e2) aux.AddEREquipLimit(c,nil,s.eqval,s.equipop,e2) --atk local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_MZONE) e3:SetValue(s.atkval) c:RegisterEffect(e3) end s.counter_list={COUNTER_KAIJU} s.listed_series={SET_KAIJU} function s.eqval(ec,c,tp) return ec:IsControler(tp) and s.eqfilter(ec) end function s.spcon(e,c) if c==nil then return true end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_KAIJU),tp,0,LOCATION_MZONE,1,nil) end function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsCanRemoveCounter(tp,1,1,COUNTER_KAIJU,2,REASON_COST) end Duel.RemoveCounter(tp,1,1,COUNTER_KAIJU,2,REASON_COST) end function s.eqfilter(c) return c:IsSetCard(SET_KAIJU) 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.eqfilter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,LOCATION_GRAVE|LOCATION_HAND) end function s.equipop(c,e,tp,tc) c:EquipByEffectAndLimitRegister(e,tp,tc,id,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.eqfilter),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.atkfilter(c) return c:IsSetCard(SET_KAIJU) and c:GetAttack()>=0 and c:GetFlagEffect(id)~=0 end function s.atkval(e,c) local g=e:GetHandler():GetEquipGroup():Filter(s.atkfilter,nil) return g:GetSum(Card.GetAttack) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can discard 1 card, and if you do, send 1 "Fossil" Fusion Monster from your Extra Deck to the GY. You can send this card from the field to the GY; inflict 500 damage to your opponent, then, if "Fossil Fusion" is in your GY, you can return to your GY, 1 of your banished cards that is "Fossil Fusion" or mentions it. You can only use each effect of "Flint Cragger" once per turn.
--フリント・クラッガー --Flint Cragger --Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Discard 1 card, and if you do, send 1 "Fossil" Fusion Monster from your Extra Deck to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_HANDES+CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) --Inflict 500 damage to your opponent, then, if "Fossil Fusion" is in your GY, you can return to your GY, 1 of your banished cards that is "Fossil Fusion" or mentions it 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:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfToGrave) e2:SetTarget(s.damtg) e2:SetOperation(s.damop) c:RegisterEffect(e2) end s.listed_series={SET_FOSSIL} s.listed_names={CARD_FOSSIL_FUSION} function s.tgfilter(c) return c:IsSetCard(SET_FOSSIL) and c:IsType(TYPE_FUSION) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil,REASON_EFFECT) and Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_EXTRA,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,tp,1) Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_EXTRA) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) if Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_DISCARD|REASON_EFFECT,nil,REASON_EFFECT)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_EXTRA,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end 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(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500) end function s.rettgfilter(c) return (c:IsCode(CARD_FOSSIL_FUSION) or c:ListsCode(CARD_FOSSIL_FUSION)) and c:IsFaceup() end function s.damop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) if Duel.Damage(p,d,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(Card.IsCode,tp,LOCATION_GRAVE,0,1,nil,CARD_FOSSIL_FUSION) and Duel.IsExistingMatchingCard(s.rettgfilter,tp,LOCATION_REMOVED,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.rettgfilter,tp,LOCATION_REMOVED,0,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.BreakEffect() Duel.SendtoGrave(g,REASON_EFFECT|REASON_RETURN) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is activated: You can add 1 "Therion" monster from your Deck to your hand. Once per turn, if your monster would be destroyed by battle, you can send 1 "Therion" card or 1 "Endless Engine Argyro System" from your Deck to the GY instead. Once per turn, when a monster is destroyed by battle and sent to the GY: You can target 1 "Therion" monster in your GY; add it to your hand. You can only activate 1 "Therion Discolosseum" per turn.
--円盤闘技場セリオンズ・リング --Therion Discolosseum --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) e2:SetTarget(s.reptg) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) --Return to hand local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_BATTLE_DESTROYED) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.listed_names={CARD_ARGYRO_SYSTEM} s.listed_series={SET_THERION} function s.thfilter(c) return c:IsMonster() and c:IsSetCard(SET_THERION) and c:IsAbleToHand() end function s.activate(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=g:Select(tp,1,1,nil) Duel.SendtoHand(sg,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,sg) end end function s.dfilter(c,tp) return c:IsControler(tp) and c:IsReason(REASON_BATTLE) end function s.repfilter(c) return (c:IsSetCard(SET_THERION) or c:IsCode(CARD_ARGYRO_SYSTEM)) and c:IsAbleToGrave() end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return eg:IsExists(s.dfilter,1,nil,tp) and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_DECK,0,1,nil) end return Duel.SelectEffectYesNo(tp,e:GetHandler(),96) end function s.repval(e,c) return c:IsControler(e:GetHandlerPlayer()) and c:IsReason(REASON_BATTLE) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_DECK,0,1,1,nil) Duel.SendtoGrave(g,REASON_EFFECT) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsLocation,1,nil,LOCATION_GRAVE) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and 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:
All face-up monsters on the field become Machine monsters. Machine monsters you control gain 500 ATK/DEF, also Machine monsters your opponent controls lose 500 ATK/DEF. You can banish this card from your GY, then discard 1 card; add 1 EARTH Machine monster from your Deck to your hand. You can only use this effect of "Clockwork Night" once per turn. You can only activate 1 "Clockwork Night" per turn.
--機械仕掛けの夜-クロック・ワーク・ナイト- --Clockwork Night --Scripted by DyXel local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) c:RegisterEffect(e1) --All monsters become Machine local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CHANGE_RACE) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e2:SetValue(RACE_MACHINE) c:RegisterEffect(e2) --Increase the ATK/DEF of Machine monsters you control by 500 local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_UPDATE_ATTACK) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(aux.TargetBoolFunction(Card.IsRace,RACE_MACHINE)) e3:SetValue(function(e,c) return c:IsControler(e:GetHandlerPlayer()) and 500 or -500 end) c:RegisterEffect(e3) local e4=e3:Clone() e4:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e4) --Banish itself from GY; Search EARTH Machine local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,0)) e5:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_GRAVE) e5:SetCountLimit(1,{id,1}) e5:SetCost(s.thcost) e5:SetTarget(s.thtg) e5:SetOperation(s.thop) c:RegisterEffect(e5) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end Duel.Remove(c,POS_FACEUP,REASON_COST) Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) end function s.thfilter(c) return c:IsAttribute(ATTRIBUTE_EARTH) and c:IsRace(RACE_MACHINE) 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 return end Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
After this card's activation, it remains on the field, but destroy it during your opponent's 3rd End Phase. Tribute 1 Dinosaur-Type monster to activate this card; while this card is face-up on the field, you can Normal Summon Level 5 or higher Dinosaur-Type monsters without Tributing.
--大進化薬 --Big Evolution Pill local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCost(s.cost) e1:SetTarget(s.target) c:RegisterEffect(e1) --reduce tribute local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_SUMMON_PROC) e2:SetRange(LOCATION_SZONE) e2:SetTargetRange(LOCATION_HAND,0) e2:SetCondition(s.ntcon) e2:SetTarget(aux.FieldSummonProcTg(aux.TargetBoolFunction(Card.IsRace,RACE_DINOSAUR))) c:RegisterEffect(e2) --remain field local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_REMAIN_FIELD) c:RegisterEffect(e3) end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsRace,1,false,nil,nil,RACE_DINOSAUR) end local g=Duel.SelectReleaseGroupCost(tp,Card.IsRace,1,1,false,nil,nil,RACE_DINOSAUR) Duel.Release(g,REASON_COST) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() c:SetTurnCounter(0) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) e1:SetRange(LOCATION_SZONE) e1:SetCondition(s.descon) e1:SetOperation(s.desop) e1:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e1) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_SET_AVAILABLE) e3:SetCode(1082946) e3:SetLabelObject(e1) e3:SetOwnerPlayer(tp) e3:SetOperation(s.reset) e3:SetReset(RESET_EVENT|RESETS_STANDARD) c:RegisterEffect(e3) end function s.reset(e,tp,eg,ep,ev,re,r,rp) s.desop(e:GetLabelObject(),tp,eg,ep,ev,e,r,rp) end function s.descon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local ct=c:GetTurnCounter() ct=ct+1 c:SetTurnCounter(ct) if ct==3 then Duel.Destroy(c,REASON_RULE) if re then re:Reset() end end end function s.ntcon(e,c,minc) if c==nil then return true end return minc==0 and Duel.GetLocationCount(c:GetControler(),LOCATION_MZONE)>0 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can target 1 "Lunalight" monster in your Graveyard, except "Lunalight White Rabbit"; Special Summon it in Defense Position. Once per turn: You can target Spell/Trap Cards your opponent controls, up to the number of other "Lunalight" cards you control; return them to the hand.
--月光白兎 --Lunalight White Rabbit 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:SetCode(EVENT_SUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetCategory(CATEGORY_TOHAND) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_LUNALIGHT} s.listed_names={id} function s.spfilter(c,e,tp) return c:IsSetCard(SET_LUNALIGHT) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,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_DEFENSE) end end function s.filter2(c) return c:IsSpellTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) and s.filter2(chkc) end if chk==0 then return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_LUNALIGHT),tp,LOCATION_ONFIELD,0,1,e:GetHandler()) and Duel.IsExistingTarget(s.filter2,tp,0,LOCATION_ONFIELD,1,nil) end local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_LUNALIGHT),tp,LOCATION_ONFIELD,0,e:GetHandler()) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.filter2,tp,0,LOCATION_ONFIELD,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetTargetCards(e) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
At the end of the Damage Step, if a monster battled: You can Special Summon this card from your hand. You can send 1 Trap from your hand or that's Set on your field to the GY; destroy all other monsters in this card's column. If this card in the Monster Zone is destroyed by battle or card effect and sent to the GY: You can target 1 card in your GY; roll a six-sided die, and if the result is 6, add that target to your hand. You can only use each effect of "Thunder Ball" once per turn.
--鉄球魔神ゴロゴーン --Thunder Ball --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(function() return Duel.HasFlagEffect(0,id) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Keep track of damage calculation being performed aux.GlobalCheck(s,function() local ge1=Effect.CreateEffect(c) ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) ge1:SetCode(EVENT_BATTLED) ge1:SetOperation(function() Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_DAMAGE,0,1) end) Duel.RegisterEffect(ge1,0) end) --Destroy all other monsters in this card's column local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.descost) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) --Roll a six-sided die, and if the result is 6, add 1 card from your GY to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DICE+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) end s.roll_dice=true 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.descostfilter(c) return c:IsTrap() and (c:IsLocation(LOCATION_HAND) or c:IsFacedown()) and c:IsAbleToGraveAsCost() end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.descostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.descostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local cg=c:GetColumnGroup():Match(Card.IsMonster,c) if chk==0 then return #cg>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,cg,#cg,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local cg=c:GetColumnGroup():Match(Card.IsMonster,c) if #cg>0 then Duel.Destroy(cg,REASON_EFFECT) end end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsLocation(LOCATION_GRAVE) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.TossDice(tp,1)==6 then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during your Main Phase, if you control this card on the field, you can equip it to your "Dark Blade" as an Equip Spell Card, OR unequip the Union equipment and Special Summon this card in face-up Attack Position. While equipped to a monster by this card's effect, increase the ATK/DEF of the equipped monster by 900 points, and you can Tribute this card to allow the equipped monster to attack your opponent's Life Points directly this turn. (1 monster can only be equipped with 1 Union Monster at a time. If the equipped monster is destroyed as a result of battle, destroy this card instead.)
--騎竜 --Kiryu local s,id=GetID() function s.initial_effect(c) aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsCode,11321183),true) --Atk up local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_EQUIP) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(900) e1:SetCondition(aux.IsUnionState) c:RegisterEffect(e1) --Def up local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_DEFENSE) e2:SetValue(900) e2:SetCondition(aux.IsUnionState) c:RegisterEffect(e2) --direct_attack local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_SZONE) e3:SetCondition(aux.IsUnionState) e3:SetCost(s.atkcost) e3:SetOperation(s.atkop) c:RegisterEffect(e3) end s.listed_names={11321183} function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsReleasable() end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) Duel.SetTargetCard(e:GetHandler():GetEquipTarget()) Duel.Release(e:GetHandler(),REASON_COST) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DIRECT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner monsters Once per turn: You can target 1 card on the field; destroy it. Once while face-up on the field, when a card or effect is activated (Quick Effect): You can negate the activation, and if you do, destroy that card. You can only use the previous effect of "Baronne de Fleur" once per turn. Once per turn, during the Standby Phase: You can target 1 Level 9 or lower monster in your GY; return this card to the Extra Deck, and if you do, Special Summon that monster.
--フルール・ド・バロネス --Baronne de Fleur local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon 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:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Negate the activation of a card or effect local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL+EFFECT_FLAG_NO_TURN_RESET) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.negcon) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Return this card to the Extra Deck and Special Summon from your GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOEXTRA+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_PHASE|PHASE_STANDBY) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) 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.negcon(e,tp,eg,ep,ev,re,r,rp) return not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local rc=re:GetHandler() if rc:IsDestructable() and rc:IsRelateToEffect(re) then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.spfilter(c,e,tp) return c:IsLevelBelow(9) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) and chkc~=c end if chk==0 then return Duel.GetMZoneCount(tp,c)>0 and c:IsAbleToExtra() and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,c,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,c,e,tp) Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,c,1,0,0) 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() if not (c:IsRelateToEffect(e) and Duel.SendtoDeck(c,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and c:IsLocation(LOCATION_EXTRA)) then return end local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Special Summoned: You can Special Summon 1 "Data Acorn Token" (Cyberse/DARK/Level 1/ATK 0/DEF 0). You can only use this effect of "Datacorn" once per turn.
--ドングルドングリ --Datacorn 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+CATEGORY_TOKEN) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) e1:SetTarget(s.tktg) e1:SetOperation(s.tkop) c:RegisterEffect(e1) end s.listed_names={84816245} function s.tktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_DARK) end Duel.SetOperationInfo(0,CATEGORY_TOKEN,nil,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,0) end function s.tkop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonMonster(tp,id+1,0,TYPES_TOKEN,0,0,1,RACE_CYBERSE,ATTRIBUTE_DARK) then local token=Duel.CreateToken(tp,id+1) Duel.SpecialSummon(token,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent from the field to the Graveyard, you can add 1 Plant-Type monster with 1000 or less DEF from your Deck to your hand.
--ボタニティ・ガール --Botanical Girl local s,id=GetID() function s.initial_effect(c) --search local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_TO_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 e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.filter(c) return c:IsDefenseBelow(1000) and c:IsRace(RACE_PLANT) and c:IsAbleToHand() end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is destroyed by battle and sent to the Graveyard: You can Special Summon 1 WIND monster with 1500 or less ATK from your Deck, in face-up Attack Position.
--ドラゴンフライ --Flying Kamakiri #1 local s,id=GetID() function s.initial_effect(c) --special summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) end function s.filter(c,e,tp) return c:IsAttackBelow(1500) and c:IsAttribute(ATTRIBUTE_WIND) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_ATTACK) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card gains 100 ATK and DEF for each Tuner monster in your Graveyard. Once per turn: You can send 1 Tuner monster from your hand to the Graveyard, then target 1 monster your opponent controls; take control of it until the End Phase.
--獄落鳥 --Bird of Paradise Lost local s,id=GetID() function s.initial_effect(c) --atk & def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetValue(s.adval) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --control local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_CONTROL) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1) e3:SetCost(s.cost) e3:SetTarget(s.target) e3:SetOperation(s.operation) c:RegisterEffect(e3) end function s.adval(e,c) local tp=c:GetControler() return Duel.GetMatchingGroupCount(Card.IsType,tp,LOCATION_GRAVE,0,nil,TYPE_TUNER)*100 end function s.cfilter(c) return c:IsType(TYPE_TUNER) and c:IsAbleToGraveAsCost() end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) end Duel.DiscardHand(tp,s.cfilter,1,1,REASON_COST,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsControlerCanBeChanged() end if chk==0 then return Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp,PHASE_END,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a Psychic-Type monster(s) on the field would be destroyed, you can pay 500 LP and destroy this card instead.
--テレキアタッカー --Telekinetic Shocker local s,id=GetID() function s.initial_effect(c) --destroy replace local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_DESTROY_REPLACE) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.destg) e1:SetValue(s.value) e1:SetOperation(s.desop) c:RegisterEffect(e1) end function s.dfilter(c) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_PSYCHIC) and not c:IsReason(REASON_REPLACE) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not eg:IsContains(e:GetHandler()) and Duel.CheckLPCost(tp,500) and eg:IsExists(s.dfilter,1,nil) end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.PayLPCost(tp,500) return true else return false end end function s.value(e,c) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsRace(RACE_PSYCHIC) and not c:IsReason(REASON_REPLACE) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Destroy(e:GetHandler(),REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, or all monsters you control are "Windwitch" monsters, you can Normal Summon this card without Tributing. During your opponent's Main Phase, if you control a "Windwitch" monster other than "Windwitch - Blizzard Bell" (Quick Effect): You can send this card from your hand or field to the GY; inflict 500 damage to your opponent. You can only use this effect of "Windwitch - Blizzard Bell" once per turn.
--WW-ブリザード・ベル --Windwitch - Blizzard Bell --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Normal summon this without tributing local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.ntcon) e1:SetValue(1) c:RegisterEffect(e1) --Inflict 500 damage to opponent local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DAMAGE) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_MAIN_END) e2:SetRange(LOCATION_HAND|LOCATION_MZONE) e2:SetCost(Cost.SelfToGrave) e2:SetCondition(s.condition) e2:SetTarget(s.target) e2:SetOperation(s.operation) e2:SetCountLimit(1,id) c:RegisterEffect(e2) end s.listed_series={SET_WINDWITCH} s.listed_names={id} function s.filter(c) return c:IsFacedown() or not c:IsSetCard(SET_WINDWITCH) end function s.ntcon(e,c,minc,zone) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or not Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil)) end function s.cfilter(c) return c:IsSetCard(SET_WINDWITCH) and c:IsFaceup() and not c:IsCode(id) end --Check if it's opponent's main phase and player controls a "Windwitch" monster other than this card's name function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() end --Activation legality function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetTargetPlayer(1-tp) Duel.SetTargetParam(500) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,500) end --Inflict 500 damage to opponent function s.operation(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Damage(p,d,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "Supreme King Z-ARC": Destroy as many monsters you control as possible, except "Supreme King Z-ARC", and if you do, Special Summon up to 4 "Supreme King Dragon" monsters with different names from your hand, Deck, Extra Deck, and/or GY, ignoring their Summoning conditions. You can banish this card from your GY, then target 1 "Supreme King Dragon" Xyz Monster you control; attach 2 "Supreme King Dragon" monsters to it as materials, from your GY and/or face-up from your Extra Deck.
--覇王の逆鱗 --Supreme Rage local s,id=GetID() function s.initial_effect(c) --Destroy as many monsters you control as possible, and if you do, Special Summon up to 4 "Supreme King Dragon" monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Attach 2 "Supreme King Dragon" monsters to 1 "Supreme King Dragon" Xyz Monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.mattg) e2:SetOperation(s.matop) c:RegisterEffect(e2) end s.listed_series={SET_SUPREME_KING_DRAGON} s.listed_names={CARD_ZARC} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_ZARC),tp,LOCATION_ONFIELD,0,1,nil) end function s.spfilter(c,e,tp) if not (c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)) then return false end local g=Duel.GetMatchingGroup(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,nil) if c:IsLocation(LOCATION_EXTRA) then return Duel.GetLocationCountFromEx(tp,tp,g,c)>0 else return Duel.GetMZoneCount(tp,g)>0 end end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,nil) if chk==0 then return Duel.IsExistingMatchingCard(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,1,nil) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA) end function s.exfilter1(c) return c:IsLocation(LOCATION_EXTRA) and c:IsFacedown() and c:IsType(TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ) end function s.exfilter2(c) return c:IsLocation(LOCATION_EXTRA) and (c:IsType(TYPE_LINK) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM))) end function s.rescon(ft1,ft2,ft3,ft4,ft) return function(sg,e,tp,mg) local exnpct=sg:FilterCount(s.exfilter1,nil,LOCATION_EXTRA) local expct=sg:FilterCount(s.exfilter2,nil,LOCATION_EXTRA) local mct=sg:FilterCount(aux.NOT(Card.IsLocation),nil,LOCATION_EXTRA) local exct=sg:FilterCount(Card.IsLocation,nil,LOCATION_EXTRA) local groupcount=#sg local classcount=sg:GetClassCount(Card.GetCode) local res=ft3>=exnpct and ft4>=expct and ft1>=mct and ft>=groupcount and classcount==groupcount return res, not res end end function s.activate(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetMatchingGroup(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,nil) if Duel.Destroy(dg,REASON_EFFECT)==0 then return end local ft1=Duel.GetLocationCount(tp,LOCATION_MZONE) local ft2=Duel.GetLocationCountFromEx(tp) local ft3=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ) local ft4=Duel.GetLocationCountFromEx(tp,tp,nil,TYPE_PENDULUM+TYPE_LINK) local ft=math.min(Duel.GetUsableMZoneCount(tp),4) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then if ft1>0 then ft1=1 end if ft2>0 then ft2=1 end if ft3>0 then ft3=1 end if ft4>0 then ft4=1 end ft=1 end local ect=aux.CheckSummonGate(tp) if ect then ft1 = math.min(ect, ft1) ft2 = math.min(ect, ft2) ft3 = math.min(ect, ft3) ft4 = math.min(ect, ft4) end local loc=0 if ft1>0 then loc=loc|LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE end if ft2>0 or ft3>0 or ft4>0 then loc=loc|LOCATION_EXTRA end if loc==0 then return end local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,loc,0,nil,e,tp) if #sg==0 then return end local rg=aux.SelectUnselectGroup(sg,e,tp,1,ft,s.rescon(ft1,ft2,ft3,ft4,ft),1,tp,HINTMSG_SPSUMMON) Duel.SpecialSummon(rg,0,tp,tp,true,false,POS_FACEUP) end function s.xyzfilter(c,tp) return c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsType(TYPE_XYZ) and c:IsFaceup() and Duel.IsExistingMatchingCard(s.matfilter,tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,nil,tp,c) end function s.matfilter(c,tp,xyzc) return c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsMonster() and c:IsFaceup() and c:IsCanBeXyzMaterial(xyzc,tp,REASON_EFFECT) end function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc,tp) end if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) end function s.matop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.matfilter),tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,2,nil,tp,tc) if #g>0 then Duel.Overlay(tc,g) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Equip only to a Warrior-Type monster. Apply this effect, depending on its battle position. ● Attack Position: It gains ATK equal to its original DEF. ● Defense Position: It gains DEF equal to its original ATK.
--最強の盾 --Magnum Shield local s,id=GetID() function s.initial_effect(c) aux.AddEquipProcedure(c,nil,aux.FilterBoolFunction(Card.IsRace,RACE_WARRIOR)) --atk/def local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_EQUIP) e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(s.atkval) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_EQUIP) e3:SetCode(EFFECT_UPDATE_DEFENSE) e3:SetValue(s.defval) c:RegisterEffect(e3) end function s.atkval(e,c) if c:IsDefensePos() then return 0 else return c:GetBaseDefense() end end function s.defval(e,c) if c:IsAttackPos() then return 0 else return c:GetBaseAttack() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a card or effect is activated that targets your linked monster (Quick Effect): You can send this card from your hand or field to the GY; negate the activation, and if you do, destroy that card. You can banish this card from your GY, then target 1 Normal Monster in your GY; Special Summon it in Defense Position to your zone a Link Monster points to. You can only use this effect of "World Chalice Guardragon" once per turn.
--星杯の守護竜 --World Chalice Guardragon local s,id=GetID() function s.initial_effect(c) --Negate the activation of an effect that targets your linked monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) e1:SetCode(EVENT_CHAINING) e1:SetRange(LOCATION_HAND|LOCATION_MZONE) e1:SetCondition(s.negcon) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.negtg) e1:SetOperation(s.negop) c:RegisterEffect(e1) --Special Summon 1 Normal Monster from your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.cfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsLinked() end function s.negcon(e,tp,eg,ep,ev,re,r,rp) if not re:IsHasProperty(EFFECT_FLAG_CARD_TARGET) then return false end local g=Duel.GetChainInfo(ev,CHAININFO_TARGET_CARDS) return g:IsExists(s.cfilter,1,nil,tp) and Duel.IsChainNegatable(ev) end function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local rc=re:GetHandler() if rc:IsRelateToEffect(re) and rc:IsDestructable() then Duel.SetOperationInfo(0,CATEGORY_DESTROY,eg,1,0,0) end end function s.negop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) and re:GetHandler():IsRelateToEffect(re) then Duel.Destroy(eg,REASON_EFFECT) end end function s.spfilter(c,e,tp,zone) return c:IsType(TYPE_NORMAL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,tp,zone) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local zone=aux.GetMMZonesPointedTo(tp) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_GRAVE) and s.spfilter(chkc,e,tp,zone) end if chk==0 then return zone>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler(),e,tp,zone) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tg=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,zone) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local zone=aux.GetMMZonesPointedTo(tp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and zone>0 then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE,zone) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is Normal or Special Summoned: You can add 1 Level 8 Reptile monster from your Deck to your hand. If this card is banished: You can target 1 Reptile monster you control; it cannot be destroyed by card effects until the end of the next turn. You can only use each effect of "Lamia" once per turn.
--ラミア --Lamia --Scripted by the Razgriz local s,id=GetID() function s.initial_effect(c) --Add Level 8 Reptile from Deck 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_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Targeted Reptile monster cannot be destroyed by card effects local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_REMOVE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.indtg) e3:SetOperation(s.indop) c:RegisterEffect(e3) end function s.thfilter(c) return c:IsLevel(8) and c:IsRace(RACE_REPTILE) 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.indfilter(c) return c:IsFaceup() and c:IsRace(RACE_REPTILE) end function s.indtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.indfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.indfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,s.indfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.indop(e,tp,eg,ep,ev,re,r,rp,chk) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then --Cannot be destroyed by card effects local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3001) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) e1:SetRange(LOCATION_MZONE) e1:SetValue(1) e1:SetReset(RESETS_STANDARD_PHASE_END,2) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control no monsters, or all monsters you control are Warrior monsters, you can Normal Summon this card without Tributing. If your EARTH Warrior monster battles, after damage calculation: You can target 1 Spell/Trap your opponent controls; destroy it, then all "War Rock" monsters you currently control gain 200 ATK until the end of your opponent's turn. You can only use this effect of "War Rock Mammud" once per turn.
--ウォークライ・マムード --War Rock Mammud --scripted by XyleN local s,id=GetID() function s.initial_effect(c) --Normal Summon without Tributing local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SUMMON_PROC) e1:SetCondition(s.sumcon) e1:SetValue(1) c:RegisterEffect(e1) --Destroy 1 Spell/Trap & "War Rock" gains 200 ATK local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e2:SetCode(EVENT_BATTLED) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(s.descon) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) end s.listed_series={SET_WAR_ROCK} function s.cfilter(c) return c:IsFacedown() or not c:IsRace(RACE_WARRIOR) end function s.sumcon(e,c,minc,zone) if c==nil then return true end local tp=c:GetControler() return minc==0 and c:GetLevel()>4 and Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone)>0 and (Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 or not Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil)) end function s.descon(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetBattleMonster(tp) return bc and bc:IsAttribute(ATTRIBUTE_EARTH) and bc:IsRace(RACE_WARRIOR) end function s.atkfilter(c) return c:IsSetCard(SET_WAR_ROCK) and c:IsFaceup() and not c:IsStatus(STATUS_BATTLE_DESTROYED) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsOnField() and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,nil) and Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then local atkg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) if #atkg==0 then return end Duel.BreakEffect() local c=e:GetHandler() for tc in atkg:Iter() do --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END|RESET_OPPO_TURN) e1:SetValue(200) tc:RegisterEffect(e1) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Special Summons a monster(s) (Quick Effect): You can Tribute 1 other face-up "Naturia" monster you control; destroy that monster(s).
--ナチュル・ホーストニードル --Naturia Horneedle local s,id=GetID() function s.initial_effect(c) --Destroy Special Summoned monster(s) local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCost(aux.CostWithReplace(s.descost,CARD_NATURIA_CAMELLIA)) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) end s.listed_series={SET_NATURIA} function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.CheckReleaseGroupCost(tp,aux.FaceupFilter(Card.IsSetCard,SET_NATURIA),1,false,nil,c) end local g=Duel.SelectReleaseGroupCost(tp,aux.FaceupFilter(Card.IsSetCard,SET_NATURIA),1,1,false,nil,c) Duel.Release(g,REASON_COST) end function s.desfilter(c,e,tp) return c:IsSummonPlayer(1-tp) and (not e or c:IsRelateToEffect(e)) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g=eg:Filter(s.desfilter,nil,nil,tp) if chk==0 then return #g>0 and not c:IsStatus(STATUS_CHAINING) and not eg:IsContains(c) end Duel.SetTargetCard(eg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.desfilter,nil,e,tp) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card attacks, it is changed to Defense Position at the end of the Damage Step.
--アックス・ドラゴニュート --Axe Dragonute local s,id=GetID() function s.initial_effect(c) --to defense local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetCondition(s.poscon) e1:SetOperation(s.posop) c:RegisterEffect(e1) end function s.poscon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler()==Duel.GetAttacker() and e:GetHandler():IsRelateToBattle() 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
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Increase your Life Points by 3000 points. When this card is sent from the field to the Graveyard, you lose 5000 Life Points.
--雷仙人 --The Immortal of Thunder local s,id=GetID() function s.initial_effect(c) --Register a flag to this card when it is flipped face-up local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e0:SetCode(EVENT_FLIP) e0:SetOperation(function(e) e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1) end) c:RegisterEffect(e0) --Gain 3000 LP if it is flipped face-up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_RECOVER) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetOperation(function(_,tp) Duel.Recover(tp,3000,REASON_EFFECT) end) c:RegisterEffect(e1) --Lose 5000 LP when it is sent to the GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(function(e) return e:GetLabel()>0 end) e2:SetOperation(s.lpop) c:RegisterEffect(e2) --Enable the effect above when it is about to leave the field if it was flipped face-up local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e3:SetCode(EVENT_LEAVE_FIELD_P) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e3:SetOperation(s.regop) e3:SetLabelObject(e2) c:RegisterEffect(e3) end function s.lpop(e,tp,eg,ep,ev,re,r,rp) Duel.SetLP(tp,Duel.GetLP(tp)-5000) end function s.regop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():HasFlagEffect(id) then e:GetLabelObject():SetLabel(1) else e:GetLabelObject():SetLabel(0) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: When this card is destroyed and sent to the Graveyard this turn: Special Summon it from the Graveyard in face-up Defense Position.
--ワーム・ジェートリクプス --Worm Jetelikpse local s,id=GetID() function s.initial_effect(c) --flip effect local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_FLIP) e1:SetOperation(s.flipop) c:RegisterEffect(e1) --special summon local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_TO_GRAVE) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.flipop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) then c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD_EXC_GRAVE|RESET_PHASE|PHASE_END,0,1) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():GetFlagEffect(id)~=0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SpecialSummon(e:GetHandler(),0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control "King's Sarcophagus", you can Special Summon this card (from your GY). You can only Special Summon "Imsety, Glory of Horus" once per turn this way. You can only use each of the following effects of "Imsety, Glory of Horus" once per turn. You can send 2 cards from your hand to the GY, including this card; add 1 "King's Sarcophagus" from your Deck to your hand, then you can draw 1 card. If another card(s) you control leaves the field by an opponent's card effect, while this card is in your Monster Zone (except during the Damage Step): You can send 1 card on the field to the GY.
--ホルスの栄光-イムセティ --Imsety, Glory of Horus --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon itself from the GY if you control "King's Sarcophagus" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_SPSUMMON_PROC) e1:SetRange(LOCATION_GRAVE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) c:RegisterEffect(e1) --Search 1 "King's Sarcophagus" and draw 1 card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,{id,1}) e2:SetCost(s.thcost) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --Send 1 card on the field to the GY local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOGRAVE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e3:SetCode(EVENT_LEAVE_FIELD) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.tgcon) e3:SetTarget(s.tgtg) e3:SetOperation(s.tgop) c:RegisterEffect(e3) end s.listed_names={CARD_KING_SARCOPHAGUS} function s.spcon(e,c) if c==nil then return true end local eff={c:GetCardEffect(EFFECT_NECRO_VALLEY)} for _,te in ipairs(eff) do local op=te:GetOperation() if not op or op(e,c) then return false end end local tp=c:GetControler() return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,CARD_KING_SARCOPHAGUS),tp,LOCATION_ONFIELD,0,1,nil) end function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToGraveAsCost() and Duel.IsExistingMatchingCard(Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGraveAsCost,tp,LOCATION_HAND,0,1,1,c) g:AddCard(c) Duel.SendtoGrave(g,REASON_COST) end function s.thfilter(c) return c:IsCode(CARD_KING_SARCOPHAGUS) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_DRAW,nil,1,tp,1) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 and Duel.SendtoHand(g,nil,REASON_EFFECT)>0 then Duel.ConfirmCards(1-tp,g) Duel.ShuffleHand(tp) if Duel.IsPlayerCanDraw(tp,1) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.ShuffleDeck(tp) Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end end function s.cfilter(c,tp) return c:IsPreviousLocation(LOCATION_ONFIELD) and c:IsPreviousControler(tp) and c:IsReason(REASON_EFFECT) and c:GetReasonPlayer()==1-tp end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.cfilter,1,nil,tp) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_ONFIELD) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToGrave,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) if #g>0 then Duel.HintSelection(g,true) Duel.SendtoGrave(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can remove from play 1 face-up Beast-Type or Beast-Warrior-Type monster you control to select 1 other face-up Beast-Type or Beast-Warrior-Type monster you control. The selected monster gains the original ATK of the monster removed from play for this effect.
--ビーストライザー --Beast Rising 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) --Increase the ATK of 1 Beast or Beast-Warrior monster you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) e1:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMING_END_PHASE) e1:SetCountLimit(1) e1:SetCondition(function() return not (Duel.IsPhase(PHASE_DAMAGE) and Duel.IsDamageCalculated()) end) e1:SetCost(s.atkcost) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end function s.atkcostfilter(c,tp) return c:IsRace(RACE_BEAST|RACE_BEASTWARRIOR) and c:IsFaceup() and c:IsAbleToRemoveAsCost() and c:GetTextAttack()>0 and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsRace,RACE_BEAST|RACE_BEASTWARRIOR),tp,LOCATION_MZONE,0,1,c) end function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.atkcostfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.atkcostfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) e:SetLabel(g:GetFirst():GetTextAttack()) 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_BEAST|RACE_BEASTWARRIOR) end if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsRace,RACE_BEAST|RACE_BEASTWARRIOR),tp,LOCATION_MZONE,0,1,1,nil) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsControler(tp) and tc:IsRace(RACE_BEAST|RACE_BEASTWARRIOR) then --Gains ATK equal to the original ATK of the monster banished to activate this effect local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(e:GetLabel()) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent would Normal or Special Summons a monster(s), while you control a Ritual Monster: Negate the Summon, and if you do, shuffle that monster into the Deck. You can only activate 1 "Drytron Meteor Shower" per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--ドライトロン流星群 --Drytron Meteor Shower --Scripted by Naim local s,id=GetID() function s.initial_effect(c) --Negate and summon local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DISABLE_SUMMON+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON) c:RegisterEffect(e2) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCurrentChain(true)==0 and eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRitualMonster),tp,LOCATION_MZONE,0,1,nil) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=eg:Filter(Card.IsControler,nil,1-tp) Duel.SetOperationInfo(0,CATEGORY_DISABLE_SUMMON,g,#g,0,0) local g2=g:Filter(Card.IsPreviousLocation,nil,LOCATION_EXTRA) if #g2>0 then Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,g2,#g2,0,0) end Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(Card.IsSummonPlayer,nil,1-tp) Duel.NegateSummon(g) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Send the top 5 cards of your Deck to the GY.
--針虫の巣窟 --Needlebug Nest local s,id=GetID() function s.initial_effect(c) --discard deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCategory(CATEGORY_DECKDES) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetTarget(s.distarget) e1:SetOperation(s.disop) c:RegisterEffect(e1) end function s.distarget(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDiscardDeck(tp,5) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(5) Duel.SetOperationInfo(0,CATEGORY_DECKDES,nil,0,tp,5) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local p,val=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.DiscardDeck(p,val,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each time a Spell Card is activated, immediately after it resolves, the player that activated it takes 1000 damage.
--暗黒の呪縛 --Curse of Darkness 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:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_SZONE) e2:SetOperation(aux.chainreg) c:RegisterEffect(e2) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetCode(EVENT_CHAIN_SOLVED) e3:SetRange(LOCATION_SZONE) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=re:GetHandler() if re:IsHasType(EFFECT_TYPE_ACTIVATE) and re:IsSpellEffect() and e:GetHandler():GetFlagEffect(1)>0 then Duel.Damage(rp,1000,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card is in the GY and you control no cards: You can Special Summon both this card, and 1 Level 4 or lower Dragon monster from your hand, in Defense Position, but banish this card when it leaves the field. You can only use this effect of "Background Dragon" once per turn.
--バックグランド・ドラゴン --Background Dragon local s,id=GetID() function s.initial_effect(c) --Special summon itself (GY) and 1 level 4 or lower dragon monster (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_GRAVE) e1:SetCountLimit(1,id) 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.GetFieldGroupCount(tp,LOCATION_ONFIELD,0)==0 end function s.filter(c,e,tp) return c:IsLevelBelow(4) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,e:GetHandler(),e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),2,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,c,e,tp) if #g>0 then g:AddCard(c) if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Banish it if it leaves the field local e1=Effect.CreateEffect(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 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 "Melodious Maestra" monster + 1 "Melodious" monster Cannot be destroyed by battle or card effects, also you take no battle damage from attacks involving this card. If this card battles a Special Summoned monster, after damage calculation: You can inflict damage to your opponent equal to the difference between the original ATK of that opponent's monster and this card, and if you do, destroy that opponent's monster.
--幻奏の華歌聖ブルーム・ディーヴァ --Bloom Diva the Melodious Choir local s,id=GetID() function s.initial_effect(c) --fusion material c:EnableReviveLimit() Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_MELODIOUS_MAESTRA),aux.FilterBoolFunctionEx(Card.IsSetCard,SET_MELODIOUS)) --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_BATTLE) e1:SetValue(1) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_INDESTRUCTABLE_EFFECT) c:RegisterEffect(e2) --avoid battle damage local e3=e1:Clone() e3:SetCode(EFFECT_AVOID_BATTLE_DAMAGE) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_BATTLED) e4:SetCondition(s.condition) e4:SetTarget(s.target) e4:SetOperation(s.operation) c:RegisterEffect(e4) end s.listed_series={SET_MELODIOUS_MAESTRA,SET_MELODIOUS} s.material_setcode={SET_MELODIOUS,SET_MELODIOUS_MAESTRA} function s.condition(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local bc=c:GetBattleTarget() return bc and (bc:GetSummonType()&SUMMON_TYPE_SPECIAL)==SUMMON_TYPE_SPECIAL and c:GetBaseAttack()~=bc:GetBaseAttack() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return bc:IsRelateToBattle() end local atk=math.abs(e:GetHandler():GetBaseAttack()-bc:GetBaseAttack()) Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk) Duel.SetOperationInfo(0,CATEGORY_DESTROY,bc,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local bc=Duel.GetFirstTarget() if not bc then return false end local atk=math.abs(e:GetHandler():GetBaseAttack()-bc:GetBaseAttack()) if bc:IsRelateToEffect(e) and bc:IsFaceup() and Duel.Damage(1-tp,atk,REASON_EFFECT)~=0 then Duel.Destroy(bc,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 or more Level 7 LIGHT Insect-Type monsters You can also Xyz Summon this card by detaching 2 Xyz Materials from a Rank 5 or 6 Insect-Type Xyz Monster you control, then using that Xyz Monster as the Xyz Material. (Xyz Materials attached to that monster also become Xyz Materials on this card.) If this card attacks a Defense Position monster, inflict piercing battle damage to your opponent. Once per turn, during either player's turn: You can detach 1 Xyz Material from this card; destroy the face-up monster(s) your opponent controls with the highest DEF (all, if tied).
--電子光虫-ライノセバス --Digital Bug Rhinosebus local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Xyz.AddProcedure(c,s.mfilter,7,2,s.ovfilter,aux.Stringid(id,0),Xyz.InfiniteMats,s.xyzop) --destroy local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(Cost.DetachFromSelf(1)) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) -- local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_PIERCE) c:RegisterEffect(e3) end function s.ovfilter(c,tp,xyzc) return c:IsFaceup() and c:IsType(TYPE_XYZ,xyzc,SUMMON_TYPE_XYZ,tp) and (c:GetRank()==5 or c:GetRank()==6) and c:IsRace(RACE_INSECT,xyzc,SUMMON_TYPE_XYZ,tp) end function s.xyzop(e,tp,chk,mc) if chk==0 then return mc:CheckRemoveOverlayCard(tp,2,REASON_COST) end mc:RemoveOverlayCard(tp,2,2,REASON_COST) return true end function s.mfilter(c,xyz,sumtype,tp) return c:IsRace(RACE_INSECT,xyz,sumtype,tp) and c:IsAttribute(ATTRIBUTE_LIGHT,xyz,sumtype,tp) end function s.desfilter(c) return c:IsFaceup() and c:IsDefenseAbove(0) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,0,LOCATION_MZONE,1,nil) end local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) local dg=g:GetMaxGroup(Card.GetDefense) Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil) if #g>0 then local dg=g:GetMaxGroup(Card.GetDefense) Duel.Destroy(dg,REASON_EFFECT) end end