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:
Once per turn, if your "Ursarctic" monster would Tribute a monster(s) to activate its effect, you can banish 1 Level 7 or higher "Ursarctic" monster from your GY instead. Each time a monster(s) is Special Summoned, place 1 counter on this card. Once per turn, if a monster(s) is Special Summoned and an "Ursarctic" Synchro Monster is on the field (except during the Damage Step): You can remove all counters from this card (min. 7), then target 1 monster your opponent controls; take control of it.
--ベアルクティ・ビッグディッパー --Ursarctic Big Dipper --Scripted by Eerie Code local s,id=GetID() local COUNTER_BIG_DIPPER=0x204 function s.initial_effect(c) c:EnableCounterPermit(COUNTER_BIG_DIPPER) --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e0) --Once per turn, if your "Ursarctic" monster would Tribute a monster(s) to activate its effect, you can banish 1 Level 7 or higher "Ursarctic" monster from your GY instead local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(CARD_URSARCTIC_BIG_DIPPER) e1:SetRange(LOCATION_FZONE) e1:SetTargetRange(1,0) e1:SetCountLimit(1) e1:SetCondition(s.repcon) e1:SetValue(s.repval) e1:SetOperation(s.repop) c:RegisterEffect(e1) --Each time a monster(s) is Special Summoned, place 1 counter on this card local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) e2:SetOperation(function(e) e:GetHandler():AddCounter(COUNTER_BIG_DIPPER,1) end) c:RegisterEffect(e2) --Take control of 1 monster your opponent controls local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_CONTROL) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_SPSUMMON_SUCCESS) e3:SetRange(LOCATION_FZONE) e3:SetCountLimit(1) e3:SetCost(s.ctrlcost) e3:SetTarget(s.ctrltg) e3:SetOperation(s.ctrlop) c:RegisterEffect(e3) end s.listed_series={SET_URSARCTIC} s.counter_place_list={COUNTER_BIG_DIPPER} function s.repconfilter(c,extracon,base,e,tp,eg,ep,ev,re,r,rp) return c:IsLevelAbove(7) and c:IsSetCard(SET_URSARCTIC) and c:IsAbleToRemoveAsCost() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp,c)) end function s.repcon(e) return Duel.IsExistingMatchingCard(s.repconfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil) end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() return c:IsSetCard(SET_URSARCTIC) and c:IsMonster() and (extracon==nil or Duel.IsExistingMatchingCard(s.repconfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.repconfilter,tp,LOCATION_GRAVE,0,1,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_REPLACE) end function s.ctrlcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanRemoveCounter(tp,COUNTER_BIG_DIPPER,7,REASON_COST) end c:RemoveCounter(tp,COUNTER_BIG_DIPPER,c:GetCounter(COUNTER_BIG_DIPPER),REASON_COST) end function s.ctrlconfilter(c) return c:IsSetCard(SET_URSARCTIC) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() end function s.ctrltg(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.IsExistingMatchingCard(s.ctrlconfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) and 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,tp,0) end function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner + 1+ non-Tuner "Mist Valley" monsters Once per turn (Quick Effect): You can target 1 other card you control; return that target to the hand, and if you do, this card gains 500 ATK until the end of this turn.
--霞の谷の雷神鬼 --Mist Valley Thunder Lord local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsSetCard,SET_MIST_VALLEY),1,99) --Return to hand and increase ATK local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+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_MZONE) e1:SetCountLimit(1) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_MIST_VALLEY} function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsAbleToHand() and chkc~=c end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_ONFIELD,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or Duel.SendtoHand(tc,nil,REASON_EFFECT)==0 or not tc:IsLocation(LOCATION_HAND) then return end local c=e:GetHandler() if c:IsFacedown() or not c:IsRelateToEffect(e) then return end --Increase ATK local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can reveal 1 Fusion Monster from your Extra Deck, then send 1 of the Fusion Materials whose name is specifically listed on that card from your Deck to the Graveyard; this card's name becomes the sent monster's until the End Phase.
--E・HERO プリズマー --Elemental HERO Prisma local s,id=GetID() function s.initial_effect(c) --cos local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetCountLimit(1) e1:SetRange(LOCATION_MZONE) e1:SetCost(s.coscost) e1:SetOperation(s.cosoperation) c:RegisterEffect(e1) end function s.filter2(c,fc) if not c:IsAbleToGraveAsCost() then return false end return c:IsCode(table.unpack(fc.material)) end function s.filter1(c,tp) return c.material and c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_DECK,0,1,nil,c) end function s.coscost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_EXTRA,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_EXTRA,0,1,1,nil,tp) Duel.ConfirmCards(1-tp,g) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local cg=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_DECK,0,1,1,nil,g:GetFirst()) Duel.SendtoGrave(cg,REASON_COST) e:SetLabel(cg:GetFirst():GetCode()) end function s.cosoperation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or c:IsFacedown() then return end local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_CODE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(e:GetLabel()) c:RegisterEffect(e1) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can target 1 face-down monster you control; change it to face-up Attack or Defense Position. You can shuffle 1 "Krawler" monster from your GY into the Main Deck, then target 1 face-up monster you control; change it to face-down Defense Position. You can only use 1 "World Legacy Pawns" effect per turn, and only once that turn.
--星遺物の傀儡 --World Legacy Pawns local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetHintTiming(TIMING_END_PHASE) c:RegisterEffect(e1) --pos (face-down) local e2=Effect.CreateEffect(c) e2:SetCategory(CATEGORY_POSITION) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_SZONE) e2:SetHintTiming(TIMING_END_PHASE) e2:SetCost(s.cost) e2:SetTarget(s.postg1) e2:SetOperation(s.posop1) c:RegisterEffect(e2) --pos (face-up) local e3=e2:Clone() e3:SetDescription(aux.Stringid(id,1)) e3:SetCost(s.poscost) e3:SetTarget(s.postg2) e3:SetOperation(s.posop2) c:RegisterEffect(e3) end s.listed_series={SET_KRAWLER} function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetFlagEffect(tp,id)==0 end Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then if e:GetLabel()==0 then return s.postg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) else return s.postg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) end end if chk==0 then return true end local b1=s.cost(e,tp,eg,ep,ev,re,r,rp,0) and s.postg1(e,tp,eg,ep,ev,re,r,rp,0) local b2=s.poscost(e,tp,eg,ep,ev,re,r,rp,0) and s.postg2(e,tp,eg,ep,ev,re,r,rp,0) if (b1 or b2) and Duel.SelectYesNo(tp,94) then local op=0 if b1 and b2 then op=Duel.SelectOption(tp,aux.Stringid(id,0),aux.Stringid(id,1)) elseif b1 then op=Duel.SelectOption(tp,aux.Stringid(id,0)) else op=Duel.SelectOption(tp,aux.Stringid(id,1))+1 end e:SetLabel(op) e:SetProperty(EFFECT_FLAG_CARD_TARGET) if op==0 then s.cost(e,tp,eg,ep,ev,re,r,rp,1) s.postg1(e,tp,eg,ep,ev,re,r,rp,1) e:SetOperation(s.posop1) else s.poscost(e,tp,eg,ep,ev,re,r,rp,1) s.postg2(e,tp,eg,ep,ev,re,r,rp,1) e:SetOperation(s.posop2) end else e:SetProperty(0) e:SetOperation(nil) end end function s.postg1(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFacedown() end if chk==0 then return Duel.IsExistingTarget(Card.IsFacedown,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,Card.IsFacedown,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabel(0) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.posop1(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) and tc:IsFacedown() then local pos1=0 if not tc:IsPosition(POS_FACEUP_ATTACK) then pos1=pos1+POS_FACEUP_ATTACK end if not tc:IsPosition(POS_FACEUP_DEFENSE) then pos1=pos1+POS_FACEUP_DEFENSE end local pos2=Duel.SelectPosition(tp,tc,pos1) Duel.ChangePosition(tc,pos2) end end function s.cfilter(c) return c:IsSetCard(SET_KRAWLER) and c:IsMonster() and c:IsAbleToDeckAsCost() end function s.poscost(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.cfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_COST) s.cost(e,tp,eg,ep,ev,re,r,rp,1) end function s.posfilter(c) return c:IsFaceup() and c:IsCanTurnSet() end function s.postg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.posfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.posfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.posfilter,tp,LOCATION_MZONE,0,1,1,nil) e:SetLabel(1) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,0,0) end function s.posop2(e,tp,eg,ep,ev,re,r,rp) if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() if tc and tc:IsFaceup() and tc:IsRelateToEffect(e) then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned: You can target 1 Tuner monster in either player's Graveyard; Special Summon it to your side of the field, and if you do, immediately after this effect resolves, Synchro Summon 1 WIND Synchro Monster, using that monster and this card only.
--SRオハジキッド --Speedroid Ohajikid 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:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.filter(c,e,tp,mc) local mg=Group.FromCards(c,mc) return c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,nil,mg) end function s.scfilter(c,mg) return c:IsAttribute(ATTRIBUTE_WIND) and c:IsSynchroSummonable(nil,mg) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and s.filter(chkc,e,tp,e:GetHandler()) end if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end local c=e:GetHandler() local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) or Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP)==0 then return end if not c:IsRelateToEffect(e) then return end local mg=Group.FromCards(c,tc) local g=Duel.GetMatchingGroup(s.scfilter,tp,LOCATION_EXTRA,0,nil,mg) if #g>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SynchroSummon(tp,sg:GetFirst(),nil,mg) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Draw cards equal to the number of cards your opponent controls, then place cards from your hand on the bottom of the Deck in any order, equal to the number of cards you drew. During the End Phase, if your opponent controls more cards than you do while this card is in your GY: You can Set this card, but banish it when it leaves the field. You can only use 1 "Backup Team" effect per turn, and only once that turn.
--補強要員 --Backup Team --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Draw cards then return cards to the Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DRAW+CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --Set itself but banish it when it leaves the field local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetHintTiming(TIMING_END_PHASE) e2:SetCountLimit(1,id) e2:SetCondition(s.setcon) e2:SetTarget(s.settg) e2:SetOperation(s.setop) c:RegisterEffect(e2) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD) if chk==0 then return Duel.IsPlayerCanDraw(tp,ct) end Duel.SetTargetPlayer(tp) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,ct) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,ct,tp,LOCATION_HAND) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local p=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER) local ct=Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD) if Duel.Draw(p,ct,REASON_EFFECT)==ct then local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,p,LOCATION_HAND,0,nil) if #g==0 then return end Duel.Hint(HINT_SELECTMSG,p,HINTMSG_TODECK) local sg=g:Select(p,ct,ct,nil) Duel.BreakEffect() if Duel.SendtoDeck(sg,nil,SEQ_DECKBOTTOM,REASON_EFFECT)==0 then return end local rt=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_DECK) if rt>0 then Duel.SortDeckbottom(p,p,rt) end end end function s.setcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsPhase(PHASE_END) and Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0) end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsSSetable() end Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,0,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsSSetable() and Duel.SSet(tp,c) 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) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If this card would be destroyed by battle or card effect, you can destroy 1 "Genex Controller" in your Monster Zone instead. * The above text is unofficial and describes the card's functionality in the OCG.
--ジェネクス・ガイア --Genex Gaia local s,id=GetID() function s.initial_effect(c) --Destroy replace local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetTarget(s.desreptg) e2:SetOperation(s.desrepop) c:RegisterEffect(e2) end s.listed_names={68505803} function s.repfilter(c,e) return c:IsFaceup() and c:IsCode(68505803) and c:IsDestructable(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED) end function s.desreptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return not c:IsReason(REASON_REPLACE) and c:IsOnField() and c:IsFaceup() and Duel.IsExistingMatchingCard(s.repfilter,tp,LOCATION_MZONE,0,1,c,e) end if Duel.SelectEffectYesNo(tp,c,96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local g=Duel.SelectMatchingCard(tp,s.repfilter,tp,LOCATION_MZONE,0,1,1,c,e) e:SetLabelObject(g:GetFirst()) g:GetFirst():SetStatus(STATUS_DESTROY_CONFIRMED,true) return true else return false end end function s.desrepop(e,tp,eg,ep,ev,re,r,rp) local tc=e:GetLabelObject() tc:SetStatus(STATUS_DESTROY_CONFIRMED,false) Duel.Destroy(tc,REASON_EFFECT|REASON_REPLACE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
"The Weather" Effect Monsters in your Main Monster Zones of this card's column and its adjacent columns gain this effect. ● You can banish this card, then target 1 monster you control (Quick Effect); Tribute that target, and if you do, Special Summon 1 "The Weather" monster from your hand or GY, but not with the same name the Tributed monster had on the field. You can only control 1 "The Weather Sunny Canvas".
--晴れの天気模様 --The Weather Sunny Canvas local s,id=GetID() function s.initial_effect(c) c:SetUniqueOnField(1,0,id) --Activate local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) --effect gain local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCost(s.announcecost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_GRANT) e3:SetRange(LOCATION_SZONE) e3:SetTargetRange(LOCATION_MZONE,0) e3:SetTarget(s.eftg) e3:SetLabelObject(e2) c:RegisterEffect(e3) end s.listed_series={SET_THE_WEATHER} function s.eftg(e,c) local g=e:GetHandler():GetColumnGroup(1,1) return c:IsType(TYPE_EFFECT) and c:IsSetCard(SET_THE_WEATHER) and c:GetSequence()<5 and g:IsContains(c) end function s.spcfilter(c,e,tp,ft) return c:IsReleasableByEffect() and (ft>0 or c:GetSequence()<5) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp,c:GetCode()) end function s.spfilter(c,e,tp,code) return c:IsSetCard(SET_THE_WEATHER) and not c:IsCode(code) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.announcecost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk) end Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,chk) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.spcfilter(chkc,e,tp,ft) end if chk==0 then return Duel.IsExistingTarget(s.spcfilter,tp,LOCATION_MZONE,0,1,e:GetHandler(),e,tp,ft) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RELEASE) Duel.SelectTarget(tp,s.spcfilter,tp,LOCATION_MZONE,0,1,1,e:GetHandler(),e,tp,ft) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsControler(tp) and tc:IsRelateToEffect(e) and Duel.Release(tc,REASON_EFFECT)>0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp,tc:GetCode()) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can either: Target 1 Effect Monster you control; equip this card to that target, OR: Unequip this card and Special Summon it. If the equipped monster would be destroyed by battle or card effect, destroy this card instead. You can return this card equipped to a monster to your hand; equip 1 appropriate, banished Union monster to 1 monster you control as an Equip Spell, as if it were equipped by that Union monster's effect, and if you do, Special Summon this card from your hand. You can only use this effect of "Union Pilot" once per turn.
--ユニオン・パイロット --Union Pilot --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Union procedure aux.AddUnionProcedure(c,aux.FilterBoolFunction(Card.IsType,TYPE_EFFECT)) --Equip 1 banished Union monster to an appropriate monster you control and Special Summon this card from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_SZONE) e1:SetCountLimit(1,id) e1:SetCondition(function(e) return e:GetHandler():IsEquipCard() end) e1:SetCost(s.eqcost) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) end s.listed_card_types={TYPE_UNION} function s.eqcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsAbleToHandAsCost() end Duel.SendtoHand(c,nil,REASON_COST) c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_CHAIN,0,1) end function s.equnionfilter(c,tp) return c:IsType(TYPE_UNION) and c:IsFaceup() and Duel.IsExistingMatchingCard(s.eqtargetfilter,tp,LOCATION_MZONE,0,1,nil,c) end function s.eqtargetfilter(c,ec) return ec:CheckUnionTarget(c) and aux.CheckUnionEquip(ec,c) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.equnionfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil,tp) and Duel.IsPlayerCanSpecialSummonMonster(tp,id,0,e:GetHandler():GetOriginalType(),2100,1000,5,RACE_MACHINE,ATTRIBUTE_LIGHT) end Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_REMOVED) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,s.equnionfilter,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil,tp):GetFirst() if not ec then return end Duel.HintSelection(ec) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP) local tc=Duel.SelectMatchingCard(tp,s.eqtargetfilter,tp,LOCATION_MZONE,0,1,1,nil,ec):GetFirst() if not tc then return end Duel.HintSelection(tc) if Duel.Equip(tp,ec,tc) then aux.SetUnionState(ec) local c=e:GetHandler() if c:HasFlagEffect(id) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card is treated as a Normal Monster while face-up on the field or in the Graveyard. While this card is a Normal Monster on the field, you can Normal Summon it to have it become an Effect Monster with these effects. ● This card becomes EARTH Dinosaur-Type. When this card destroys an opponent's monster by battle and sends it to the Graveyard: You can Special Summon that monster to your field in Defense Position, and if you do, it becomes Zombie-Type.
--ナチュラル・ボーン・サウルス --Skelesaurus local s,id=GetID() function s.initial_effect(c) Gemini.AddProcedure(c) --Becomes EARTH Dinosaur monster local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetCode(EFFECT_CHANGE_ATTRIBUTE) e1:SetRange(LOCATION_MZONE) e1:SetCondition(Gemini.EffectStatusCondition) e1:SetValue(ATTRIBUTE_EARTH) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CHANGE_RACE) e2:SetValue(RACE_DINOSAUR) c:RegisterEffect(e2) --Special Summon destroyed monster local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_BATTLE_DESTROYING) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) if not Gemini.EffectStatusCondition(e) then return false end local c=e:GetHandler() if not c:IsRelateToBattle() or c:IsFacedown() then return false end local bc=c:GetBattleTarget() return bc and bc:IsLocation(LOCATION_GRAVE) and bc:IsMonster() end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local bc=e:GetHandler():GetBattleTarget() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and bc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end Duel.SetTargetCard(bc) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,bc,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP_DEFENSE)>0 then --Treated as a Zombie monster local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_RACE) e1:SetValue(RACE_ZOMBIE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Pay 2000 LP and Tribute 1 Warrior monster; banish up to 3 "Legendary Dragon" Spells with different names from your hand and/or GY, and if you do, Special Summon that many "Legendary Knight" monsters with different names from your hand, Deck, and/or GY. You can only activate 1 "Legend of Heart" per turn.
--レジェンド・オブ・ハート --Legend of Heart local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_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_LEGENDARY_DRAGON,SET_LEGENDARY_KNIGHT} function s.cfilter(c,tp) return c:IsRace(RACE_WARRIOR) and Duel.GetMZoneCount(tp,c)>0 end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) e:SetLabel(1) if chk==0 then return Duel.CheckLPCost(tp,2000) and Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,tp) end Duel.PayLPCost(tp,2000) local sg=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,tp) Duel.Release(sg,REASON_COST) end function s.rmfilter(c) return c:IsSetCard(SET_LEGENDARY_DRAGON) and c:IsSpell() and c:IsAbleToRemove() end function s.spfilter(c,e,tp) return c:IsSetCard(SET_LEGENDARY_KNIGHT) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if e:GetLabel()==0 and Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end e:SetLabel(0) return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE|LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE|LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<=0 then return end local rmg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.rmfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,nil) if #rmg==0 then return end local rmct=rmg:GetClassCount(Card.GetCode) local spg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE|LOCATION_DECK,0,nil,e,tp) if #spg==0 then return end local spct=spg:GetClassCount(Card.GetCode) local ct=math.min(3,ft,spct,rmct) if ct==0 then return end local g=aux.SelectUnselectGroup(rmg,e,tp,1,ct,aux.dncheck,1,tp,HINTMSG_REMOVE) if #g==0 or Duel.Remove(g,POS_FACEUP,REASON_EFFECT)==0 then return end ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_REMOVED) local sg=aux.SelectUnselectGroup(spg,e,tp,ct,ct,aux.dncheck,1,tp,HINTMSG_SPSUMMON) if #sg==0 then return end for tc in sg:Iter() do Duel.SpecialSummonStep(tc,0,tp,tp,true,true,POS_FACEUP) tc:CompleteProcedure() end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can discard this card and 1 WIND monster to the GY; add 1 Dragon monster from your Deck to your hand. You can banish a total of 2 WIND and/or Dragon monsters from your hand and/or GY; Special Summon this card from your hand or GY. During your opponent's End Phase, if you control this Special Summoned card: Return it to the hand. If this card is banished: You can add 1 WIND Dragon monster from your Deck to your hand. You can only use 1 "Tempest, Dragon Ruler of Storms" effect per turn, and only once that turn.
--嵐征竜-テンペスト --Tempest, Dragon Ruler of Storms local s,id=GetID() function s.initial_effect(c) --Special Summon this card from your hand or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND|LOCATION_GRAVE) e1:SetCountLimit(1,id) e1:SetCost(s.selfspcost) e1:SetTarget(s.selfsptg) e1:SetOperation(s.selfspop) c:RegisterEffect(e1) --Return this card to the hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_PHASE|PHASE_END) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) and e:GetHandler():IsSpecialSummoned() end) e2:SetTarget(s.rthtg) e2:SetOperation(s.rthop) c:RegisterEffect(e2) --Add 1 Dragon monster from your Deck to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_HAND) e3:SetCountLimit(1,id) e3:SetCost(DragonRuler.SelfDiscardToGraveCost(ATTRIBUTE_WIND)) e3:SetTarget(s.dthtg) e3:SetOperation(s.dthop) c:RegisterEffect(e3) --Add 1 WIND Dragon monster from your Deck to your hand local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,3)) e4:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetProperty(EFFECT_FLAG_DELAY) e4:SetCode(EVENT_REMOVE) e4:SetCountLimit(1,id) e4:SetTarget(s.wdthtg) e4:SetOperation(s.wdthop) c:RegisterEffect(e4) end function s.spcostfilter(c) return (c:IsRace(RACE_DRAGON) or c:IsAttribute(ATTRIBUTE_WIND)) and c:IsAbleToRemoveAsCost() and (c:IsLocation(LOCATION_HAND) or aux.SpElimFilter(c,true)) end function s.selfspcost(e,tp,eg,ep,ev,re,r,rp,chk) local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_HAND|LOCATION_MZONE|LOCATION_GRAVE,0,e:GetHandler()) if chk==0 then return #rg>1 and aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),0) end local g=aux.SelectUnselectGroup(rg,e,tp,2,2,aux.ChkfMMZ(1),1,tp,HINTMSG_REMOVE) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end function s.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.rthtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,tp,0) end function s.rthop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.SendtoHand(c,nil,REASON_EFFECT) end end function s.dthfilter(c) return c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end function s.dthtg(e,tp,eg,ep,ev,re,r,rp,chk) --Excluding itself for a correct interaction with "Chasma, Dragon Ruler of Auroras" [04965193] if chk==0 then return Duel.IsExistingMatchingCard(s.dthfilter,tp,LOCATION_DECK,0,1,e:GetHandler()) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.dthop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.dthfilter,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.wdthfilter(c) return c:IsRace(RACE_DRAGON) and c:IsAttribute(ATTRIBUTE_WIND) and c:IsAbleToHand() end function s.wdthtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.wdthfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.wdthop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.wdthfilter,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:
Each time a player draws cards because of a card effect, they take 500 damage during the End Phase for each card drawn by the card effect.
--グリード --Greed 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) --reg local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_DRAW) e2:SetCondition(s.drcon) e2:SetOperation(s.drop) c:RegisterEffect(e2) --damage local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DAMAGE) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e3:SetRange(LOCATION_SZONE) e3:SetCode(EVENT_PHASE+PHASE_END) e3:SetCountLimit(1) e3:SetCondition(s.damcon) e3:SetTarget(s.damtg) e3:SetOperation(s.damop) c:RegisterEffect(e3) end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return (r&REASON_EFFECT)~=0 end function s.drop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local flag=(ep==0 and id or id+1) local ct=c:GetFlagEffectLabel(flag) if ct then c:SetFlagEffectLabel(flag,ct+ev) else c:RegisterFlagEffect(flag,RESETS_STANDARD_PHASE_END,0,1,ev) end end function s.damcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:GetFlagEffect(id)>0 or c:GetFlagEffect(id+1)>0 end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local c=e:GetHandler() local ct1=c:GetFlagEffectLabel(id) local ct2=c:GetFlagEffectLabel(id+1) if ct1 and ct2 then Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,0) elseif ct1 then Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,0,ct1*500) elseif ct2 then Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1,ct2*500) end end function s.damop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local ct1=c:GetFlagEffectLabel(id+tp) local ct2=c:GetFlagEffectLabel(id+1-tp) if ct1 then Duel.Damage(tp,ct1*500,REASON_EFFECT,true) end if ct2 then Duel.Damage(1-tp,ct2*500,REASON_EFFECT,true) end Duel.RDComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Cannot be Normal Summoned/Set. Must be Special Summoned (from your hand) by banishing 1 "Infernoid" monster from your hand or Graveyard while the total Levels and Ranks of all Effect Monsters you control are 8 or lower, and cannot be Special Summoned by other ways. Once per turn: You can target 1 Spell/Trap Card on the field; destroy it. This card cannot attack the turn you activate this effect. Once per turn, during your opponent's turn: You can Tribute 1 monster, then target 1 card in your opponent's Graveyard; banish it (this is a Quick Effect).
--インフェルノイド・アスタロス --Infernoid Patrulea local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() Infernoid.RegisterSummonProcedure(c,1) --Destroy 1 Spell/Trap on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(s.descost) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Banish 1 card from your opponent's GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(function(_,tp) return Duel.IsTurnPlayer(1-tp) end) e2:SetCost(s.rmcost) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) end s.listed_series={SET_INFERNOID} function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:GetAttackAnnouncedCount()==0 end --Cannot attack this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() end if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,false,nil,nil) end local g=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,nil,nil) Duel.Release(g,REASON_COST) end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(1-tp) and chkc:IsAbleToRemove() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectTarget(tp,Card.IsAbleToRemove,tp,0,LOCATION_GRAVE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.Remove(tc,POS_FACEUP,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
While you control a Spellcaster-Type monster, any damage you take is halved. (You cannot halve the same damage twice this way.) If this card is sent from the field to the Graveyard: You can target 1 Spellcaster-Type monster in your Graveyard; Special Summon it.
--マジシャンズ・プロテクション --Magicians' Defense 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) --Halve damage local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EFFECT_CHANGE_DAMAGE) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetTargetRange(1,0) e2:SetCondition(s.condition) e2:SetValue(s.val) c:RegisterEffect(e2) --Special Summon local e4=Effect.CreateEffect(c) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e4:SetCode(EVENT_TO_GRAVE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY) e4:SetCondition(s.spcon) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) end function s.condition(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end function s.val(e,re,dam,r,rp,rc) return math.floor(dam/2) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.spfilter(c,e,tp) return c:IsRace(RACE_SPELLCASTER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.spfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingTarget(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If only your opponent controls a monster: You can Special Summon 1 "Dragunity" Tuner and 1 Winged Beast "Dragunity" monster from your Deck, but negate their effects, then if your opponent controls a monster that was Special Summoned from the Extra Deck, immediately after this effect resolves you can Synchro Summon 1 Dragon Synchro Monster using only "Dragunity" monsters you control. For the rest of this turn after this card resolves, you cannot Special Summon monsters from the Extra Deck, except Dragon monsters. You can only activate 1 "Dragunity Whirlwind" per turn.
--疾風のドラグニティ --Dragunity Whirlwind --Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon 2 "Dragunity" monsters from deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_END_PHASE) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end --Lists "Dragunity" archetype s.listed_series={SET_DRAGUNITY} --Specifically lists itself s.listed_names={id} --If only the opponent controls a monster function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 and Duel.GetFieldGroupCount(tp,0,LOCATION_MZONE)>0 end --Check for a tuner and winged beast among available "Dragunity" monsters function s.spfilter1(c,e,tp) return c:IsSetCard(SET_DRAGUNITY) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_DECK,0,1,c,e,tp) end function s.spfilter2(c,e,tp) return c:IsSetCard(SET_DRAGUNITY) and c:IsRace(RACE_WINGEDBEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>1 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter1,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end --Check for dragon synchro monster function s.scfilter(c,mg) return c:IsRace(RACE_DRAGON) and c:IsSynchroSummonable(nil,mg) end --Special summon 2 "Dragunity" monsters (1 tuner, 1 winged beast) with their effects negated function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) or Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,s.spfilter1,tp,LOCATION_DECK,0,1,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g2=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_DECK,0,1,1,g1:GetFirst(),e,tp) g1:Merge(g2) for tc in aux.Next(g1) do Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_DISABLE) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_DISABLE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e2) end Duel.SpecialSummonComplete() --If opponent controls a monster from the extra deck, synchro summon local mg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_DRAGUNITY),tp,LOCATION_MZONE,0,nil) local eg=Duel.GetMatchingGroup(s.scfilter,tp,LOCATION_EXTRA,0,nil,mg) if #mg>0 and #eg>0 and Duel.IsExistingMatchingCard(Card.IsSummonLocation,tp,0,LOCATION_MZONE,1,nil,LOCATION_EXTRA) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=eg:Select(tp,1,1,nil) Duel.SynchroSummon(tp,sg:GetFirst(),nil,mg) end --Locked into dragon monsters for extra deck for rest of turn local e3=Effect.CreateEffect(e:GetHandler()) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) e3:SetTargetRange(1,0) e3:SetTarget(s.splimit) e3:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e3,tp) aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) end --Locked into dragon monsters for extra deck function s.splimit(e,c) return not c:IsRace(RACE_DRAGON) and c:IsLocation(LOCATION_EXTRA) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Each player shuffles their Deck, then each player draws 1 card, then each player discards 1 card.
--ディーラーズ・チョイス --Dealer's Choice --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_HANDES+CATEGORY_DRAW) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsPlayerCanDraw(1-tp,1) end Duel.SetOperationInfo(0,CATEGORY_HANDES,nil,0,PLAYER_ALL,1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,PLAYER_ALL,1) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.ShuffleDeck(tp) Duel.ShuffleDeck(1-tp) local h1=Duel.Draw(tp,1,REASON_EFFECT) local h2=Duel.Draw(1-tp,1,REASON_EFFECT) if h1>0 or h2>0 then Duel.BreakEffect() end if h1>0 then Duel.ShuffleHand(tp) Duel.DiscardHand(tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD) end if h2>0 then Duel.ShuffleHand(1-tp) Duel.DiscardHand(1-tp,aux.TRUE,1,1,REASON_EFFECT|REASON_DISCARD) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Ritual Summon this card with any "Nekroz" Ritual Spell. Must be Ritual Summoned. You can discard this card, then target 1 "Nekroz" card in your GY, except "Nekroz of Unicore"; add it to your hand. You can only use this effect of "Nekroz of Unicore" once per turn. Negate the effects of face-up monsters on the field that were Special Summoned from the Extra Deck.
--ユニコールの影霊衣 --Nekroz of Unicore 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:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetValue(aux.ritlimit) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_HAND) e2:SetCountLimit(1,id) e2:SetCost(Cost.SelfDiscard) e2:SetTarget(s.target) e2:SetOperation(s.operation) c:RegisterEffect(e2) --disable local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_FIELD) e3:SetCode(EFFECT_DISABLE) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e3:SetTarget(s.distg) c:RegisterEffect(e3) end s.listed_series={SET_NEKROZ} s.listed_names={id} function s.filter(c) return c:IsSetCard(SET_NEKROZ) and not c:IsCode(id) and c:IsAbleToHand() 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) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoHand(tc,nil,REASON_EFFECT) end end function s.distg(e,c) return c:IsSummonLocation(LOCATION_EXTRA) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
1 Tuner Synchro Monster + 1+ non-Tuner Synchro Monsters Must be Synchro Summoned. Once per turn (Quick Effect): You can banish 1 Synchro Monster from your GY; this card is unaffected by other cards' effects for the rest of this turn. If this card in its owner's possession is destroyed by an opponent's card (by battle or card effect): You can target 1 of your banished Dragon Synchro Monsters; Special Summon it.
--真閃珖竜 スターダスト・クロニクル --Stardust Chronicle Spark Dragon local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() --Synchro summon procedure Synchro.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_SYNCHRO),1,1,Synchro.NonTunerEx(Card.IsType,TYPE_SYNCHRO),1,99) --Must be synchro summoned local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_SPSUMMON_CONDITION) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e1:SetValue(aux.synlimit) c:RegisterEffect(e1) --Make itself become unaffected by other card effects local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCost(s.immcost) e2:SetOperation(s.immop) c:RegisterEffect(e2) --Special summon 1 of your banished dragon synchro monsters 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_DESTROYED) e3:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.synchro_tuner_required=1 s.synchro_nt_required=1 function s.cfilter(c) return c:IsType(TYPE_SYNCHRO) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.immcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,e:GetHandler()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.immop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then --Unaffected by other card effects local e1=Effect.CreateEffect(c) e1:SetDescription(3100) e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_IMMUNE_EFFECT) e1:SetValue(s.efilter) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end end function s.efilter(e,re) return re:GetOwner()~=e:GetOwner() and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return rp~=tp and e:GetHandler():IsPreviousControler(tp) end function s.spfilter(c,e,tp) return c:IsType(TYPE_SYNCHRO) and c:IsRace(RACE_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) 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_REMOVED,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_REMOVED,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc and tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
5 Level 12 monsters Once per turn (Quick Effect): You can detach 1 material from this card; destroy 1 other monster on the field. At the end of the Battle Phase: Destroy as many other monsters on the field as possible (min. 1), then you can Special Summon 1 monster from your opponent's GY to your field in Defense Position. If this card you control is destroyed by an opponent's card effect while it has material, and is sent to your GY: You can Special Summon 1 "Number iC1000: Numerounius Numerounia" from your Extra Deck, and if you do, attach this card to it as material.
--CNo.1000 夢幻虚神ヌメロニアス --Number C1000: Numerounius --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) --Xyz summon Xyz.AddProcedure(c,nil,12,5) c:EnableReviveLimit() --Destroy local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1) e1:SetCost(Cost.DetachFromSelf(1,1,nil)) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) --Destroy and Special Summon (Battle Phase) local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1) e2:SetCode(EVENT_PHASE|PHASE_BATTLE) e2:SetTarget(s.bptg) e2:SetOperation(s.bpop) c:RegisterEffect(e2) --Special Summon "Number iC1000: Numerounius Numerounia" local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e3:SetCode(EVENT_TO_GRAVE) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end s.listed_names={15862758} s.xyz_number=1000 function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingMatchingCard(nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,e:GetHandler()) end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,e:GetHandler()) if #g>0 then Duel.HintSelection(g) Duel.Destroy(g,REASON_EFFECT) end end function s.bptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local sg=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_DESTROY,sg,#sg,0,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,1-tp,LOCATION_GRAVE) end function s.filter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.bpop(e,tp,eg,ep,ev,re,r,rp) local dg=Duel.GetMatchingGroup(nil,tp,LOCATION_MZONE,LOCATION_MZONE,e:GetHandler()) local ct=Duel.Destroy(dg,REASON_EFFECT) if ct==0 or Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_GRAVE,nil,e,tp) if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg=g:Select(tp,1,1,nil) Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return c:IsReason(REASON_DESTROY) and rp~=tp and c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:GetOverlayCount()>0 end function s.spfilter(c,e,tp) return c:IsCode(15862758) and c:IsCanBeSpecialSummoned(e,0x53b,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 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) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if tc and Duel.SpecialSummon(tc,0x53b,tp,tp,false,false,POS_FACEUP)>0 and e:GetHandler():IsRelateToEffect(e) then Duel.Overlay(tc,e:GetHandler()) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During your Main Phase, if you Link Summoned this turn: You can Special Summon this card from your hand to your zone a Link Monster points to. If you control no monsters: You can banish this card from your GY, then target 5 "Salamangreat" cards in your GY; shuffle them into the Deck, then draw 2 cards. You can only use each effect of "Salamangreat Mole" once per turn.
--転生炎獣モル --Salamangreat Mole --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Special Summon this card 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:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Shuffle 5 "Salamangreat" cards from your GY to the Deck and draw 2 cards local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(function(_,tp) return Duel.GetFieldGroupCount(tp,LOCATION_MZONE,0)==0 end) e2:SetCost(Cost.SelfBanish) e2:SetTarget(s.drtg) e2:SetOperation(s.drop) c:RegisterEffect(e2) Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.lkfilter) end s.listed_series={SET_SALAMANGREAT} function s.lkfilter(c) return not (c:IsLinkMonster() and c:IsLinkSummoned()) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)>0 end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local zone=aux.GetMMZonesPointedTo(tp) if chk==0 then return zone>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) 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() local zone=aux.GetMMZonesPointedTo(tp) if zone>0 and c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP,zone) end end function s.tdfilter(c) return c:IsSetCard(SET_SALAMANGREAT) and c:IsAbleToDeck() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,2) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,5,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,5,5,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,tp,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,2) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg==0 or Duel.SendtoDeck(tg,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)==0 then return end local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA) if #og==0 then return end if og:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end Duel.BreakEffect() Duel.Draw(tp,2,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
The first time a monster(s) is Summoned to your opponent's side of the field each turn, inflict 800 damage to your opponent. During the Battle Phase of the turn this effect is activated, you can negate the attack of 1 monster your opponent controls. You can send 1 face-up "Trap Reactor ・Y FI", 1 face-up "Spell Reactor ・RE", and this face-up card you control to the Graveyard to Special Summon 1 "Flying Fortress SKY FIRE" from your hand, Deck, or Graveyard.
--サモン・リアクター・AI --Summon Reactor ・SK local s,id=GetID() function s.initial_effect(c) --damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) e1:SetCondition(s.damcon) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --negate attack local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1) e4:SetCode(EVENT_ATTACK_ANNOUNCE) e4:SetCondition(s.nacon) e4:SetTarget(s.natg) e4:SetOperation(s.naop) c:RegisterEffect(e4) --spsummon local e5=Effect.CreateEffect(c) e5:SetDescription(aux.Stringid(id,2)) e5:SetCategory(CATEGORY_SPECIAL_SUMMON) e5:SetType(EFFECT_TYPE_IGNITION) e5:SetRange(LOCATION_MZONE) e5:SetCost(s.spcost) e5:SetTarget(s.sptg) e5:SetOperation(s.spop) c:RegisterEffect(e5) end s.listed_names={15175429,16898077,52286175} function s.damcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(Card.IsControler,1,nil,1-tp) end function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return e:GetHandler():IsRelateToEffect(e) end e:GetHandler():RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,800) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.Damage(1-tp,800,REASON_EFFECT) end end function s.nacon(e,tp,eg,ep,ev,re,r,rp) return eg:GetFirst():IsControler(1-tp) and e:GetHandler():GetFlagEffect(id)~=0 end function s.natg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tg=Duel.GetAttacker() if chkc then return chkc==tg end if chk==0 then return tg:IsOnField() and tg:IsCanBeEffectTarget(e) end Duel.SetTargetCard(tg) end function s.naop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetAttacker() if tc:IsRelateToEffect(e) and tc:IsFaceup() then Duel.NegateAttack() end end function s.spcfilter(c,code) return c:IsCode(code) and c:IsAbleToGraveAsCost() end function s.rescon(ct) return function(sg,e,tp,mg) return aux.ChkfMMZ(1-ct)(sg,e,tp,mg) and sg:IsExists(s.chk,1,nil,sg) end end function s.chk(c,sg) return c:IsCode(15175429) and sg:IsExists(Card.IsCode,1,c,52286175) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local g1=Duel.GetMatchingGroup(s.spcfilter,tp,LOCATION_ONFIELD,0,c,15175429) local g2=Duel.GetMatchingGroup(s.spcfilter,tp,LOCATION_ONFIELD,0,c,52286175) local g=g1:Clone() g:Merge(g2) local dec=c:GetSequence()<5 and 1 or 0 if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and e:GetHandler():IsAbleToGraveAsCost() and #g1>0 and #g2>0 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon(dec),0) end local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon(dec),1,tp,HINTMSG_TOGRAVE) sg:AddCard(c) Duel.SendtoGrave(sg,REASON_COST) end function s.spfilter(c,e,tp) return c:IsCode(16898077) and c:IsCanBeSpecialSummoned(e,0,tp,true,true) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,0,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,true,POS_FACEUP) g:GetFirst():CompleteProcedure() end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
3 Level 8 monsters Once per turn (Quick Effect): You can detach 1 material from this card, then activate 1 of these effects. ● Target 1 Set Spell/Trap your opponent controls; while this card is face-up on the field, that Set card cannot be activated. ● Target 1 Plant monster on the field; change that target to face-down Defense Position. ● Target 1 face-up monster on the field; that target gains 300 ATK.
--No.87 雪月花美神クイーン・オブ・ナイツ --Number 87: Queen of the Night local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Xyz Summon procedure: 3 Level 8 monsters Xyz.AddProcedure(c,nil,8,3) --Activate 1 of these effects local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetHintTiming(TIMING_DAMAGE_STEP|TIMING_SSET,TIMING_DAMAGE_STEP|TIMING_SSET|TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.efftg) e1:SetOperation(s.effop) c:RegisterEffect(e1) end s.xyz_number=87 function s.setfilter(c) return c:IsRace(RACE_PLANT) and c:IsCanTurnSet() end function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local op=e:GetLabel() if op==1 then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_SZONE) and chkc:IsFacedown() elseif op==2 then return chkc:IsLocation(LOCATION_MZONE) and s.setfilter(chkc) elseif op==3 then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsFaceup() end end local not_dmg_step=not Duel.IsPhase(PHASE_DAMAGE) local b1=not_dmg_step and Duel.IsExistingTarget(Card.IsFacedown,tp,0,LOCATION_SZONE,1,nil) local b2=not_dmg_step and Duel.IsExistingTarget(s.setfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) local b3=aux.StatChangeDamageStepCondition() and Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) if chk==0 then return b1 or b2 or b3 end local op=Duel.SelectEffect(tp, {b1,aux.Stringid(id,1)}, {b2,aux.Stringid(id,2)}, {b3,aux.Stringid(id,3)}) e:SetLabel(op) e:SetCategory(0) if op==1 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) Duel.SelectTarget(tp,Card.IsFacedown,tp,0,LOCATION_SZONE,1,1,nil) elseif op==2 then e:SetCategory(CATEGORY_POSITION) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local g=Duel.SelectTarget(tp,s.setfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_POSITION,g,1,tp,0) elseif op==3 then e:SetCategory(CATEGORY_ATKCHANGE) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil) end end function s.effop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not tc:IsRelateToEffect(e) then return end local op=e:GetLabel() local c=e:GetHandler() if op==1 then --Target 1 Set Spell/Trap your opponent controls; while this card is face-up on the field, that Set card cannot be activated if c:IsRelateToEffect(e) and tc:IsFacedown() then c:SetCardTarget(tc) --While this card is face-up on the field, that Set card cannot be activated local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_OWNER_RELATE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetCondition(function() return c:IsHasCardTarget(tc) and tc:IsFacedown() end) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD) tc:RegisterEffect(e1) end elseif op==2 then --Target 1 Plant monster on the field; change that target to face-down Defense Position if tc:IsRace(RACE_PLANT) then Duel.ChangePosition(tc,POS_FACEDOWN_DEFENSE) end elseif op==3 then --Target 1 face-up monster on the field; that target gains 300 ATK if tc:IsFaceup() then tc:UpdateAttack(300,nil,c) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card in your possession is destroyed by your opponent's card (either by battle or by card effect) and sent to your Graveyard: Shuffle this card into the Deck. Once per turn: You can target 1 face-up "Madolche" card you control, except this card; return it to the hand, and if you do, increase this card's Level by 1 and ATK by 300.
--マドルチェ・クロワンサン --Madolche Cruffssant local s,id=GetID() function s.initial_effect(c) --to deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetCondition(s.retcon) e1:SetTarget(s.rettg) e1:SetOperation(s.retop) c:RegisterEffect(e1) --tohand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_IGNITION) 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_MADOLCHE} function s.retcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetReasonPlayer()~=tp and e:GetHandler():IsPreviousControler(tp) end function s.rettg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TODECK,e:GetHandler(),1,0,0) end function s.retop(e,tp,eg,ep,ev,re,r,rp) if e:GetHandler():IsRelateToEffect(e) then Duel.SendtoDeck(e:GetHandler(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end function s.filter(c) return c:IsFaceup() and c:IsSetCard(SET_MADOLCHE) and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.filter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.SendtoHand(tc,nil,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_HAND) then if c:IsRelateToEffect(e) and c:IsFaceup() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_COPY_INHERIT) e1:SetCode(EFFECT_UPDATE_LEVEL) e1:SetValue(1) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_ATTACK) e2:SetValue(300) c:RegisterEffect(e2) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal or Special Summoned: Choose 1 Level 4 or lower Warrior-Type monster from your Deck, except "Field-Commander Rahz", and place it on top of your Deck.
--戦士ラーズ --Field-Commander Rahz local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.operation) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) end function s.filter(c) return c:IsLevelBelow(4) and c:IsRace(RACE_WARRIOR) and c:GetCode()~=id end function s.operation(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) local tc=g:GetFirst() if tc then Duel.ShuffleDeck(tp) Duel.MoveSequence(tc,0) Duel.ConfirmDecktop(tp,1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
(Quick Effect): You can return 1 other "Altergeist" card you control to the hand, then target 1 card your opponent controls; return it to the hand. If this card is sent from the field to the GY: You can target 1 "Altergeist" Trap in your GY; add that card to your hand. You can only use each effect of "Altergeist Silquitous" once per turn.
--オルターガイスト・シルキタス --Altergeist Silquitous local s,id=GetID() function s.initial_effect(c) --to hand local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_TOHAND) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.rthcost) e1:SetTarget(s.rthtg) e1:SetOperation(s.rthop) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.thcon) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) end s.listed_series={SET_ALTERGEIST} function s.rthcfilter(c) return c:IsFaceup() and c:IsSetCard(SET_ALTERGEIST) and c:IsAbleToHandAsCost() end function s.rthcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.IsExistingMatchingCard(s.rthcfilter,tp,LOCATION_ONFIELD,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectMatchingCard(tp,s.rthcfilter,tp,LOCATION_ONFIELD,0,1,1,c) Duel.SendtoHand(g,nil,REASON_COST) end function s.rthtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_ONFIELD,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) end function s.rthop(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 function s.thcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end function s.thfilter(c) return c:IsSetCard(SET_ALTERGEIST) and c:IsTrap() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.thfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local sg=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,sg,#sg,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:
1 Tuner + 1 or more non-Tuner monsters This card gains 500 ATK and DEF for each "Deskbot" card on the field. You can only use 1 of the following effects of "Deskbot Jet" per turn, and only once that turn. ● You can target 1 "Deskbot" card you control; destroy it, and if you do, Special Summon 1 "Deskbot" monster from your Deck. ● You can target 1 "Deskbot" card you control and 1 face-up card on the field; destroy them.
--ブンボーグ・ジェット --Deskbot Jet local s,id=GetID() function s.initial_effect(c) --synchro summon Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() --atk/def local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.val) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_UPDATE_DEFENSE) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,0)) e3:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetCountLimit(1,id) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --destroy local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_DESTROY) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetRange(LOCATION_MZONE) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetCountLimit(1,id) e4:SetTarget(s.destg) e4:SetOperation(s.desop) c:RegisterEffect(e4) end s.listed_series={SET_DESKBOT} function s.val(e,c) return Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_DESKBOT),c:GetControler(),LOCATION_ONFIELD,LOCATION_ONFIELD,nil)*500 end function s.desfilter1(c) return c:IsFaceup() and c:IsSetCard(SET_DESKBOT) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_DESKBOT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(e:GetLabel()) and chkc:IsControler(tp) and s.desfilter1(chkc) end if chk==0 then local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<-1 then return false end local loc=LOCATION_ONFIELD if ft==0 then loc=LOCATION_MZONE end e:SetLabel(loc) return Duel.IsExistingTarget(s.desfilter1,tp,loc,0,1,nil) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,s.desfilter1,tp,e:GetLabel(),0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end end function s.desfilter2(c) return c:IsFaceup() and c:IsSetCard(SET_DESKBOT) and Duel.IsExistingTarget(Card.IsFaceup,0,LOCATION_ONFIELD,LOCATION_ONFIELD,1,c) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end if chk==0 then return Duel.IsExistingTarget(s.desfilter2,tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g1=Duel.SelectTarget(tp,s.desfilter2,tp,LOCATION_ONFIELD,0,1,1,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g2=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g1:GetFirst()) g1:Merge(g2) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g1,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:
Once per turn you can pay 600 Life Points to have all face-up Psychic-Type monsters gain 500 ATK during this turn.
--パワー・インジェクター --Power Injector local s,id=GetID() function s.initial_effect(c) --atkup local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCost(Cost.PayLP(600)) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) end function s.atktg(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,LOCATION_MZONE,1,nil) end end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsRace,RACE_PSYCHIC),tp,LOCATION_MZONE,LOCATION_MZONE,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(500) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
This card in the Monster Zone is sent to the GY, except during the Battle Phase. At the start of the Battle Phase, if this card is in your GY: You can send 1 Plant monster from your hand or face-up field to the GY; Special Summon this card, then you can Special Summon 1 monster from either GY to your field, but send these Special Summoned monsters to the GY at the end of the Battle Phase. You can only use this effect of "Cucumber Horse" once per turn.
--精霊冥騎-急還馬 --Cucumber Horse --scripted by Naim local s,id=GetID() function s.initial_effect(c) Duel.EnableGlobalFlag(GLOBALFLAG_SELF_TOGRAVE) --Send itself to the GY if it's not the Battle Phase local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_SELF_TOGRAVE) e1:SetCondition(function() return not Duel.IsBattlePhase() end) c:RegisterEffect(e1) --Special Summon itself at the start of the Battle Phase local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetCode(EVENT_PHASE|PHASE_BATTLE_START) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) e2:SetCost(s.spcost) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end function s.costfilter(c,tp) return c:IsRace(RACE_PLANT) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost() and Duel.GetMZoneCount(tp,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil,tp) Duel.SendtoGrave(g,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spfilter(c,e,tp) return c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp,c) local c=e:GetHandler() if not c:IsRelateToEffect(e) then return end local sg=Group.CreateGroup() if Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then sg:AddCard(c) if Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,LOCATION_GRAVE,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,LOCATION_GRAVE,1,1,nil,e,tp) if #g>0 then Duel.BreakEffect() if Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 then sg:Merge(g) end end end end local fid=c:GetFieldID() for tc in sg:Iter() do tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) end sg:KeepAlive() --Send the summoned monsters to the GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE|PHASE_BATTLE) e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) e1:SetCountLimit(1) e1:SetLabel(fid) e1:SetLabelObject(sg) e1:SetCondition(s.tgcond) e1:SetOperation(s.tgop) Duel.RegisterEffect(e1,tp) end function s.tgfilter(c,fid) return c:GetFlagEffectLabel(id)==fid end function s.tgcond(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() if not g:IsExists(s.tgfilter,1,nil,e:GetLabel()) then g:DeleteGroup() e:Reset() return false else return true end end function s.tgop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetLabelObject() local tg=g:Filter(s.tgfilter,nil,e:GetLabel()) Duel.SendtoGrave(tg,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Reveal 1 monster in your hand, choose 1 monster from your Deck that has exactly 1 of the same Type, Attribute, Level, ATK or DEF, and banish the revealed monster from your hand face-down. Then add, from the Deck to your hand, 1 monster that has exactly 1 of the same Type, Attribute, Level, ATK or DEF as the monster chosen from your Deck, and banish the card chosen from the Deck face-down. You can only activate 1 "Small World" per turn.
--スモール・ワールド --Small World --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Banish and search local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.singleprop(c,d) local ct=0 if c:IsRace(d:GetRace()) then ct=ct+1 end if c:IsAttribute(d:GetAttribute()) then ct=ct+1 end if c:IsLevel(d:GetLevel()) then ct=ct+1 end if c:IsAttack(d:GetTextAttack()) and d:IsAttack(c:GetTextAttack()) then ct=ct+1 end if c:IsDefense(d:GetTextDefense()) and d:IsDefense(c:GetTextDefense()) then ct=ct+1 end return ct==1 end function s.thfilter(c,mc) return c:IsMonster() and c:IsAbleToHand() and s.singleprop(c,mc) end function s.showfilter(c,tp,mc) return c:IsMonster() and not c:IsPublic() and c:IsAbleToRemove() and s.singleprop(c,mc) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,c,c) end function s.revfilter(c,tp) return c:IsMonster() and not c:IsPublic() and c:IsAbleToRemove() and Duel.IsExistingMatchingCard(s.showfilter,tp,LOCATION_DECK,0,1,nil,tp,c) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.revfilter,tp,LOCATION_HAND,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_DECK) 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_CONFIRM) local rc=Duel.SelectMatchingCard(tp,s.revfilter,tp,LOCATION_HAND,0,1,1,nil,tp):GetFirst() if not rc then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local sc=Duel.SelectMatchingCard(tp,s.showfilter,tp,LOCATION_DECK,0,1,1,nil,tp,rc):GetFirst() if not sc then return end Duel.ConfirmCards(1-tp,rc) Duel.ConfirmCards(1-tp,sc) if Duel.Remove(rc,POS_FACEDOWN,REASON_EFFECT)>0 and rc:IsLocation(LOCATION_REMOVED) and rc:IsFacedown() then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local th=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,sc,sc) if #th>0 then Duel.BreakEffect() if Duel.SendtoHand(th,nil,REASON_EFFECT)>0 and th:GetFirst():IsLocation(LOCATION_HAND) then Duel.ConfirmCards(1-tp,th) Duel.Remove(sc,POS_FACEDOWN,REASON_EFFECT) end end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate only when your opponent activates a Trap Card that inflicts damage. Negate the activation of that card and destroy it and all face-up Spell and Trap Cards your opponent controls.
--白銀のバリア-シルバーフォース- --Shining Silver Force local s,id=GetID() function s.initial_effect(c) --Negate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_NEGATE+CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_CHAINING) e1:SetCondition(s.discon) e1:SetTarget(s.distg) e1:SetOperation(s.disop) c:RegisterEffect(e1) end function s.discon(e,tp,eg,ep,ev,re,r,rp) if ep==tp or not re:IsHasType(EFFECT_TYPE_ACTIVATE) or not re:IsTrapEffect() or not Duel.IsChainNegatable(ev) then return false end local ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_DAMAGE) if ex then return true end ex,cg,ct,cp,cv=Duel.GetOperationInfo(ev,CATEGORY_RECOVER) return ex and ((cp~=PLAYER_ALL and Duel.IsPlayerAffectedByEffect(cp,EFFECT_REVERSE_RECOVER)) or (cp==PLAYER_ALL and (Duel.IsPlayerAffectedByEffect(0,EFFECT_REVERSE_RECOVER) or Duel.IsPlayerAffectedByEffect(1,EFFECT_REVERSE_RECOVER)))) end function s.dfilter(c) return c:IsFaceup() and c:IsSpellTrap() end function s.distg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,0,0) local g=Duel.GetMatchingGroup(s.dfilter,tp,0,LOCATION_ONFIELD,nil) g:Merge(eg) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) end function s.disop(e,tp,eg,ep,ev,re,r,rp) if Duel.NegateActivation(ev) then local g=Duel.GetMatchingGroup(s.dfilter,tp,0,LOCATION_ONFIELD,nil) g:Merge(eg) Duel.Destroy(g,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Monsters destroyed by battle with this card are placed on the bottom of the Deck instead of going to the GY. If this card destroys an opponent's monster by battle: It gains 200 ATK.
--アマゾネス訓練生 --Amazoness Trainee local s,id=GetID() function s.initial_effect(c) --to deck local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_BATTLE_DESTROY_REDIRECT) e1:SetValue(LOCATION_DECKBOT) c:RegisterEffect(e1) --atkup local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_BATTLE_DESTROYING) e2:SetCondition(s.atkcon) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end function s.atkcon(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsFaceup() and e:GetHandler():IsRelateToBattle() end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToBattle() then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(200) e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When your opponent Summons a monster(s) with 1500 or less ATK: Banish that monster(s) with 1500 or less ATK, face-down.
--断絶の落とし穴 --Banishing Trap Hole --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e3) end function s.remfilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsAttackBelow(1500) and c:IsSummonPlayer(1-tp) and c:IsAbleToRemove(tp,POS_FACEDOWN) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local g=eg:Filter(s.remfilter,nil,tp) if chk==0 then return #g>0 end Duel.SetTargetCard(g) Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local g=eg:Filter(s.remfilter,nil,tp):Match(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:
Cannot attack directly, or attack monsters in the Extra Monster Zone. Unaffected by monster effects activated in the Extra Monster Zone. Cannot be destroyed by battle with monsters in the Extra Monster Zone.
--ストームサイファー --Storm Cipher local s,id=GetID() function s.initial_effect(c) --cannot attack directly local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_MZONE) c:RegisterEffect(e1) --cannot attack emz local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_SELECT_BATTLE_TARGET) e2:SetValue(s.atlimit) c:RegisterEffect(e2) --immune local e3=e1:Clone() e3:SetCode(EFFECT_IMMUNE_EFFECT) e3:SetValue(s.immval) c:RegisterEffect(e3) --indes local e4=e2:Clone() e4:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) c:RegisterEffect(e4) end function s.atlimit(e,c) return c:GetSequence()>4 end function s.immval(e,te) local tc=te:GetHandler() if not (tc:IsLocation(LOCATION_MZONE) or tc:IsPreviousLocation(LOCATION_MZONE)) then return end if tc:IsLocation(LOCATION_MZONE) then return te:IsMonsterEffect() and te:IsActivated() and tc:GetSequence()>4 elseif tc:IsPreviousLocation(LOCATION_MZONE) then return te:IsMonsterEffect() and te:IsActivated() and tc:GetPreviousSequence()>4 end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If you control a DARK Reptile monster: You can Special Summon this card from your hand, then, if your opponent controls any monsters with 0 ATK, you can Special Summon up to an equal number of "Reptilianne" monsters from your hand. You can only use this effect of "Reptilianne Coatl" once per turn. If this card you control would be used as Synchro Material for a Reptile monster, you can treat it as a non-Tuner.
--レプティレス・コアトル --Reptilianne Coatl --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) --Special Summon self from hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Treat as non-tuner for the Synchro Summmon of a Reptile monster local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e2:SetRange(LOCATION_MZONE) e2:SetCode(EFFECT_NONTUNER) e2:SetValue(function(e,sc) return sc:IsRace(RACE_REPTILE) end) c:RegisterEffect(e2) end s.listed_series={SET_REPTILIANNE} function s.spconfilter(c) return c:IsFaceup() and c:IsAttribute(ATTRIBUTE_DARK) and c:IsRace(RACE_REPTILE) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) end function s.spfilter(c,e,tp) return c:IsSetCard(SET_REPTILIANNE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsRelateToEffect(e) or Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)<1 then return end local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) local og=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttack,0),tp,0,LOCATION_MZONE,0,nil) if ft==0 or #og==0 then return end local ct=math.min(#og,ft) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ct=1 end local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) if ct>0 and #sg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.BreakEffect() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local ssg=sg:Select(tp,1,ct,nil) if #ssg>0 then Duel.SpecialSummon(ssg,0,tp,tp,false,false,POS_FACEUP) end end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2+ Tuners + 1 non-Tuner "Blue-Eyes" monster Your opponent cannot banish cards from your GY. You can only use each of the following effects of "Blue-Eyes Ultimate Spirit Dragon" once per turn. When a card or effect is activated on the field (Quick Effect): You can negate the activation, and if you do, this card gains 1000 ATK until the end of this turn. If this card is destroyed by battle or card effect: You can Special Summon 1 LIGHT Dragon monster from your GY, except "Blue-Eyes Ultimate Spirit Dragon".
--青眼の究極霊竜 --Blue-Eyes Ultimate Spirit Dragon --Scripted by The Razgriz local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() --Synchro Summon procedure: 2+ Tuners + 1 non-Tuner "Blue-Eyes" monster Synchro.AddProcedure(c,nil,2,99,Synchro.NonTunerEx(Card.IsSetCard,SET_BLUE_EYES),1,1) --Your opponent cannot banish cards from your GY local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_REMOVE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,1) e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_GRAVE) and c:IsControler(e:GetHandlerPlayer()) end) c:RegisterEffect(e1) --Negate the activation of a card or effect that is activated on the field and make this card gain 1000 ATK until the end of that turn local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_NEGATE+CATEGORY_ATKCHANGE) 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(function(e,tp,eg,ep,ev,re,r,rp) return Duel.GetChainInfo(ev,CHAININFO_TRIGGERING_LOCATION)&LOCATION_ONFIELD>0 and not e:GetHandler():IsStatus(STATUS_BATTLE_DESTROYED) and Duel.IsChainNegatable(ev) end) e2:SetTarget(s.negtg) e2:SetOperation(s.negop) c:RegisterEffect(e2) --Special Summon 1 LIGHT Dragon monster when this card is destroyed local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,1}) e3:SetCondition(function(e) return e:GetHandler():IsReason(REASON_BATTLE|REASON_EFFECT) end) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) --"Red Nova" hardcoded effect local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_SINGLE) e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e4:SetCode(EFFECT_MULTIPLE_TUNERS) c:RegisterEffect(e4) end s.listed_names={id} function s.negtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_NEGATE,eg,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,1000) end function s.negop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if Duel.NegateActivation(ev) and c:IsFaceup() and c:IsRelateToEffect(e) then --This card gains 1000 ATK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(1000) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end function s.spfilter(c,e,tp) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is sent to the Graveyard: All "Laval" monsters you currently control gain 300 ATK.
--ラヴァル・フロギス --Laval Phlogis local s,id=GetID() function s.initial_effect(c) --to grave local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_TO_GRAVE) e1:SetOperation(s.operation) c:RegisterEffect(e1) end s.listed_series={SET_LAVAL} function s.operation(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_LAVAL),tp,LOCATION_MZONE,0,nil) local tc=g:GetFirst() for tc in aux.Next(g) do local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(300) 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 this card is Summoned: You can send 1 Fish monster from your Deck to the GY, except "Lifeless Leaffish". You can banish this card from your GY, then target 3 Fish monsters in your GY; shuffle those monsters into your Deck, then draw 1 card. You can only use each effect of "Lifeless Leaffish" once per turn.
--揺海魚デッドリーフ --Lifeless Leaffish --Scripted by Eerie Code 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:SetProperty(EFFECT_FLAG_DAMAGE_STEP) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.gytg) e1:SetOperation(s.gyop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) local e3=e1:Clone() e3:SetCode(EVENT_FLIP_SUMMON_SUCCESS) c:RegisterEffect(e3) --Shuffle Fish monsters into the Deck and draw 1 card local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,1)) e4:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) e4:SetType(EFFECT_TYPE_IGNITION) e4:SetProperty(EFFECT_FLAG_CARD_TARGET) e4:SetRange(LOCATION_GRAVE) e4:SetCountLimit(1,{id,1}) e4:SetCost(Cost.SelfBanish) e4:SetTarget(s.drtg) e4:SetOperation(s.drop) c:RegisterEffect(e4) end s.listed_names={id} function s.gyfilter(c) return c:IsRace(RACE_FISH) and not c:IsCode(id) and c:IsAbleToGrave() end function s.gytg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.gyfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) end function s.gyop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.gyfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end function s.tdfilter(c) return c:IsMonster() and c:IsRace(RACE_FISH) and c:IsAbleToDeck() end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,3,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,3,3,e:GetHandler()) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) if #tg<=0 then return end Duel.SendtoDeck(tg,nil,SEQ_DECKTOP,REASON_EFFECT) local g=Duel.GetOperatedGroup() if g:IsExists(Card.IsLocation,1,nil,LOCATION_DECK) then Duel.ShuffleDeck(tp) end local ct=g:FilterCount(Card.IsLocation,nil,LOCATION_DECK|LOCATION_EXTRA) if ct>0 then Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Gains 400 ATK for each Spell/Trap your opponent controls.
--N・フレア・スカラベ --Neo-Spacian Flare Scarab local s,id=GetID() function s.initial_effect(c) --atk up local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetRange(LOCATION_MZONE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(s.val) c:RegisterEffect(e1) end function s.val(e,c) return Duel.GetMatchingGroupCount(Card.IsSpellTrap,c:GetControler(),0,LOCATION_ONFIELD,nil)*400 end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Activate this card by targeting 1 "Ninja" monster you control; it cannot be destroyed by battle. * The above text is unofficial and describes the card's functionality in the OCG.
--忍法 空蝉の術 --Ninjitsu Art of Decoy local s,id=GetID() function s.initial_effect(c) aux.AddPersistentProcedure(c,0,aux.FaceupFilter(Card.IsSetCard,SET_NINJA)) --indes local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetRange(LOCATION_SZONE) e1:SetTargetRange(LOCATION_MZONE,LOCATION_MZONE) e1:SetTarget(aux.PersistentTargetFilter) e1:SetValue(1) c:RegisterEffect(e1) end s.listed_series={SET_NINJA}
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
2 Level 1 monsters You can only use the effect of "Number 63: Shamoji Soldier" once per turn. You can detach 1 Xyz Material from this card, then activate 1 of these effects; ● At the start of your opponent's next Standby Phase, each player draws 1 card. ● Each player gains 1000 Life Points.
--No.63 おしゃもじソルジャー --Number 63: Shamoji Soldier local s,id=GetID() function s.initial_effect(c) --xyz summon Xyz.AddProcedure(c,nil,1,2) c:EnableReviveLimit() -- local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(Cost.DetachFromSelf(1)) e1:SetTarget(s.eftg) e1:SetOperation(s.efop) c:RegisterEffect(e1) end s.xyz_number=63 function s.eftg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local op=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2)) e:SetLabel(op) end function s.efop(e,tp,eg,ep,ev,re,r,rp) if e:GetLabel()==0 then local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE_START|PHASE_STANDBY) e1:SetCountLimit(1) e1:SetCondition(s.drcon) e1:SetOperation(s.drop) e1:SetReset(RESET_PHASE|PHASE_END|RESET_OPPO_TURN) Duel.RegisterEffect(e1,tp) else Duel.Recover(tp,1000,REASON_EFFECT) Duel.Recover(1-tp,1000,REASON_EFFECT) end end function s.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.IsTurnPlayer(1-tp) end function s.drop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Draw(tp,1,REASON_EFFECT) Duel.Draw(1-tp,1,REASON_EFFECT) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a "Salamangreat" monster(s), except "Salamangreat Fowl" is Normal or Special Summoned to your field (except during the Damage Step): You can Special Summon this card from your hand. You can only use this effect of "Salamangreat Fowl" once per turn. You can send 1 "Salamangreat" card from your hand or face-up field to the GY, then target 1 Set Spell/Trap your opponent controls; that Set card cannot be activated this turn.
--転生炎獣フォウル --Salamangreat Fowl --scripted by Logical Nonsense 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:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.spcon) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --1 opponent's Set Spell/Trap cannot be activated this turn local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetProperty(EFFECT_FLAG_CARD_TARGET) e3:SetRange(LOCATION_MZONE) e3:SetCost(s.cacost) e3:SetTarget(s.catg) e3:SetOperation(s.caop) c:RegisterEffect(e3) end s.listed_series={SET_SALAMANGREAT} s.listed_names={id} function s.spcfilter(c,tp) return c:IsSetCard(SET_SALAMANGREAT) and c:IsControler(tp) and c:IsFaceup() and not c:IsCode(id) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) return eg:IsExists(s.spcfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) 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.cacfilter(c,tp) return c:IsSetCard(SET_SALAMANGREAT) and (c:IsLocation(LOCATION_HAND) or c:IsFaceup()) and c:IsAbleToGraveAsCost() end function s.cacost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cacfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.cacfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.cafilter(c) return c:IsFacedown() and not c:HasFlagEffect(id) end function s.catg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_SZONE) and s.cafilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.cafilter,tp,0,LOCATION_SZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEDOWN) Duel.SelectTarget(tp,s.cafilter,tp,0,LOCATION_SZONE,1,1,nil) end function s.caop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFacedown() and tc:IsRelateToEffect(e) then tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) --Cannot be activated this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When a Beast-Warrior-Type "Bujin" monster you control is targeted for an attack by an opponent's monster: You can send this card from your hand to the Graveyard; negate the attack, and if you do, inflict damage to your opponent equal to half the attacker's ATK. You can only use the effect of "Bujingi Crow" once per turn.
--武神器-ヤタ --Bujingi Crow local s,id=GetID() function s.initial_effect(c) --negate attack local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_BE_BATTLE_TARGET) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) e1:SetCondition(s.nacon) e1:SetCost(Cost.SelfToGrave) e1:SetTarget(s.natg) e1:SetOperation(s.naop) c:RegisterEffect(e1) end s.listed_series={SET_BUJIN} function s.nacon(e,tp,eg,ep,ev,re,r,rp) local at=Duel.GetAttackTarget() return at:IsControler(tp) and at:IsFaceup() and at:IsSetCard(SET_BUJIN) and at:IsRace(RACE_BEASTWARRIOR) end function s.natg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetAttacker():IsOnField() end local dam=Duel.GetAttacker():GetAttack()/2 Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam) end function s.naop(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() if Duel.NegateAttack() then Duel.Damage(1-tp,a:GetAttack()/2,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
When this card is Normal Summoned successfully, no Trap Cards can be activated.
--華麗なる潜入工作員 --Tactical Espionage Expert local s,id=GetID() function s.initial_effect(c) --summon success local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetOperation(s.sumsuc) c:RegisterEffect(e1) end function s.sumsuc(e,tp,eg,ep,ev,re,r,rp) Duel.SetChainLimitTillChainEnd(s.chlimit) end function s.chlimit(re,rp,tp) return not re:GetHandler():IsTrap() or not re:IsHasType(EFFECT_TYPE_ACTIVATE) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn: You can change this card to face-down Defense Position. You can only use each of the following effects of "Pharaonic Guardian Sphinx" once per turn. If this card is Flip Summoned: Shuffle all monsters your opponent controls into the Deck. If this card in its owner's control is destroyed by an opponent's card: You can Special Summon 1 Level 5 Rock monster from your hand or Deck in face-down Defense Position.
--王家の守護者スフィンクス --Pharaonic Guardian Sphinx local s,id=GetID() function s.initial_effect(c) --turn set local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_POSITION) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) --to hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e2:SetCode(EVENT_FLIP_SUMMON_SUCCESS) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.thtg) e2:SetOperation(s.thop) c:RegisterEffect(e2) --spsummon local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY) e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.spcon) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return c:IsCanTurnSet() and c:GetFlagEffect(id)==0 end c:RegisterFlagEffect(id,RESET_EVENT|(RESETS_STANDARD_PHASE_END&~RESET_TURN_SET),0,1) Duel.SetOperationInfo(0,CATEGORY_POSITION,c,1,0,0) end function s.operation(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) and c:IsFaceup() then Duel.ChangePosition(c,POS_FACEDOWN_DEFENSE) end end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_MZONE,nil) Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_MZONE,nil) Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return (c:IsReason(REASON_BATTLE) or (rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousControler(tp))) and c:IsPreviousLocation(LOCATION_ONFIELD) end function s.filter(c,e,tp) return c:IsMonster() and c:IsRace(RACE_ROCK) and c:IsLevel(5) and c:IsCanBeSpecialSummoned(e,0,tp,true,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,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.filter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,true,false,POS_FACEDOWN_DEFENSE) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, you can toss a coin and call it. If you call it right, inflict 1000 damage to your opponent. If you call it wrong, you take 1000 damage.
--暴れ牛鬼 --Abare Ushioni local s,id=GetID() function s.initial_effect(c) --Toss a coin and inflict 1000 damage local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_COIN+CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetTarget(s.damtg) e1:SetOperation(s.damop) c:RegisterEffect(e1) end s.toss_coin=true function s.damtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_COIN,nil,0,tp,1) end function s.damop(e,tp,eg,ep,ev,re,r,rp) if Duel.CallCoin(tp) then Duel.Damage(1-tp,1000,REASON_EFFECT) else Duel.Damage(tp,1000,REASON_EFFECT) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
During either player's Battle Step, when a Fusion Monster you control battles an opponent's Fusion Monster: Target both those Fusion Monsters; negate the attack, and if you do, each player takes damage equal to the combined ATK of both those Fusion Monsters.
--決戦融合-ファイナル・フュージョン --Final Fusion local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetCategory(CATEGORY_DAMAGE) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(0,TIMING_BATTLE_PHASE) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) local a=Duel.GetAttacker() local at=Duel.GetAttackTarget() return a and at and a:IsFaceup() and a:IsType(TYPE_FUSION) and at:IsFaceup() and at:IsType(TYPE_FUSION) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local a=Duel.GetAttacker() local at=Duel.GetAttackTarget() if chkc then return chkc==a or chkc==at end if chk==0 then return a:IsOnField() and a:IsCanBeEffectTarget(e) and at:IsOnField() and at:IsCanBeEffectTarget(e) end Duel.SetTargetCard(a) Duel.SetTargetCard(at) local dam=a:GetAttack()+at:GetAttack() Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,PLAYER_ALL,dam) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc1,tc2=Duel.GetFirstTarget() local dam=tc1:GetAttack()+tc2:GetAttack() if Duel.NegateAttack() then if tc1:IsRelateToEffect(e) and tc1:IsFaceup() and tc2:IsRelateToEffect(e) and tc2:IsFaceup() then Duel.Damage(1-tp,dam,REASON_EFFECT,true) Duel.Damage(tp,dam,REASON_EFFECT,true) Duel.RDComplete() end 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: Each player can Special Summon 1 Level 4 monster from their hand.
--ファミリア・ナイト --Familiar Knight 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_F) e1:SetCode(EVENT_BATTLE_DESTROYED) e1:SetCondition(s.condition) e1:SetTarget(s.target) e1:SetOperation(s.operation) c:RegisterEffect(e1) end function s.condition(e,tp,eg,ep,ev,re,r,rp) return e:GetHandler():IsLocation(LOCATION_GRAVE) and e:GetHandler():IsReason(REASON_BATTLE) end function s.filter(c,e,tp) return c:GetLevel()==4 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 true 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 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_HAND,0,1,nil,e,tp) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g1=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp) Duel.SpecialSummonStep(g1:GetFirst(),0,tp,tp,false,false,POS_FACEUP) end if Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,1-tp,LOCATION_HAND,0,1,nil,e,1-tp) and Duel.SelectYesNo(1-tp,aux.Stringid(id,1)) then Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) local g2=Duel.SelectMatchingCard(1-tp,s.filter,1-tp,LOCATION_HAND,0,1,1,nil,e,1-tp) Duel.SpecialSummonStep(g2:GetFirst(),0,1-tp,1-tp,false,false,POS_FACEUP) end Duel.SpecialSummonComplete() end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
FLIP: Add 1 Fiend monster from your Deck to your hand, except a DARK or LIGHT monster.
--魔界発冥界行きバス --Tour Bus To Forbidden Realms local s,id=GetID() function s.initial_effect(c) --Search 1 non-LIGHT and non-DARK monster local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_FLIP) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.thfilter(c) return c:IsRace(RACE_FIEND) and c:IsAttributeExcept(ATTRIBUTE_LIGHT) and c:IsAttributeExcept(ATTRIBUTE_DARK) and c:IsAbleToHand() 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:
Add 1 "Spellbook" card from your Deck to your hand, except "Spellbook of Secrets". You can only activate 1 "Spellbook of Secrets" per turn.
--グリモの魔導書 --Spellbook of Secrets 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:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end s.listed_series={SET_SPELLBOOK} function s.filter(c) return c:IsSetCard(SET_SPELLBOOK) and c:GetCode()~=id and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
You can Tribute 1 Cyberse monster you control in the Extra Monster Zone; Special Summon up to 1 Level 4 Cyberse monster each from your hand and GY. If this card is sent to the GY: You can target 1 face-up monster on the field; its ATK becomes halved until the end of this turn. You can only use each effect of "Mathmech Division" once per turn.
--斬機ディヴィジョン --Mathmech Division --scripted by Logical Nonsense --Substitute ID local s,id=GetID() function s.initial_effect(c) --Special summon from hand/GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) e1:SetCost(s.spcost) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --Halve ATK if sent to GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end --Part of "Zan-Ki" archetype s.listed_series={SET_MATHMECH} --Check for your cyberse monster in EMZ function s.costfilter(c,tp) return c:GetSequence()>=5 and c:IsRace(RACE_CYBERSE) and c:IsControler(tp) end --Tributing cost function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.costfilter,1,false,nil,nil,tp) end local g=Duel.SelectReleaseGroupCost(tp,s.costfilter,1,1,false,nil,nil,tp) Duel.Release(g,REASON_COST) end --Check for level 4 or lower cyberse monster function s.spfilter(c,e,tp) return c:IsLevel(4) and c:IsRace(RACE_CYBERSE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end --Activation legality function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end --Special summon from hand and/or GY function s.spop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft==0 then return end if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end local g1=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_HAND,0,nil,e,tp) local g2=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp) local sg=Group.CreateGroup() if #g1>0 and (#g2==0 or Duel.SelectYesNo(tp,aux.Stringid(id,2))) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg1=g1:Select(tp,1,1,nil) sg:Merge(sg1) ft=ft-1 end if #g2>0 and ft>0 and (#sg==0 or Duel.SelectYesNo(tp,aux.Stringid(id,3))) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sg2=g2:Select(tp,1,1,nil) sg:Merge(sg2) end Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end --Activation legality 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 --Halve ATK until end of turn 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_SET_ATTACK_FINAL) e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(tc:GetAttack()/2) tc:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Once per turn, during either player's turn: You can banish 1 "Laval" monster from your Graveyard; this card gains 300 ATK until the End Phase.
--炎熱刀プロミネンス --Prominence, Molten Swordsman local s,id=GetID() function s.initial_effect(c) --atkup 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_DAMAGE_STEP) e1:SetCode(EVENT_FREE_CHAIN) e1:SetHintTiming(TIMING_DAMAGE_STEP) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) e1:SetCondition(aux.StatChangeDamageStepCondition) e1:SetCost(s.atcost) e1:SetOperation(s.atop) c:RegisterEffect(e1) end s.listed_series={SET_LAVAL} function s.cfilter(c) return c:IsSetCard(SET_LAVAL) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.atcost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,e:GetHandler()) Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.atop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsFaceup() and c:IsRelateToEffect(e) then local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetValue(300) e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) c:RegisterEffect(e1) end end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
Special Summon 1 "Ultimate Flagship Ursatron" from your Extra Deck by banishing 1 "Ursarctic Big Dipper" and 1 "Drytron Fafnir" from your hand and/or field (even if face-down). If "Ursarctic Polari" or "Drytron Alpha Thuban" is on the field, you can banish 1 of the cards from your Deck, instead. If you would Tribute a monster(s) to activate an "Ursarctic" or "Drytron" monster's effect, you can banish this card from your GY instead. You can only use this effect of "Ursarctic Drytron" once per turn. * The above text is unofficial and describes the card's functionality in the OCG.
--天斗輝巧極 --Ursarctic Drytron --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) --If you would Tribute a monster(s) to activate an "Ursarctic" or "Drytron" monster's effect, you can banish this card from your GY instead local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) e2:SetRange(LOCATION_GRAVE) e2:SetTargetRange(1,0) e2:SetCountLimit(1,id) e2:SetCondition(function(e) return e:GetHandler():IsAbleToRemoveAsCost() end) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) local e3=e2:Clone() e3:SetCode(CARD_URSARCTIC_DRYTRON) c:RegisterEffect(e3) end s.listed_names={33250142,CARD_URSARCTIC_BIG_DIPPER,58793369,27693363,97148796} --"Ultimate Flagship Ursatron", "Ursarctic Big Dipper", "Drytron Fafnir", "Ursarctic Polari", "Drytron Alpha Thuban" s.listed_series={SET_URSARCTIC,SET_DRYTRON} function s.rmfilter(c) return c:IsCode(CARD_URSARCTIC_BIG_DIPPER,58793369) and c:IsAbleToRemove() end function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetCode)==2 and sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg) end function s.spfilter(c,e,tp,sg) return c:IsCode(33250142) and Duel.GetLocationCountFromEx(tp,tp,sg,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local locations=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,27693363,97148796),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK or LOCATION_HAND|LOCATION_ONFIELD if chk==0 then local g=Duel.GetMatchingGroup(s.rmfilter,tp,locations,0,nil) return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,locations) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local locations=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,27693363,97148796),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) and LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK or LOCATION_HAND|LOCATION_ONFIELD local g=Duel.GetMatchingGroup(s.rmfilter,tp,locations,0,nil) if #g<=1 then return end local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) if #rg==2 and Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() if not sc then return end Duel.BreakEffect() if Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP)>0 then sc:CompleteProcedure() end end end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() return c:IsSetCard({SET_URSARCTIC,SET_DRYTRON}) and c:IsMonster() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST|REASON_REPLACE) 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 "Heroic Challenger - Double Lance" from your hand or Graveyard in Defense Position. Cannot be used as a Synchro Material. Cannot be used as an Xyz Material for an Xyz Summon, except for the Xyz Summon of a Warrior-Type monster.
--H・C ダブル・ランス --Heroic Challenger - Double Lance 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:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) --unsynchroable local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_BE_SYNCHRO_MATERIAL) e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e2:SetValue(1) c:RegisterEffect(e2) --xyzlimit local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_SINGLE) e3:SetCode(EFFECT_CANNOT_BE_XYZ_MATERIAL) e3:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) e3:SetValue(s.xyzlimit) c:RegisterEffect(e3) end function s.filter(c,e,tp) return 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.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE|LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE|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,aux.NecroValleyFilter(s.filter),tp,LOCATION_GRAVE|LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) end end function s.xyzlimit(e,c) if not c then return false end return not c:IsRace(RACE_WARRIOR) end
Generate a YGOPro Lua script for the following Yu-Gi-Oh card effect:
If a monster(s) you control would be destroyed by battle or card effect, you can Tribute 1 Reptile or Dinosaur monster you control instead. You can only use each of the following effects of "Evoltile Pholis" once per turn. If this card is Normal or Special Summoned: You can Special Summon 1 "Evoltile" monster from your hand or GY in face-down Defense Position. During your Main Phase: You can Set 1 "Evo-Force" or "Evo-Instant" directly from your Deck.
--エヴォルド・フォリス --Evoltile Pholis --scripted by Naim local s,id=GetID() function s.initial_effect(c) --Special Summon 1 "Evoltile" monster from the hand or GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) --Set 1 "Evo-Force" or "Evo-Instant" from the Deck local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.settg) e3:SetOperation(s.setop) c:RegisterEffect(e3) --Destruction replacement local e4=Effect.CreateEffect(c) e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e4:SetCode(EFFECT_DESTROY_REPLACE) e4:SetRange(LOCATION_MZONE) e4:SetTarget(s.reptg) e4:SetValue(s.repval) e4:SetOperation(s.repop) c:RegisterEffect(e4) end s.listed_series={SET_EVOLTILE} s.listed_names={5338223,24362891} --Evo-Force, Evo-Instant function s.spfilter(c,e,tp) return c:IsSetCard(SET_EVOLTILE) and c:IsCanBeSpecialSummoned(e,151,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,151,tp,tp,false,false,POS_FACEDOWN_DEFENSE) Duel.ConfirmCards(1-tp,g) end end function s.setfilter(c) return c:IsCode(5338223,24362891) 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 function s.repfilter(c,tp) return c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) and c:IsReason(REASON_EFFECT|REASON_BATTLE) and not c:IsReason(REASON_REPLACE) end function s.cfilter(c,e) return c:IsRace(RACE_REPTILE|RACE_DINOSAUR) and c:IsReleasableByEffect(e) and not c:IsStatus(STATUS_DESTROY_CONFIRMED|STATUS_BATTLE_DESTROYED) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) local ct=eg:FilterCount(s.repfilter,nil,tp) if chk==0 then return ct>0 and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil,e) end if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESREPLACE) local tg=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE,0,1,1,nil,e) Duel.SetTargetCard(tg) return true else return false end end function s.repval(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end function s.repop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,1-tp,id) local tc=Duel.GetFirstTarget() Duel.Release(tc,REASON_EFFECT|REASON_REPLACE) end