diff --git a/official/c11082056.lua b/official/c11082056.lua index d4c89b1a2b..6bb0b8e789 100644 --- a/official/c11082056.lua +++ b/official/c11082056.lua @@ -2,51 +2,55 @@ --The Fang of Critias local s,id=GetID() function s.initial_effect(c) - --Activate + --This card is also always treated as "Legendary Dragon Critias" + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_SINGLE) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) + e0:SetCode(EFFECT_ADD_CODE) + e0:SetValue(10000060) + c:RegisterEffect(e0) + --Send 1 Trap from your hand or field to the GY, that is listed on a Fusion Monster that can only be Special Summoned with "The Fang of Critias" (if that card is Set, reveal it), then Special Summon that Fusion Monster from your Extra Deck local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --add code - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(EFFECT_ADD_CODE) - e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) - e2:SetValue(10000060) - c:RegisterEffect(e2) end -function s.tgfilter(c,e,tp,rp) - return c:IsTrap() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetCode(),rp) +s.listed_names={10000060,id} --"Legendary Dragon Critias" +function s.tgfilter(c,e,tp) + return c:IsTrap() and c:IsAbleToGrave() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c:GetCode()) end -function s.spfilter(c,e,tp,code,rp) - return c:IsType(TYPE_FUSION) and c.material_trap and Duel.GetLocationCountFromEx(tp,rp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and code==c.material_trap +function s.spfilter(c,e,tp,code) + return c:IsType(TYPE_FUSION) and c.material_trap and code==c.material_trap and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 + and c:IsCanBeSpecialSummoned(e,0,tp,true,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_SZONE,0,1,nil,e,tp,rp) end + if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil,e,tp) end + Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_HAND|LOCATION_ONFIELD) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FMATERIAL) - local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_SZONE,0,1,1,nil,e,tp,rp) - local tc=g:GetFirst() - if tc and not tc:IsImmuneToEffect(e) then - if tc:IsOnField() and tc:IsFacedown() then Duel.ConfirmCards(1-tp,tc) end - Duel.SendtoGrave(tc,REASON_EFFECT) - if not tc:IsLocation(LOCATION_GRAVE) then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetCode()) - if tc:IsPreviousLocation(LOCATION_SZONE) and tc:IsPreviousPosition(POS_FACEUP) then - sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc:GetPreviousCodeOnField()) + local mc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil,e,tp):GetFirst() + if mc and not mc:IsImmuneToEffect(e) then + if mc:IsOnField() and mc:IsFacedown() then + Duel.ConfirmCards(1-tp,mc) + end + if Duel.SendtoGrave(mc,REASON_EFFECT)==0 or not mc:IsLocation(LOCATION_GRAVE) then return end + local code=mc:GetCode() + if mc:IsPreviousLocation(LOCATION_ONFIELD) and mc:IsPreviousPosition(POS_FACEUP) then + code=mc:GetPreviousCodeOnField() end - local sc=sg:GetFirst() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,code):GetFirst() if sc then Duel.BreakEffect() - Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP) + if Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP)==0 then return end sc:CompleteProcedure() end end -end \ No newline at end of file +end diff --git a/official/c12292422.lua b/official/c12292422.lua index da102ebba9..cecb943104 100644 --- a/official/c12292422.lua +++ b/official/c12292422.lua @@ -5,6 +5,7 @@ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) @@ -38,6 +39,7 @@ function s.filter(c,typ,lv) return c:IsRace(typ) and c:IsLevel(lv) and c:IsAbleToGrave() end function s.activate(e,tp,eg,ep,ev,re,r,rp) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local tc=Duel.SelectMatchingCard(tp,s.tgyfilter,tp,LOCATION_HAND,0,1,1,nil):GetFirst() if tc and Duel.SendtoGrave(tc,REASON_EFFECT)~=0 and tc:IsLocation(LOCATION_GRAVE) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RACE) @@ -46,7 +48,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) local lv=Duel.AnnounceLevel(tp,1,12) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(1-tp,s.filter,1-tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,typ,lv) - if #g>0 then + if #g>0 then Duel.SendtoGrave(g,REASON_EFFECT) end end diff --git a/official/c18478530.lua b/official/c18478530.lua index 122f0d6b62..a075efb66f 100644 --- a/official/c18478530.lua +++ b/official/c18478530.lua @@ -8,7 +8,7 @@ function s.initial_effect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) - --Cannot attack + --Monsters your opponent controls with 2000 or less ATK cannot attack local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_FIELD) e2:SetCode(EFFECT_CANNOT_ATTACK) @@ -17,7 +17,7 @@ function s.initial_effect(c) e2:SetCondition(s.atkcon) e2:SetTarget(aux.TargetBoolFunction(Card.IsAttackBelow,2000)) c:RegisterEffect(e2) - --Special Summon 1 "Valkyrie" monster from Deck or hand + --Special Summon 1 Level 5 or higher "Valkyrie" monster from your hand or Deck local e3=Effect.CreateEffect(c) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) @@ -33,7 +33,7 @@ function s.atkcon(e,c) local tp=e:GetHandlerPlayer() return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_VALKYRIE),tp,LOCATION_MZONE,0,1,nil) end -function s.filter(c,e,tp) +function s.spfilter(c,e,tp) return c:IsLevelAbove(5) and c:IsSetCard(SET_VALKYRIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) @@ -42,13 +42,13 @@ function s.spcon(e,tp,eg,ep,ev,re,r,rp) 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_DECK|LOCATION_HAND,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end diff --git a/official/c1906812.lua b/official/c1906812.lua index 4b37815dcc..3bf234c41b 100644 --- a/official/c1906812.lua +++ b/official/c1906812.lua @@ -1,16 +1,16 @@ --灰燼竜バスタード --Sprind the Irondash Dragon ---Logical Nonsense ---Substitute ID +--scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Must be properly summoned before reviving c:EnableReviveLimit() - --Fusion summon procedure + --Fusion Materials: "Fallen of Albaz" + 1 Effect Monster Special Summoned this turn Fusion.AddProcMix(c,true,true,CARD_ALBAZ,aux.FilterBoolFunctionEx(s.filter)) - --Move itself to 1 of your unused MMZ + --Move this card you control to another of your Main Monster Zones, then you can destroy all other face-up cards in this card's column local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1) @@ -25,38 +25,32 @@ function s.initial_effect(c) e2:SetOperation(s.regop) c:RegisterEffect(e2) end - --Lists "Sprigguns" archetype s.listed_series={SET_SPRINGANS} - --Specifically lists "Fallen of Albaz" s.listed_names={CARD_ALBAZ} - --Check for an effect that was special summoned this turn function s.filter(c) return c:IsLocation(LOCATION_MZONE) and c:IsType(TYPE_EFFECT) and c:IsStatus(STATUS_SPSUMMON_TURN) end - --Activation legality function s.seqtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) - local seq=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0) - Duel.Hint(HINT_ZONE,tp,seq) - e:SetLabel(math.log(seq,2)) + Duel.SetPossibleOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_ONFIELD) end - --Move itself to 1 of your unused MMZ, then destroy all face-up cards in its new column function s.seqop(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - local seq=e:GetLabel() - if not c:IsRelateToEffect(e) or c:IsControler(1-tp) or not Duel.CheckLocation(tp,LOCATION_MZONE,seq) then return end + if not c:IsRelateToEffect(e) or c:IsControler(1-tp) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOZONE) - Duel.MoveSequence(c,seq) - local dg=c:GetColumnGroup():Filter(Card.IsFaceup,c,nil) --Check for face-up cards in its current column, except itself - if #dg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then - Duel.BreakEffect() - Duel.Destroy(dg,REASON_EFFECT) + local seq=Duel.SelectDisableField(tp,1,LOCATION_MZONE,0,0) + if seq then + Duel.MoveSequence(c,math.log(seq,2)) + local dg=c:GetColumnGroup():Filter(Card.IsFaceup,c,nil) + if #dg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then + Duel.BreakEffect() + Duel.Destroy(dg,REASON_EFFECT) + end end end - --Add or special summon 1 "Sprigguns" monster or "Fallen of Albaz" from deck function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() + --Add to your hand, or Special Summon, 1 "Springans" monster or 1 "Fallen of Albaz" from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,2)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) @@ -69,22 +63,19 @@ function s.regop(e,tp,eg,ep,ev,re,r,rp) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end - --Check for a "Sprigguns" monster or "Fallen of Albaz" function s.thfilter(c,e,tp,ft) return c:IsMonster() and (c:IsSetCard(SET_SPRINGANS) or c:IsCode(CARD_ALBAZ)) and (c:IsAbleToHand() or (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0)) end - --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp,ft) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end - --Add or special summon 1 "Sprigguns" monster or "Fallen of Albaz" from deck function s.thop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,ft):GetFirst() if tc then aux.ToHandOrElse(tc,tp,function(c) diff --git a/official/c19307353.lua b/official/c19307353.lua index d782b3bd91..a7ea01d61f 100644 --- a/official/c19307353.lua +++ b/official/c19307353.lua @@ -3,7 +3,7 @@ --scripted by pyrQ local s,id=GetID() function s.initial_effect(c) - --Search + --Add 1 monster from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) @@ -42,8 +42,8 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.operation(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local total=e:GetLabel() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,total) if #g>0 then Duel.SendtoHand(g,nil,REASON_EFFECT) diff --git a/official/c21147203.lua b/official/c21147203.lua index fc1e0ebf8c..9d81cb7646 100644 --- a/official/c21147203.lua +++ b/official/c21147203.lua @@ -66,8 +66,8 @@ function s.decksptg(e,tp,eg,ep,ev,re,r,rp,chk) end function s.deckspop(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 rac,att,lvl=e:GetLabel() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.deckspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,rac,att,lvl) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) diff --git a/official/c23020408.lua b/official/c23020408.lua index 9e082dc7c4..c0766a867a 100644 --- a/official/c23020408.lua +++ b/official/c23020408.lua @@ -3,7 +3,7 @@ --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) - --Activate + --Place 1 card on top of the Deck from your hand, Deck, or GY, that is "Dark Magician" or mentions "Dark Magician" or "Dark Magician Girl" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TODECK) @@ -13,7 +13,7 @@ function s.initial_effect(c) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --Draw + --Draw cards equal to the number of "Palladium" monsters, "Dark Magician", and/or "Dark Magician Girl" with different names local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DRAW) @@ -36,8 +36,8 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND|LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local ct=Duel.GetFieldGroupCount(tp,LOCATION_DECK,0) + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.filter),tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE,0,1,1,nil,ct):GetFirst() if tc then if tc:IsLocation(LOCATION_DECK) then diff --git a/official/c23912837.lua b/official/c23912837.lua index 5aeee31e15..d063d3d26f 100644 --- a/official/c23912837.lua +++ b/official/c23912837.lua @@ -3,91 +3,86 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Activate + --Special Summon 1 "Shaddoll" monster from your GY in face-up or face-down Defense Position local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) + e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) - e1:SetTarget(s.target) - e1:SetOperation(s.activate) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop) c:RegisterEffect(e1) - --change position + --Activate 1 of these effects local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_POSITION) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,id) - e2:SetCost(s.poscost) - e2:SetTarget(s.postg) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e2:SetCost(s.effcost) + e2:SetTarget(s.efftg) + e2:SetOperation(s.effop) c:RegisterEffect(e2) end s.listed_series={SET_SHADDOLL} -function s.filter(c,e,tp) +function s.spfilter(c,e,tp) return c:IsSetCard(SET_SHADDOLL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_DEFENSE) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end +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.filter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end + 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.filter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,0,0) + local g=Duel.SelectTarget(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end -function s.activate(e,tp,eg,ep,ev,re,r,rp) +function s.spop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) then - if Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_DEFENSE)~=0 then - if tc:IsFacedown() then - Duel.ConfirmCards(1-tp,tc) - end - end + if tc:IsRelateToEffect(e) and Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_DEFENSE)>0 and tc:IsFacedown() then + Duel.ConfirmCards(1-tp,tc) end end -function s.cfilter(c) +function s.effcostfilter(c) return c:IsSetCard(SET_SHADDOLL) and c:IsAbleToRemoveAsCost() end -function s.poscost(e,tp,eg,ep,ev,re,r,rp,chk) +function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) - and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_GRAVE,0,1,c) end + if chk==0 then return c:IsAbleToRemoveAsCost() and Duel.IsExistingMatchingCard(s.effcostfilter,tp,LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_GRAVE,0,1,1,c) - g:AddCard(c) - Duel.Remove(g,POS_FACEUP,REASON_COST) + local g=Duel.SelectMatchingCard(tp,s.effcostfilter,tp,LOCATION_GRAVE,0,1,1,c) + Duel.Remove(g+c,POS_FACEUP,REASON_COST) end -function s.postg(e,tp,eg,ep,ev,re,r,rp,chk) - local b1=Duel.IsExistingMatchingCard(Card.IsFacedown,tp,LOCATION_MZONE,0,1,nil) - local b2=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCanTurnSet),tp,LOCATION_MZONE,0,1,nil) +function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) + local b1=Duel.IsExistingMatchingCard(aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,LOCATION_MZONE,0,1,nil) + local b2=Duel.IsExistingMatchingCard(Card.IsCanTurnSet,tp,LOCATION_MZONE,0,1,nil) if chk==0 then return b1 or b2 end - local op=0 - if b1 and b2 then - op=Duel.SelectOption(tp,aux.Stringid(id,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 - if op==0 then - e:SetOperation(s.posop1) - else - e:SetOperation(s.posop2) - end - Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,0,0) + local op=Duel.SelectEffect(tp, + {b1,aux.Stringid(id,2)}, + {b2,aux.Stringid(id,3)}) + e:SetLabel(op) + Duel.SetOperationInfo(0,CATEGORY_POSITION,nil,1,tp,0) end -function s.posop1(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.SelectMatchingCard(tp,Card.IsFacedown,tp,LOCATION_MZONE,0,1,1,nil) - if #g>0 then - Duel.HintSelection(g) - Duel.ChangePosition(g,POS_FACEUP_DEFENSE) +function s.effop(e,tp,eg,ep,ev,re,r,rp) + if op==1 then + --Change 1 face-down monster you control to face-up Defense Position + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) + local g=Duel.SelectMatchingCard(tp,aux.AND(Card.IsFacedown,Card.IsCanChangePosition),tp,LOCATION_MZONE,0,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.ChangePosition(g,POS_FACEUP_DEFENSE) + end + elseif op==2 then + --Change 1 face-up monster you control to face-down Defense Position + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) + local g=Duel.SelectMatchingCard(tp,Card.IsCanTurnSet,tp,LOCATION_MZONE,0,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) + end end end -function s.posop2(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.SelectMatchingCard(tp,aux.FaceupFilter(Card.IsCanTurnSet),tp,LOCATION_MZONE,0,1,1,nil) - if #g>0 then - Duel.HintSelection(g) - Duel.ChangePosition(g,POS_FACEDOWN_DEFENSE) - end -end \ No newline at end of file diff --git a/official/c26495087.lua b/official/c26495087.lua index 0fac4b84e3..6f1489a375 100644 --- a/official/c26495087.lua +++ b/official/c26495087.lua @@ -2,37 +2,31 @@ --Vampire Lady local s,id=GetID() function s.initial_effect(c) - --to grave + --Your opponent sends 1 card of the declared type from their Deck to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F) e1:SetCode(EVENT_BATTLE_DAMAGE) - e1:SetCondition(s.tgcon) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return ep==1-tp end) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) end -function s.tgcon(e,tp,eg,ep,ev,re,r,rp) - return ep~=tp -end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_OPTION) - local op=Duel.SelectOption(tp,70,71,72) - e:SetLabel(op) + local op=Duel.SelectOption(tp,DECLTYPE_MONSTER,DECLTYPE_SPELL,DECLTYPE_TRAP) + e:SetLabel(1<0 then Duel.SendtoGrave(g,REASON_EFFECT) end end \ No newline at end of file diff --git a/official/c28126717.lua b/official/c28126717.lua index 74b3452338..60dec4d130 100644 --- a/official/c28126717.lua +++ b/official/c28126717.lua @@ -8,8 +8,9 @@ function s.initial_effect(c) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) c:RegisterEffect(e1) - --Reveal + --Reveal 1 Level 1 "Floowandereeze" monster in your hand and banish 1 "Floowandereeze" card with a different name from your Deck then immediately after this effect resolves, Normal Summon the revealed monster local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SUMMON+CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_FZONE) @@ -17,8 +18,9 @@ function s.initial_effect(c) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) - --Normal on normal + --Immediately after this effect resolves, Normal Summon 1 "Floowandereeze" monster local e3=Effect.CreateEffect(c) + e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SUMMON) e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e3:SetCode(EVENT_SUMMON_SUCCESS) @@ -43,7 +45,6 @@ function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_REMOVE,POS_FACEUP,1,tp,LOCATION_DECK) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) local g1=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,tp) if #g1>0 then @@ -68,7 +69,7 @@ function s.nstg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.SetOperationInfo(0,CATEGORY_SUMMON,nil,1,0,0) end function s.nsop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) local g=Duel.SelectMatchingCard(tp,s.nsfilter,tp,LOCATION_HAND|LOCATION_MZONE,0,1,1,nil) if #g>0 then local sg=g:GetFirst(tp,1,1,nil) diff --git a/official/c28534130.lua b/official/c28534130.lua index 3c12c07c29..4225bd5d27 100644 --- a/official/c28534130.lua +++ b/official/c28534130.lua @@ -3,8 +3,9 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Special summon 1 "Salamangreat" monster from hand, then link summon 1 "Salamangreat" monster + --Special Summon 1 "Salamangreat" monster from hand, then Link Summon 1 "Salamangreat" Link Monster using materials you control, including the Summoned monster 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) @@ -12,8 +13,9 @@ function s.initial_effect(c) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --Return 1 "Salamangreat" link monster to extra deck + --Return 1 "Salamangreat" Link Monster from your GY to the Extra Deck local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) @@ -28,7 +30,8 @@ function s.spfilter2(c,mc,fg) return c:IsSetCard(SET_SALAMANGREAT) and c:IsLinkSummonable(mc,fg+mc) end function s.spfilter(c,e,tp,fg) - return c:IsSetCard(SET_SALAMANGREAT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,c,fg) + return c:IsSetCard(SET_SALAMANGREAT) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,c,fg) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) local fg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeLinkMaterial),tp,LOCATION_MZONE,0,nil) @@ -39,8 +42,8 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk) end function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local fg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeLinkMaterial),tp,LOCATION_MZONE,0,nil) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,fg) local tc=g:GetFirst() if not tc or not Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then @@ -96,11 +99,11 @@ function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) + Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end end \ No newline at end of file diff --git a/official/c29107423.lua b/official/c29107423.lua index fe04c0d37b..035140267b 100644 --- a/official/c29107423.lua +++ b/official/c29107423.lua @@ -3,10 +3,10 @@ --scripted by Rundas local s,id=GetID() function s.initial_effect(c) - --Tribute + search + deck stack + potentially Normal Summon + --Add 1 "Witch of the Black Rose" from your Deck to your hand, and if you do, take 1 Level 3 or lower Plant monster from your Deck and place it on top of your Deck, then immediately after this effect resolves, you can Normal Summon 1 "Witch of the Black Rose" from your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) + e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) @@ -14,69 +14,68 @@ function s.initial_effect(c) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) - --To Extra Deck + --Return 1 of your "Black Rose Dragon" or "Ruddy Rose Dragon" that is banished or in your GY to the Extra Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_TODECK) + e2:SetCategory(CATEGORY_TOEXTRA) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) - e2:SetTarget(s.tedtg) - e2:SetOperation(s.tedop) + e2:SetTarget(s.textg) + e2:SetOperation(s.texop) c:RegisterEffect(e2) end -s.listed_names={id,17720747,CARD_BLACK_ROSE_DRAGON,40139997} ---Tribute + search + deck stack + potentially Normal Summon -function s.thfilter(c) - return c:IsAbleToHand() and c:IsCode(17720747) +s.listed_names={17720747,CARD_BLACK_ROSE_DRAGON,40139997} --"Witch of the Black Rose", "Ruddy Rose Dragon" +function s.thfilter(c,tp) + return c:IsCode(17720747) and c:IsAbleToHand() and Duel.IsExistingMatchingCard(s.topdeckfilter,tp,LOCATION_DECK,0,1,c) end -function s.filter(c) - return c:IsRace(RACE_PLANT) and c:IsLevelBelow(3) -end -function s.sfilter(c) - return c:IsCode(17720747) and c:IsSummonable(true,nil) +function s.topdeckfilter(c) + return c:IsLevelBelow(3) and c:IsRace(RACE_PLANT) end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end + if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,tp) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_SUMMON,nil,1,tp,LOCATION_HAND) +end +function s.sumfilter(c) + return c:IsCode(17720747) and c:IsSummonable(true,nil) end function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) - if #g>0 then - if Duel.SendtoHand(g,nil,REASON_EFFECT)>0 and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) then - Duel.ConfirmCards(1-tp,g) - local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() - if tc then - Duel.ShuffleDeck(tp) - Duel.MoveSequence(tc,0) - Duel.ConfirmDecktop(tp,1) + local sc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() + if sc and Duel.SendtoHand(sc,nil,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_HAND) then + Duel.ConfirmCards(1-tp,sc) + Duel.ShuffleHand(tp) + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) + local topc=Duel.SelectMatchingCard(tp,s.topdeckfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() + if topc then + Duel.ShuffleDeck(tp) + Duel.MoveSequence(topc,0) + Duel.ConfirmDecktop(tp,1) + if Duel.IsExistingMatchingCard(s.sumfilter,tp,LOCATION_HAND,0,1,nil) + and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) + local sumc=Duel.SelectMatchingCard(tp,s.sumfilter,tp,LOCATION_HAND,0,1,1,nil):GetFirst() + if sumc then + Duel.Summon(tp,sumc,true,nil) + end end - else Duel.ConfirmCards(1-tp,g) - end - end - local g2=Duel.GetMatchingGroup(s.sfilter,tp,LOCATION_HAND,0,nil) - if #g2>0 and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SUMMON) - local tc=Duel.SelectMatchingCard(tp,s.sfilter,tp,LOCATION_HAND,0,1,1,nil):GetFirst() - if tc then - Duel.Summon(tp,tc,true,nil) end end end ---To Extra Deck -function s.tedfilter(c,tp) - return (c:IsCode(CARD_BLACK_ROSE_DRAGON) or c:IsCode(40139997)) and c:IsAbleToExtra() - and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) +function s.texfilter(c) + return c:IsCode(CARD_BLACK_ROSE_DRAGON,40139997) and c:IsFaceup() and c:IsAbleToExtra() end -function s.tedtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.tedfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,nil,tp) end - Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) +function s.textg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.texfilter,tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,e:GetHandler()) end + Duel.SetOperationInfo(0,CATEGORY_TOEXTRA,nil,1,tp,LOCATION_GRAVE|LOCATION_REMOVED) end -function s.tedop(e,tp,eg,ep,ev,re,r,rp) - local tc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.tedfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil,tp):GetFirst() - if tc then - Duel.SendtoDeck(tc,tp,SEQ_DECKSHUFFLE,REASON_EFFECT) +function s.texop(e,tp,eg,ep,ev,re,r,rp) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) + local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.texfilter),tp,LOCATION_GRAVE|LOCATION_REMOVED,0,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c29354228.lua b/official/c29354228.lua index 53e4c70807..df2cdf09ef 100644 --- a/official/c29354228.lua +++ b/official/c29354228.lua @@ -3,69 +3,65 @@ --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) - --Activate (special summon from hand) + --Activate 1 of these effects 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:SetTarget(s.sptg) - e1:SetOperation(s.spop) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e1:SetTarget(s.efftg) + e1:SetOperation(s.effop) c:RegisterEffect(e1) - --Activate (recycle) - local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) - e2:SetType(EFFECT_TYPE_ACTIVATE) - e2:SetCode(EVENT_FREE_CHAIN) - e2:SetHintTiming(0,TIMING_END_PHASE) - e2:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) - e2:SetTarget(s.thtg) - e2:SetOperation(s.thop) - c:RegisterEffect(e2) end s.listed_series={SET_DOGMATIKA} s.listed_names={CARD_ALBAZ} -function s.filter(c,e,tp) - return (c:IsCode(CARD_ALBAZ) or (c:IsMonster() and c:IsSetCard(SET_DOGMATIKA))) +function s.handspfilter(c,e,tp) + return (c:IsSetCard(SET_DOGMATIKA) or c:IsCode(CARD_ALBAZ)) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.spfilter(c,e,tp) - return s.filter(c,e,tp) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) +function s.thspfilter(c,e,tp,mzone_chk) + return (c:IsSetCard(SET_DOGMATIKA) or c:IsCode(CARD_ALBAZ)) and c:IsMonster() and (c:IsAbleToHand() + or (mzone_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end -function s.thfilter(c,ft,e,tp) - return s.filter(c,e,tp) and ((ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP)) or c:IsAbleToHand()) -end -function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end - Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) -end -function s.spop(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) - if #g>0 then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) +function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) + local mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + local b1=mzone_chk and Duel.IsExistingMatchingCard(s.handspfilter,tp,LOCATION_HAND,0,1,nil,e,tp) + local b2=Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,mzone_chk) + if chk==0 then return b1 or b2 end + local op=Duel.SelectEffect(tp, + {b1,aux.Stringid(id,1)}, + {b2,aux.Stringid(id,2)}) + e:SetLabel(op) + if op==1 then + e:SetCategory(CATEGORY_SPECIAL_SUMMON) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) + elseif op==2 then + e:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) + Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_GRAVE) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end end -function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_GRAVE,0,1,nil,ft,e,tp) end - Duel.Hint(HINT_OPSELECTED,1-tp,e:GetDescription()) -end -function s.thop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,0) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - local sg=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.thfilter),tp,LOCATION_GRAVE,0,1,1,nil,ft,e,tp) - local sc=sg:GetFirst() - if sc then - aux.ToHandOrElse(sc,tp,function(c) - return sc:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP) and ft>0 end, - function(c) - Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, - aux.Stringid(id,2)) +function s.effop(e,tp,eg,ep,ev,re,r,rp) + local op=e:GetLabel() + if op==1 then + --Special Summon 1 "Dogmatika" monster or "Fallen of Albaz" from your hand + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.handspfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) + if #g>0 then + Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) + end + elseif op==2 then + --Add to your hand or Special Summon 1 "Dogmatika" monster or "Fallen of Albaz" from your GY + local mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,3)) + local sc=Duel.SelectMatchingCard(tp,s.thspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,mzone_chk):GetFirst() + if not sc then return end + aux.ToHandOrElse(sc,tp, + function() return mzone_chk and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, + function() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, + aux.Stringid(id,4) + ) end -end \ No newline at end of file +end diff --git a/official/c30114823.lua b/official/c30114823.lua index ba9116e739..c5a969eeff 100644 --- a/official/c30114823.lua +++ b/official/c30114823.lua @@ -3,12 +3,12 @@ --Scripted by AlphaKretin, extra material by edo9300 local s,id=GetID() function s.initial_effect(c) - --Extra Material + --If a Cyberse monster you control would be used as Link Material for a "Code Talker" monster, this card in your hand can also be used as material local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetRange(LOCATION_HAND) - e1:SetCode(EFFECT_EXTRA_MATERIAL) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) + e1:SetCode(EFFECT_EXTRA_MATERIAL) + e1:SetRange(LOCATION_HAND) e1:SetTargetRange(1,0) e1:SetOperation(s.extracon) e1:SetValue(s.extraval) @@ -19,7 +19,7 @@ function s.initial_effect(c) if s.flagmap[c]==nil then s.flagmap[c] = {} end - --Send to grave + --Send 1 Cyberse monster with 1200 or less ATK from your Deck to the GY, or, if this card on the field was used as material, you can add that card to your hand instead local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SEARCH+CATEGORY_TOHAND) @@ -37,17 +37,13 @@ function s.extrafilter(c,tp) return c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) end function s.extracon(c,e,tp,sg,mg,lc,og,chk) - return (sg+mg):Filter(s.extrafilter,nil,e:GetHandlerPlayer()):IsExists(Card.IsRace,1,og,RACE_CYBERSE) and - sg:FilterCount(s.flagcheck,nil)<2 -end -function s.flagcheck(c) - return c:GetFlagEffect(id)>0 + return (sg+mg):Filter(s.extrafilter,nil,e:GetHandlerPlayer()):IsExists(Card.IsRace,1,og,RACE_CYBERSE) and sg:FilterCount(Card.HasFlagEffect,nil,id)<2 end function s.extraval(chk,summon_type,e,...) local c=e:GetHandler() if chk==0 then local tp,sc=... - if summon_type~=SUMMON_TYPE_LINK or not sc:IsSetCard(SET_CODE_TALKER) or Duel.GetFlagEffect(tp,id)>0 then + if summon_type~=SUMMON_TYPE_LINK or not sc:IsSetCard(SET_CODE_TALKER) or Duel.HasFlagEffect(tp,id) then return Group.CreateGroup() else table.insert(s.flagmap[c],c:RegisterFlagEffect(id,0,0,1)) @@ -55,7 +51,7 @@ function s.extraval(chk,summon_type,e,...) end elseif chk==1 then local sg,sc,tp=... - if summon_type&SUMMON_TYPE_LINK == SUMMON_TYPE_LINK and #sg>0 then + if summon_type&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK and #sg>0 then Duel.Hint(HINT_CARD,tp,id) Duel.RegisterFlagEffect(tp,id,RESET_PHASE|PHASE_END,0,1) end @@ -68,27 +64,31 @@ function s.extraval(chk,summon_type,e,...) end function s.tgcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - e:SetLabel(0) - if c:IsPreviousLocation(LOCATION_ONFIELD) then e:SetLabel(1) end - return c:IsLocation(LOCATION_GRAVE) and c:IsPreviousLocation(LOCATION_ONFIELD|LOCATION_HAND) and r==REASON_LINK and c:GetReasonCard():IsSetCard(SET_CODE_TALKER) + return c:IsLocation(LOCATION_GRAVE) and c:IsPreviousLocation(LOCATION_HAND|LOCATION_ONFIELD) and r==REASON_LINK and c:GetReasonCard():IsSetCard(SET_CODE_TALKER) end -function s.tgfilter(c,chk) - return c:IsRace(RACE_CYBERSE) and c:IsAttackBelow(1200) and (c:IsAbleToGrave() or (chk==1 and c:IsAbleToHand())) +function s.tgfilter(c,tohand_chk) + return c:IsRace(RACE_CYBERSE) and c:IsAttackBelow(1200) and (c:IsAbleToGrave() or (tohand_chk==1 and c:IsAbleToHand())) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil,e:GetLabel()) end - Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) + local tohand_chk=e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) + if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil,tohand_chk) end + e:SetLabel(tohand_chk and 1 or 0) + if not tohand_chk then + Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) + else + Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) + end end function s.tgop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel()) - if #g>0 then - local tc=g:GetFirst() - if e:GetLabel()==1 and tc:IsAbleToHand() and (not tc:IsAbleToGrave() or Duel.SelectYesNo(tp,aux.Stringid(id,1))) then - Duel.SendtoHand(tc,nil,REASON_EFFECT) - Duel.ConfirmCards(1-tp,tc) - else - Duel.SendtoGrave(tc,REASON_EFFECT) - end + local tohand_chk=e:GetLabel()==1 + local hint_msg=(tohand_chk and aux.Stringid(id,1) or HINTMSG_TOGRAVE) + Duel.Hint(HINT_SELECTMSG,tp,hint_msg) + local sc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil,e:GetLabel()):GetFirst() + if not sc then return end + if tohand_chk then + aux.ToHandOrElse(sc,tp) + else + Duel.SendtoGrave(sc,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c33760966.lua b/official/c33760966.lua index c93e7545a9..b9dd8e7464 100644 --- a/official/c33760966.lua +++ b/official/c33760966.lua @@ -61,8 +61,8 @@ s.listed_series={SET_DRAGONTAIL} function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE) and chkc:IsMonster() and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local ct=e:GetLabelObject():GetLabel() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) local g=Duel.SelectTarget(tp,aux.AND(Card.IsMonster,Card.IsAbleToHand),tp,LOCATION_MZONE|LOCATION_GRAVE,LOCATION_MZONE|LOCATION_GRAVE,1,ct,nil) Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,tp,0) end diff --git a/official/c33981008.lua b/official/c33981008.lua index 026d41ceb3..e96fc6b66f 100644 --- a/official/c33981008.lua +++ b/official/c33981008.lua @@ -3,61 +3,52 @@ local s,id=GetID() function s.initial_effect(c) --Activate + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_ACTIVATE) + e0:SetCode(EVENT_FREE_CHAIN) + c:RegisterEffect(e0) + --Place 1 "Spellbook" Spell from your GY on the bottom of your Deck, except "The Grand Spellbook Tower", and if you do, draw 1 card local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) + e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e1:SetCode(EVENT_PHASE|PHASE_STANDBY) + e1:SetRange(LOCATION_FZONE) + e1:SetCountLimit(1) + e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsRace,RACE_SPELLCASTER),tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) end) + e1:SetTarget(s.drtg) + e1:SetOperation(s.drop) c:RegisterEffect(e1) - --draw + --Special Summon 1 Spellcaster monster from your hand or Deck whose Level is less than or equal to the number of "Spellbook" Spells in your GY local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetCategory(CATEGORY_TODECK+CATEGORY_DRAW) - e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e2:SetRange(LOCATION_FZONE) - e2:SetCode(EVENT_PHASE|PHASE_STANDBY) - e2:SetCountLimit(1) - e2:SetCondition(s.drcon) - e2:SetTarget(s.drtg) - e2:SetOperation(s.drop) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_SPECIAL_SUMMON) + e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e2:SetCode(EVENT_TO_GRAVE) + e2:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return rp==1-tp and e:GetHandler():IsReason(REASON_DESTROY) end) + e2:SetTarget(s.sptg) + e2:SetOperation(s.spop) c:RegisterEffect(e2) - --spsummon - 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_DAMAGE_STEP) - e3:SetCode(EVENT_TO_GRAVE) - e3:SetCondition(s.spcon) - e3:SetTarget(s.sptg) - e3:SetOperation(s.spop) - c:RegisterEffect(e3) end s.listed_series={SET_SPELLBOOK} -function s.cfilter(c) - return c:IsRace(RACE_SPELLCASTER) and (c:IsLocation(LOCATION_GRAVE) or c:IsFaceup()) -end -function s.drcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsTurnPlayer(tp) and Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil) -end -function s.filter(c) - return c:IsSetCard(SET_SPELLBOOK) and c:GetCode()~=id and c:IsSpell() and c:IsAbleToDeck() +s.listed_names={id} +function s.tdfilter(c) + return c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() and c:IsAbleToDeck() and not c:IsCode(id) end function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil) end + if chk==0 then return Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_GRAVE) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.drop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil) + local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) + if #g==0 then return end Duel.HintSelection(g) - if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 then + if Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT)>0 then Duel.Draw(tp,1,REASON_EFFECT) end end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():IsReason(REASON_DESTROY) and not e:GetHandler():IsReason(REASON_RULE) and rp==1-tp -end function s.ctfilter(c) return c:IsSetCard(SET_SPELLBOOK) and c:IsSpell() end @@ -68,16 +59,17 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return false end local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_GRAVE,0,nil) - return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,nil,e,tp,ct) + return ct>0 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,nil,e,tp,ct) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK|LOCATION_HAND) + 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 false end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local ct=Duel.GetMatchingGroupCount(s.ctfilter,tp,LOCATION_GRAVE,0,nil) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK|LOCATION_HAND,0,1,1,nil,e,tp,ct) + if ct==0 then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND|LOCATION_DECK,0,1,1,nil,e,tp,ct) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c34460239.lua b/official/c34460239.lua index f46f47703a..fc544c5315 100644 --- a/official/c34460239.lua +++ b/official/c34460239.lua @@ -2,43 +2,41 @@ --Generation Shift local s,id=GetID() function s.initial_effect(c) - --Activate + --Destroy 1 face-up monster you control, then add 1 card with the same name as the destroyed card from your Deck to your hand local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) end -function s.filter(c,tp) - return c:IsFaceup() - and Duel.IsExistingMatchingCard(s.nfilter1,tp,LOCATION_DECK,0,1,nil,c) +function s.desfilter(c,tp) + return c:IsFaceup() and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,c:GetCode()) end -function s.nfilter1(c,tc) - return c:IsCode(tc:GetCode()) and c:IsAbleToHand() -end -function s.nfilter2(c,tc) - return c:IsCode(tc:GetPreviousCodeOnField()) and c:IsAbleToHand() +function s.thfilter(c,code) + return c:IsCode(code) and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc,tp) end - if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,tp) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.desfilter(chkc,tp) end + if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,tp) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 then - Duel.BreakEffect() - local g=Duel.SelectMatchingCard(tp,s.nfilter2,tp,LOCATION_DECK,0,1,1,nil,tc) - local hc=g:GetFirst() - if hc then - Duel.SendtoHand(hc,nil,REASON_EFFECT) - Duel.ConfirmCards(1-tp,hc) + if tc:IsFaceup() and tc:IsRelateToEffect(e) and tc:IsControler(tp) and Duel.Destroy(tc,REASON_EFFECT)>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) + local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,tc:GetPreviousCodeOnField()) + if #g>0 then + Duel.BreakEffect() + Duel.SendtoHand(g,nil,REASON_EFFECT) + Duel.ConfirmCards(1-tp,g) end end -end \ No newline at end of file +end diff --git a/official/c36099130.lua b/official/c36099130.lua index 3ebc7a132c..9004ea4ed4 100644 --- a/official/c36099130.lua +++ b/official/c36099130.lua @@ -3,7 +3,7 @@ --Scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Equip from Extra Deck + --Equip 1 "Magistus" monster from your Extra Deck to 1 "Magistus" monster you control local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) @@ -14,7 +14,7 @@ function s.initial_effect(c) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) - --Special Summon when becomes equipped + --Special Summon 1 Level 4 Spellcaster monster from your hand or GY in Defense Position local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -44,6 +44,7 @@ function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local ec=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_EXTRA,0,1,1,nil,SET_MAGISTUS):GetFirst() if ec then Duel.Equip(tp,ec,tc,true) diff --git a/official/c36224040.lua b/official/c36224040.lua index 9a53447c0a..b49bbf5815 100644 --- a/official/c36224040.lua +++ b/official/c36224040.lua @@ -1,10 +1,9 @@ --RUM-ゼアル・フォース --Rank-Up-Magic Zexal Force ---Logical Nonsense ---Substitute ID +--scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) - --Xyz summon 1 "Utopia" or "ZW -" monster, that is 1 rank higher than targeted Xyz + --Xyz Summon 1 "Utopia" or "ZW -" monster using 1 Xyz monster you control then take 1 "ZW -" or "ZS -" monster from your Deck and place it on top of your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -28,22 +27,18 @@ function s.initial_effect(c) e2:SetOperation(s.drop) c:RegisterEffect(e2) end - --Lists "Utopia", "ZW -", and "ZS -" archetypes s.listed_series={SET_UTOPIA,SET_ZW,SET_ZS} - --Check for an Xyz monster to use as material function s.filter1(c,e,tp) local rk=c:GetRank() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) return (#pg<=0 or (#pg==1 and pg:IsContains(c))) and c:IsFaceup() and (rk>0 or c:IsStatus(STATUS_NO_LEVEL)) - and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+1) + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c,rk+1) end - --Check for "Utopia" or "ZW -" Xyz monster -function s.filter2(c,e,tp,mc,rk) +function s.spfilter(c,e,tp,mc,rk) if c.rum_limit and not c.rum_limit(mc,e) then return false end return mc:IsType(TYPE_XYZ,c,SUMMON_TYPE_XYZ,tp) and c:IsRank(rk) and (c:IsSetCard(SET_UTOPIA) or c:IsSetCard(SET_ZW)) and mc:IsCanBeXyzMaterial(c,tp) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) end - --Activation legality function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.filter1(chkc,e,tp) end if chk==0 then return Duel.IsExistingTarget(s.filter1,tp,LOCATION_MZONE,0,1,nil,e,tp) @@ -53,25 +48,22 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) Duel.SelectTarget(tp,s.filter1,tp,LOCATION_MZONE,0,1,1,nil,e,tp) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end - --Check for "ZW -" or "ZS -" monster function s.topfilter(c) - return (c:IsSetCard(SET_ZW) or c:IsSetCard(SET_ZS)) and c:IsMonster() + return c:IsSetCard({SET_ZW,SET_ZS}) and c:IsMonster() end - --Xyz summon 1 "Utopia" or "ZW -" monster, that is 1 rank higher than targeted Xyz function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(tc),tp,nil,nil,REASON_XYZ) if not tc or tc:IsFacedown() or not tc:IsRelateToEffect(e) or tc:IsControler(1-tp) or tc:IsImmuneToEffect(e) or #pg>1 or (#pg==1 and not pg:IsContains(tc)) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1) - local sc=g:GetFirst() + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,tc,tc:GetRank()+1):GetFirst() if sc then sc:SetMaterial(tc) Duel.Overlay(sc,tc) Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP) sc:CompleteProcedure() + --Take 1 "ZW -" or "ZS -" monster from your Deck and place it on top of your Deck Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) - --Place 1 "ZW -" or "ZS -" monster to place on top of deck local tc=Duel.SelectMatchingCard(tp,s.topfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() if tc then Duel.ShuffleDeck(tp) @@ -80,18 +72,15 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) end end end - --If opponent's LP is 2000 higher than yours function s.drcon(e,tp,eg,ep,ev,re,r,rp) return Duel.GetLP(tp)<=Duel.GetLP(1-tp)-2000 end - --Activation legality function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end - --Draw 1 function s.drop(e,tp,eg,ep,ev,re,r,rp) local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) Duel.Draw(p,d,REASON_EFFECT) diff --git a/official/c3715284.lua b/official/c3715284.lua index 0773914355..92bea8203c 100644 --- a/official/c3715284.lua +++ b/official/c3715284.lua @@ -3,7 +3,7 @@ --scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Destroy itself and special Summon from Deck + --Destroy this card, and if you do, Special Summon 2 "Meklord Army" monsters from your Deck in Defense Position, except "Meklord Army Deployer Obbligato" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) @@ -13,7 +13,7 @@ function s.initial_effect(c) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Inflict damage in the End Phase + --During the End Phase of this turn, inflict 100 damage to your opponent for each "Meklord" monster you control local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DAMAGE) @@ -21,67 +21,57 @@ function s.initial_effect(c) e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) - e2:SetTarget(s.regtg) + e2:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end Duel.SetPossibleOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,100) end) e2:SetOperation(s.regop) c:RegisterEffect(e2) end s.listed_names={id} s.listed_series={SET_MEKLORD,SET_MEKLORD_ARMY} function s.spfilter(c,e,tp) - return c:IsSetCard(SET_MEKLORD_ARMY) and c:IsMonster() and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) + return c:IsSetCard(SET_MEKLORD_ARMY) and not c:IsCode(id) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - if e:GetHandler():GetSequence()<5 then ft=ft+1 end - return ft>0 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) - end + local c=e:GetHandler() + if chk==0 then return Duel.GetMZoneCount(tp,c)>=2 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) end + Duel.SetOperationInfo(0,CATEGORY_DESTROY,c,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,e:GetHandler(),1,tp,LOCATION_MZONE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - --register special summon limitation + if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)>0 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) + and Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) + if #g==2 then + Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) + end + end + --You cannot Special Summon monsters for the rest of this turn, except Machine monsters local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) - e1:SetReset(RESET_PHASE|PHASE_END) e1:SetTargetRange(1,0) - e1:SetTarget(s.splimit) + e1:SetTarget(function(e,c) return not c:IsRace(RACE_MACHINE) end) + e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) - aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) - --perform special summon - if c:IsRelateToEffect(e) and Duel.Destroy(c,REASON_EFFECT)~=0 then - if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end - if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 then return end - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) - if #g>0 then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) - end - end -end -function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) - return not c:IsRace(RACE_MACHINE) -end -function s.regtg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return true end end function s.regop(e,tp,eg,ep,ev,re,r,rp) + --During the End Phase of this turn, inflict 100 damage to your opponent for each "Meklord" monster you control local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_PHASE+PHASE_END) e1:SetCountLimit(1) - e1:SetCondition(s.dmtg) - e1:SetOperation(s.dmop) + e1:SetOperation(s.damop) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end -function s.dmtg(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_MEKLORD),tp,LOCATION_MZONE,0,1,nil) -end -function s.dmop(e,tp,eg,ep,ev,re,r,rp) +function s.damop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) - local value=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_MEKLORD),tp,LOCATION_MZONE,0,1,nil) - Duel.Damage(1-tp,value*100,REASON_EFFECT) -end \ No newline at end of file + local ct=Duel.GetMatchingGroupCount(aux.FaceupFilter(Card.IsSetCard,SET_MEKLORD),tp,LOCATION_MZONE,0,1,nil) + if ct>0 then + Duel.Damage(1-tp,ct*100,REASON_EFFECT) + end +end diff --git a/official/c37491810.lua b/official/c37491810.lua index b92dd4e11b..b194fd3cc3 100644 --- a/official/c37491810.lua +++ b/official/c37491810.lua @@ -2,13 +2,12 @@ --Parametalfoes Azortless local s,id=GetID() function s.initial_effect(c) - --Fusion summon procedure - Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_METALFOES),aux.FilterBoolFunctionEx(Card.IsType,TYPE_FUSION)) - --Must be properly summoned before reviving c:EnableReviveLimit() - --Enable pendulum summon + --Pendulum Summon procedure Pendulum.AddProcedure(c,false) - --Destroy 1 card on the field + --Fusion Materials: 1 "Metalfoes" monster + 1 Fusion Monster + Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_METALFOES),aux.FilterBoolFunctionEx(Card.IsType,TYPE_FUSION)) + --Destroy 1 face-up card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) @@ -21,10 +20,10 @@ function s.initial_effect(c) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) - --Shuffle 2 pendulum monsters, destroy 1 card + --Shuffle 2 face-up Pendulum Monsters from your Extra Deck into the Deck, and if you do, destroy 1 card your opponent controls local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_DESTROY+CATEGORY_TODECK) + e2:SetCategory(CATEGORY_TODECK+CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetCode(EVENT_SPSUMMON_SUCCESS) @@ -58,12 +57,11 @@ function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end function s.desop(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) then + if tc:IsRelateToEffect(e) then Duel.Destroy(tc,REASON_EFFECT) end end @@ -75,15 +73,15 @@ function s.tdfilter(c) end function s.destg2(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsControler(1-tp) end - if chk==0 then return Duel.IsExistingTarget(aux.TRUE,tp,0,LOCATION_ONFIELD,1,nil) + if chk==0 then return Duel.IsExistingTarget(nil,tp,0,LOCATION_ONFIELD,1,nil) and Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_EXTRA,0,2,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,nil,tp,0,LOCATION_ONFIELD,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,2,0,LOCATION_EXTRA) end function s.desop2(e,tp,eg,ep,ev,re,r,rp) - if not Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_EXTRA,0,2,nil) then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_EXTRA,0,2,2,nil) if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 then local tc=Duel.GetFirstTarget() diff --git a/official/c37750912.lua b/official/c37750912.lua index 63c770aa37..d6fb4c66fd 100644 --- a/official/c37750912.lua +++ b/official/c37750912.lua @@ -3,7 +3,7 @@ --scripted by Rundas local s,id=GetID() function s.initial_effect(c) - --To Grave + --Send 1 "Stardust" monster from your Deck to the GY, or if you control "Stardust Dragon" or a Synchro Monster that mentions it, you can Special Summon it instead local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE+CATEGORY_SPECIAL_SUMMON) @@ -13,11 +13,12 @@ function s.initial_effect(c) e1:SetTarget(s.tgtg) e1:SetOperation(s.tgop) c:RegisterEffect(e1) - --Level Change + --Increase or decrease the Level of 1 "Stardust" monster you control by 1 until the end of this turn local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,3)) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_LVCHANGE) e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetCost(Cost.SelfBanish) @@ -27,55 +28,64 @@ function s.initial_effect(c) end s.listed_names={CARD_STARDUST_DRAGON} s.listed_series={SET_STARDUST} ---To Grave -function s.ssfilter(c) - return c:IsFaceup() and (c:IsCode(CARD_STARDUST_DRAGON) or (c:ListsCode(CARD_STARDUST_DRAGON) and c:IsType(TYPE_SYNCHRO))) +function s.spconfilter(c) + return (c:IsCode(CARD_STARDUST_DRAGON) or (c:ListsCode(CARD_STARDUST_DRAGON) and c:IsType(TYPE_SYNCHRO) and c:IsMonster())) and c:IsFaceup() end -function s.tgfilter(c,e,tp,ss,mz) - return c:IsMonster() and c:IsSetCard(SET_STARDUST) and (c:IsAbleToGrave() or (ss and mz and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) +function s.tgfilter(c,e,tp,stardust_mzone_chk) + return c:IsSetCard(SET_STARDUST) and c:IsMonster() and (c:IsAbleToGrave() or (stardust_mzone_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) - local ss,mz=Duel.IsExistingMatchingCard(s.ssfilter,tp,LOCATION_MZONE,0,1,nil),Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil,e,tp,ss,mz) end + if chk==0 then + local stardust_mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_ONFIELD,0,1,nil) + return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil,e,tp,stardust_mzone_chk) + end Duel.SetPossibleOperationInfo(0,CATEGORY_TOGRAVE,nil,1,tp,LOCATION_DECK) Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end function s.tgop(e,tp,eg,ep,ev,re,r,rp) - local ss,mz=Duel.IsExistingMatchingCard(s.ssfilter,tp,LOCATION_MZONE,0,1,nil),Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) - local g=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,ss,mz) - if #g>0 then - if ss and mz and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) - else - Duel.SendtoGrave(g,REASON_EFFECT) - end + local stardust_mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + and Duel.IsExistingMatchingCard(s.spconfilter,tp,LOCATION_ONFIELD,0,1,nil) + local hintmsg=stardust_mzone_chk and aux.Stringid(id,2) or HINTMSG_TOGRAVE + Duel.Hint(HINT_SELECTMSG,tp,hintmsg) + local sc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,stardust_mzone_chk):GetFirst() + if not sc then return end + local op=1 + if stardust_mzone_chk then + local b1=sc:IsAbleToGrave() + local b2=sc:IsCanBeSpecialSummoned(e,0,tp,false,false) + op=Duel.SelectEffect(tp, + {b1,aux.Stringid(id,3)}, + {b2,aux.Stringid(id,4)}) + end + if op==1 then + Duel.SendtoGrave(sc,REASON_EFFECT) + elseif op==2 then + Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end end ---Level Change function s.lvfilter(c) - return c:IsFaceup() and c:IsSetCard(SET_STARDUST) and c:IsMonster() and c:HasLevel() + return c:IsSetCard(SET_STARDUST) and c:HasLevel() and c:IsFaceup() end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.lvfilter(chkc) end if chk==0 then return Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_MZONE,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local tc=Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() + Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,tc,1,tp,1) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() local tc=Duel.GetFirstTarget() - if not tc:IsRelateToEffect(e) then return end - local choice=-1 - if tc:IsLevelAbove(2) then - choice=Duel.SelectOption(tp,aux.Stringid(id,4),aux.Stringid(id,5)) - else - choice=Duel.SelectOption(tp,aux.Stringid(id,4)) + if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:HasLevel() then + local op=tc:IsLevelAbove(2) and Duel.SelectOption(tp,aux.Stringid(id,5),aux.Stringid(id,6)) or 0 + local lv=op==0 and 1 or -1 + --Increase or decrease its Level by 1 until the end of this turn + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e1:SetCode(EFFECT_UPDATE_LEVEL) + e1:SetValue(lv) + e1:SetReset(RESETS_STANDARD_PHASE_END) + tc:RegisterEffect(e1) end - --Change Level - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_LEVEL) - e1:SetReset(RESETS_STANDARD_PHASE_END) - e1:SetValue(1-(choice*2)) - tc:RegisterEffect(e1) -end \ No newline at end of file +end diff --git a/official/c3792766.lua b/official/c3792766.lua index e987495147..27f9712288 100644 --- a/official/c3792766.lua +++ b/official/c3792766.lua @@ -2,13 +2,15 @@ --Trickstar Delfiendium local s,id=GetID() function s.initial_effect(c) - --link summon - Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_TRICKSTAR),2) c:EnableReviveLimit() - --tohand + --Link Summon procedure: 2+ "Trickstar" monsters + Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_TRICKSTAR),2) + --Add your banished "Trickstar" cards to your hand, up to the number of Link Monsters your opponent controls, and if you do, this card gains 1000 ATK for each card added, until the end of this turn local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_TOHAND) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_TOHAND+CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_ATTACK_ANNOUNCE) e1:SetCondition(s.thcon) e1:SetTarget(s.thtg) @@ -16,38 +18,36 @@ function s.initial_effect(c) c:RegisterEffect(e1) end s.listed_series={SET_TRICKSTAR} -function s.lkfilter(c) - return c:IsFaceup() and c:IsSetCard(SET_TRICKSTAR) +function s.thconfilter(c) + return c:IsSetCard(SET_TRICKSTAR) and c:IsFaceup() and c:IsMonster() end function s.thcon(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():GetLinkedGroup():IsExists(s.lkfilter,1,nil) + return e:GetHandler():GetLinkedGroup():IsExists(s.thconfilter,1,nil) end -function s.filter(c) - return c:IsFaceup() and c:IsSetCard(SET_TRICKSTAR) and c:IsAbleToHand() +function s.thfilter(c) + return c:IsSetCard(SET_TRICKSTAR) and c:IsFaceup() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.filter(chkc) end - if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_REMOVED,0,1,nil) - and Duel.IsExistingMatchingCard(Card.IsType,tp,0,LOCATION_MZONE,1,nil,TYPE_LINK) end + if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsControler(tp) and s.thfilter(chkc) end + local ct=Duel.GetMatchingGroupCount(Card.IsLinkMonster,tp,0,LOCATION_MZONE,nil) + if chk==0 then return ct>0 and Duel.IsExistingTarget(s.thfilter,tp,LOCATION_REMOVED,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local ct=Duel.GetMatchingGroupCount(Card.IsType,tp,0,LOCATION_MZONE,nil,TYPE_LINK) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_REMOVED,0,1,ct,nil) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,0,0) + local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_REMOVED,0,1,ct,nil) + Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,#g,tp,0) + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,#g*1000) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - local rg=Duel.GetTargetCards(e) - Duel.SendtoHand(rg,nil,REASON_EFFECT) - if c:IsRelateToEffect(e) and c:IsFaceup() then - local og=Duel.GetOperatedGroup() - local ct=og:FilterCount(Card.IsLocation,nil,LOCATION_HAND) - if ct>0 then - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) - e1:SetValue(ct*1000) - c:RegisterEffect(e1) - end + local tg=Duel.GetTargetCards(e) + if Duel.SendtoHand(tg,nil,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and c:IsFaceup() then + local ct=Duel.GetOperatedGroup():FilterCount(Card.IsLocation,nil,LOCATION_HAND) + if ct==0 then return end + --This card gains 1000 ATK for each card added, until the end of this turn + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_UPDATE_ATTACK) + e1:SetValue(ct*1000) + e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) + c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c38694052.lua b/official/c38694052.lua index b57ca69abb..f2f903a63a 100644 --- a/official/c38694052.lua +++ b/official/c38694052.lua @@ -3,75 +3,66 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Xyz Summon - Xyz.AddProcedure(c,nil,7,2) c:EnableReviveLimit() - --Destroy + --Xyz Summon procedure: 2 Level 7 monsters + Xyz.AddProcedure(c,nil,7,2) + --Destroy 1 face-up card on the field, and if you destroyed a monster, you can make 1 face-up monster you control gain ATK equal to the destroyed monster's original Level/Rank x 300 until the end of the next turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY+CATEGORY_ATKCHANGE) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_IGNITION) - e1:SetCountLimit(1) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetRange(LOCATION_MZONE) - e1:SetCondition(s.condition1) - e1:SetCost(s.cost) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetCountLimit(1,0,EFFECT_COUNT_CODE_SINGLE) + e1:SetCondition(function(e) return not e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_DRAGON) end) + e1:SetCost(Cost.AND(Cost.Detach(2),s.descost)) + e1:SetTarget(s.destg) + e1:SetOperation(s.desop) c:RegisterEffect(e1,false,REGISTER_FLAG_DETACH_XMAT) + --This is a Quick Effect if this card has a Dragon monster as material local e2=e1:Clone() e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET+EFFECT_FLAG_DAMAGE_STEP) - e2:SetHintTiming(TIMING_DAMAGE_STEP,TIMING_DAMAGE_STEP|TIMINGS_CHECK_MONSTER_E) - e2:SetCondition(s.condition2) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e2:SetCondition(function(e) return e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_DRAGON) end) c:RegisterEffect(e2) end -function s.condition1(e,tp,eg,ep,ev,re,r,rp) - return not e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_DRAGON) -end -function s.condition2(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():GetOverlayGroup():IsExists(Card.IsRace,1,nil,RACE_DRAGON) - and aux.StatChangeDamageStepCondition() -end -function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) +function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return c:GetAttackAnnouncedCount()==0 and c:CheckRemoveOverlayCard(tp,2,REASON_COST) - and c:GetFlagEffect(id)==0 end - --Cannot attack this turn + if chk==0 then return c:GetAttackAnnouncedCount()==0 end + --This card cannot attack the turn you activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(3206) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_ATTACK) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetReset(RESETS_STANDARD_PHASE_END) - c:RegisterEffect(e1,true) - c:RemoveOverlayCard(tp,2,2,REASON_COST) - c:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) + c:RegisterEffect(e1) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) +function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsOnField() and chkc:IsFaceup() end if chk==0 then return Duel.IsExistingTarget(Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) local g=Duel.SelectTarget(tp,Card.IsFaceup,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and tc:IsPreviousLocation(LOCATION_MZONE) - and (tc:GetOriginalLevel()>0 or tc:GetOriginalRank()>0) - and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) + and (tc:HasLevel() or tc:HasRank()) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then - local lv=math.max(tc:GetOriginalLevel(),tc:GetOriginalRank()) - local sg=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil) - Duel.HintSelection(sg) - local sc=sg:GetFirst() - --Increase ATK + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) + local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() + if not sc then return end + Duel.HintSelection(sc) + local lvrk=math.max(tc:GetOriginalLevel(),tc:GetOriginalRank()) + --It gains ATK equal to the destroyed monster's original Level/Rank x 300 until the end of the next turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetValue(lv*300) + e1:SetValue(lvrk*300) e1:SetReset(RESETS_STANDARD_PHASE_END,2) sc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c41373230.lua b/official/c41373230.lua index 0b3d5dcdf8..7240ca7d2d 100644 --- a/official/c41373230.lua +++ b/official/c41373230.lua @@ -4,110 +4,86 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - --Fusion Summon procedure + --Fusion Materials: "Fallen of Albaz" + 1 monster with 2500 or more ATK Fusion.AddProcMix(c,true,true,CARD_ALBAZ,aux.FilterBoolFunctionEx(Card.IsAttackAbove,2500)) - --Verify materials + --Gains ATK equal to the combined original Levels of the monsters used for its Fusion Summon x 100 local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_MATERIAL_CHECK) e1:SetValue(s.valcheck) c:RegisterEffect(e1) - --Increase its ATK by the level of its materials x 100 + --After this card is Fusion Summoned, for the rest of this turn, it is unaffected by the activated effects of any other monsters Special Summoned from the Extra Deck local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) e2:SetCode(EVENT_SPSUMMON_SUCCESS) - e2:SetCondition(function(e) return e:GetHandler():IsFusionSummoned() end) - e2:SetOperation(s.atkop) - e2:SetLabelObject(e1) + e2:SetOperation(s.regop) c:RegisterEffect(e2) - --Unaffected by activated effects of monster Special Summoned from the Exra Deck + --Add to your hand, or Special Summon, 1 "Dogmatika" monster or 1 "Fallen of Albaz" from your Deck local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e3:SetCode(EVENT_SPSUMMON_SUCCESS) - e3:SetOperation(s.regop) + e3:SetDescription(aux.Stringid(id,0)) + e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) + e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e3:SetCode(EVENT_PHASE+PHASE_END) + e3:SetRange(LOCATION_GRAVE) + e3:SetCountLimit(1,id) + e3:SetCondition(function(e) local c=e:GetHandler() return c:GetTurnID()==Duel.GetTurnCount() and not c:IsReason(REASON_RETURN) end) + e3:SetTarget(s.thsptg) + e3:SetOperation(s.thspop) c:RegisterEffect(e3) - --Register effect when it is sent to the GY - local e4=Effect.CreateEffect(c) - e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e4:SetCode(EVENT_TO_GRAVE) - e4:SetOperation(s.regop2) - c:RegisterEffect(e4) end s.listed_names={CARD_ALBAZ} s.listed_series={SET_DOGMATIKA} function s.valcheck(e,c) - local g=c:GetMaterial() - local atk=0 - for tc in g:Iter() do - atk=atk+tc:GetOriginalLevel() - end - e:SetLabel(atk) -end -function s.atkop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - local atk=e:GetLabelObject():GetLabel()*100 - if atk>0 then - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetValue(atk) - e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) - c:RegisterEffect(e1) - end + local atk=c:GetMaterial():GetSum(Card.GetOriginalLevel)*100 + if atk==0 then return end + --Gains ATK equal to the combined original Levels of the monsters used for its Fusion Summon x 100 + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_UPDATE_ATTACK) + e1:SetValue(atk) + e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD) + c:RegisterEffect(e1) end function s.regop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if not c:IsFusionSummoned() then return end - --immune + --After this card is Fusion Summoned, for the rest of this turn, it is unaffected by the activated effects of any other monsters Special Summoned from the Extra Deck local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) - e1:SetRange(LOCATION_MZONE) + e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_IMMUNE_EFFECT) - e1:SetValue(s.efilter) + e1:SetValue(s.immval) e1:SetReset(RESETS_STANDARD_PHASE_END) c:RegisterEffect(e1) end -function s.efilter(e,te) - local tc=te:GetOwner() - return tc:IsSpecialSummoned() and tc:IsSummonLocation(LOCATION_EXTRA) and tc~=e:GetHandler() - and te:IsMonsterEffect() and te:IsActivated() and te:GetActivateLocation()==LOCATION_MZONE +function s.immval(e,te) + local tc=te:GetHandler() + local trig_loc,trig_sum_loc=Duel.GetChainInfo(0,CHAININFO_TRIGGERING_LOCATION,CHAININFO_TRIGGERING_SUMMON_LOCATION) + if not (te:IsActivated() and te:IsMonsterEffect() and trig_loc==LOCATION_MZONE and tc~=e:GetHandler()) then return false end + if not Duel.IsChainSolving() or (tc:IsRelateToEffect(te) and tc:IsFaceup() and tc:IsLocation(trig_loc)) then + return tc:IsSummonLocation(LOCATION_EXTRA) + else + return trig_sum_loc&LOCATION_EXTRA>0 + end end -function s.regop2(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - local e1=Effect.CreateEffect(c) - --Add to hand or Special Summom 1 "Dogmatika" monster or "Fallen of Albaz" - e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) - e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e1:SetCode(EVENT_PHASE+PHASE_END) - e1:SetRange(LOCATION_GRAVE) - e1:SetCountLimit(1,id) - e1:SetTarget(s.thtg) - e1:SetOperation(s.thop) - e1:SetReset(RESETS_STANDARD_PHASE_END) - c:RegisterEffect(e1) +function s.thspfilter(c,e,tp,mmz_chk) + return (c:IsSetCard(SET_DOGMATIKA) or c:IsCode(CARD_ALBAZ)) and c:IsMonster() and (c:IsAbleToHand() + or (mmz_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end -function s.thfilter(c,e,tp,ft) - return c:IsMonster() and (c:IsSetCard(SET_DOGMATIKA) or c:IsCode(CARD_ALBAZ)) - and (c:IsAbleToHand() or (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0)) +function s.thsptg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)>0) end + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end -function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp,ft) end - Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) +function s.thspop(e,tp,eg,ep,ev,re,r,rp) + local mmz_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) + local sc=Duel.SelectMatchingCard(tp,s.thspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,mmz_chk):GetFirst() + if not sc then return end + aux.ToHandOrElse(sc,tp, + function() return mmz_chk and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, + function() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, + aux.Stringid(id,3) + ) end -function s.thop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,ft):GetFirst() - if tc then - aux.ToHandOrElse(tc,tp,function(c) - return tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0 end, - function(c) - Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end, - aux.Stringid(id,1)) - end -end \ No newline at end of file diff --git a/official/c48032131.lua b/official/c48032131.lua index 38067f9cd2..e55ffda061 100644 --- a/official/c48032131.lua +++ b/official/c48032131.lua @@ -3,25 +3,27 @@ --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) - --activate + --Activate local e0=Effect.CreateEffect(c) e0:SetType(EFFECT_TYPE_ACTIVATE) e0:SetCode(EVENT_FREE_CHAIN) - e0:SetHintTiming(0,TIMING_STANDBY_PHASE) c:RegisterEffect(e0) - --atk up + --Make all "HERO" monsters you control gain 400 ATK local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) - e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e1:SetType(EFFECT_TYPE_QUICK_O) + e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_SZONE) - e1:SetHintTiming(0,TIMING_STANDBY_PHASE) - e1:SetCode(EVENT_PHASE|PHASE_STANDBY) e1:SetCountLimit(1,id) + e1:SetHintTiming(TIMING_STANDBY_PHASE) + e1:SetCondition(function() return Duel.IsPhase(PHASE_STANDBY) end) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) - --banish + --Banish 1 card from your opponent's hand (random), field, or GY local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_REMOVE) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e2:SetProperty(EFFECT_FLAG_DELAY) @@ -32,12 +34,13 @@ function s.initial_effect(c) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) c:RegisterEffect(e2) - --to hand + --Add 1 "Destiny HERO" 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_SINGLE+EFFECT_TYPE_TRIGGER_O) - e3:SetCode(EVENT_DESTROYED) e3:SetProperty(EFFECT_FLAG_DELAY) + e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) @@ -45,48 +48,40 @@ function s.initial_effect(c) c:RegisterEffect(e3) end s.listed_series={SET_HERO,SET_DESTINY_HERO} -s.listed_names={76263644} -function s.atkfilter(c) - return c:IsFaceup() and c:IsSetCard(SET_HERO) -end +s.listed_names={76263644} --"Destiny End Dragoon" function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - return Duel.IsExistingMatchingCard(s.atkfilter,tp,LOCATION_MZONE,0,1,nil) - end + local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,0,nil) + if chk==0 then return #g>0 end + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,400) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end - local tg=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,0,nil) - if #tg>0 then - local sc=tg:GetFirst() - for sc in aux.Next(tg) do - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - e1:SetValue(400) - sc:RegisterEffect(e1) - end + local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_HERO),tp,LOCATION_MZONE,0,nil) + if #g==0 then return end + local c=e:GetHandler() + for sc in g:Iter() do + --All "HERO" monsters you control gain 400 ATK + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e1:SetCode(EFFECT_UPDATE_ATTACK) + e1:SetValue(400) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + sc:RegisterEffect(e1) end end -function s.cfilter(c,tp) - return c:IsFaceup() and ((c:IsLevelAbove(8) and c:IsSetCard(SET_DESTINY_HERO)) or c:IsCode(76263644)) and c:IsControler(tp) +function s.rmconfilter(c,tp) + return ((c:IsLevelAbove(8) and c:IsSetCard(SET_DESTINY_HERO)) or c:IsCode(76263644)) and c:IsControler(tp) and c:IsFaceup() end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.cfilter,1,nil,tp) + return eg:IsExists(s.rmconfilter,1,nil,tp) end -function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - local loc=LOCATION_ONFIELD|LOCATION_GRAVE|LOCATION_HAND - if chkc then return chkc:IsOnField() and chkc:IsFaceup() end - if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,loc,1,nil) end - local g=Duel.GetMatchingGroup(Card.IsAbleToRemove,tp,0,loc,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) +function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToRemove,tp,0,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,1,nil) end + Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local loc=LOCATION_ONFIELD|LOCATION_GRAVE|LOCATION_HAND - local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,loc,1,1,nil) + local g=Duel.SelectMatchingCard(tp,Card.IsAbleToRemove,tp,0,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_GRAVE,1,1,nil) if #g>0 then Duel.HintSelection(g) Duel.Remove(g,POS_FACEUP,REASON_EFFECT) @@ -94,7 +89,7 @@ function s.rmop(e,tp,eg,ep,ev,re,r,rp) end function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_SZONE) + return c:IsReason(REASON_EFFECT) and c:IsPreviousLocation(LOCATION_STZONE) end function s.thfilter(c) return c:IsSetCard(SET_DESTINY_HERO) and c:IsMonster() and c:IsAbleToHand() @@ -110,4 +105,4 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(g,nil,REASON_EFFECT) Duel.ConfirmCards(1-tp,g) end -end \ No newline at end of file +end diff --git a/official/c48048590.lua b/official/c48048590.lua index 1d56365cf5..06a6c8c97b 100644 --- a/official/c48048590.lua +++ b/official/c48048590.lua @@ -3,66 +3,50 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Add to hand when summoned + --Add 1 "Polymerization" Normal Spell or "Fusion" Normal Spell from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SUMMON_SUCCESS) - e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id) - e1:SetCost(s.thcost) + e1:SetCost(Cost.AND(Cost.Discard(),s.cost)) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) c:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) - --Special summon a fusion material + --Special Summon from your GY 1 of the Fusion Materials mentioned on a monster in the Extra Deck, in face-down Defense Position local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_SPECIAL_SUMMON) e3:SetType(EFFECT_TYPE_IGNITION) e3:SetRange(LOCATION_MZONE) e3:SetCountLimit(1,{id,1}) - e3:SetCost(s.spcost) + e3:SetCost(Cost.AND(s.spcost,s.cost)) e3:SetTarget(s.sptg) e3:SetOperation(s.spop) c:RegisterEffect(e3) - Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,s.counterfilter) + Duel.AddCustomActivityCounter(id,ACTIVITY_SPSUMMON,function(c) return not (c:IsSummonLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION)) end) end s.listed_series={SET_FUSION} -function s.counterfilter(c) - return c:GetSummonLocation()~=LOCATION_EXTRA or c:IsType(TYPE_FUSION) -end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end + --You cannot Special Summon monsters from the Extra Deck, except Fusion Monsters, the turn you activate either of this card's effects local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) - e1:SetTarget(s.splimit) + e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsType(TYPE_FUSION) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) - aux.RegisterClientHint(e:GetHandler(),nil,tp,1,0,aux.Stringid(id,2),nil) - --lizard check - aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) -end -function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) - return not c:IsType(TYPE_FUSION) and c:IsLocation(LOCATION_EXTRA) -end -function s.lizfilter(e,c) - return not c:IsOriginalType(TYPE_FUSION) -end -function s.thcost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) - and s.cost(e,tp,eg,ep,ev,re,r,rp,0) end - Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD) - s.cost(e,tp,eg,ep,ev,re,r,rp,1) end function s.thfilter(c) - return c:IsNormalSpell() and c:IsSetCard(SET_FUSION) and c:IsAbleToHand() + return c:IsSetCard(SET_FUSION) and c:IsNormalSpell() and c:IsAbleToHand() end function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end @@ -76,29 +60,29 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmCards(1-tp,g) end end -function s.filter1(c,e,tp) - return c.material and c:IsType(TYPE_FUSION) and Duel.IsExistingMatchingCard(s.filter2,tp,LOCATION_GRAVE,0,1,nil,e,tp,c) +function s.spcostfilter(c,e,tp) + return c:IsType(TYPE_FUSION) and not c:IsPublic() and c.material and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,table.unpack(c.material)) end -function s.filter2(c,e,tp,fc) - return c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) and c:IsCode(table.unpack(fc.material)) +function s.spfilter(c,e,tp,...) + return c:IsCode(...) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEDOWN_DEFENSE) end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return s.cost(e,tp,eg,ep,ev,re,r,rp,0) and Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_EXTRA,0,1,nil,e,tp) end + if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) - local g=Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) - Duel.ConfirmCards(1-tp,g) - e:SetLabelObject(g:GetFirst()) - s.cost(e,tp,eg,ep,ev,re,r,rp,1) + local sc=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() + Duel.ConfirmCards(1-tp,sc) + Duel.ShuffleExtra(tp) + e:SetLabel(table.unpack(sc.material)) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.spop(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<1 then return end - local fc=e:GetLabelObject() - local g=Duel.SelectMatchingCard(tp,s.filter2,tp,LOCATION_GRAVE,0,1,1,nil,e,tp,fc) - if #g>0 then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE) + 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,e:GetLabel()) + if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEDOWN_DEFENSE)>0 then + Duel.ConfirmCards(1-tp,g) end -end \ No newline at end of file +end diff --git a/official/c50793215.lua b/official/c50793215.lua index 3aedd71780..578cc8ad01 100644 --- a/official/c50793215.lua +++ b/official/c50793215.lua @@ -3,101 +3,92 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Must be properly summoned before reviving c:EnableReviveLimit() - --Synchro summon procedure + --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) - --Take 1 level 4 or lower WATER monster from deck, and either special summon it or add it to hand + --Your opponent cannot target a Synchro Monster that used this card as material with monster effects local e1=Effect.CreateEffect(c) - e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) - e1:SetType(EFFECT_TYPE_IGNITION) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) - e1:SetRange(LOCATION_MZONE) - e1:SetCountLimit(1,id) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) + e1:SetCode(EVENT_BE_MATERIAL) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return r==REASON_SYNCHRO end) + e1:SetOperation(s.effop) c:RegisterEffect(e1) - --A synchro monster using this card cannot be targeted by opponent's monster effects + --Add to your hand, or Special Summon, 1 Level 4 or lower WATER monster from your Deck, and if you do, add 1 of your opponent's banished cards to their hand local e2=Effect.CreateEffect(c) - e2:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e2:SetCode(EVENT_BE_MATERIAL) - e2:SetCondition(s.indcon) - e2:SetOperation(s.indop) + e2:SetDescription(aux.Stringid(id,0)) + e2:SetCategory(CATEGORY_SEARCH+CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) + e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetRange(LOCATION_MZONE) + e2:SetCountLimit(1,id) + e2:SetTarget(s.thsptg) + e2:SetOperation(s.thspop) c:RegisterEffect(e2) - --If sent to GY, shuffle 1 banished card into deck + --Shuffle 1 banished card into the Deck local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,3)) + e3:SetDescription(aux.Stringid(id,1)) e3:SetCategory(CATEGORY_TODECK) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CARD_TARGET) + e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_TO_GRAVE) e3:SetCountLimit(1,{id,1}) e3:SetTarget(s.tdtg) e3:SetOperation(s.tdop) c:RegisterEffect(e3) end -function s.filter(c,e,tp,lc) - return c:IsAttribute(ATTRIBUTE_WATER) and c:IsLevelBelow(4) - and (c:IsAbleToHand() or (lc>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) -end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_REMOVED) and chkc:IsAbleToHand() end - if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_REMOVED,1,nil) - and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) - local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_REMOVED,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) -end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local tc=Duel.GetFirstTarget() - local hc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)):GetFirst() - if hc and aux.ToHandOrElse(hc,tp,s.spcheck(e,tp),s.spop(tp),aux.Stringid(id,1))~=0 and tc:IsRelateToEffect(e) then - Duel.SendtoHand(tc,nil,REASON_EFFECT) - end -end -function s.spcheck(e,tp) - return function(c) - return c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - end -end -function s.spop(tp) - return function(c) - return Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) - end -end -function s.indcon(e,tp,eg,ep,ev,re,r,rp) - return r==REASON_SYNCHRO -end -function s.indop(e,tp,eg,ep,ev,re,r,rp) +function s.effop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local rc=c:GetReasonCard() - --Cannot be targeted by opponent's monster effects + --Your opponent cannot target a Synchro Monster that used this card as material with monster effects local e1=Effect.CreateEffect(c) e1:SetDescription(3062) - e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) - e1:SetValue(s.efilter) + e1:SetValue(function(e,re,rp) return re:IsMonsterEffect() and rp==1-e:GetHandlerPlayer() end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) rc:RegisterEffect(e1) end -function s.efilter(e,re,rp) - return re:IsMonsterEffect() and e:GetHandlerPlayer()~=rp +function s.thspfilter(c,e,tp,mzone_chk) + return c:IsLevelBelow(4) and c:IsAttribute(ATTRIBUTE_WATER) and (c:IsAbleToHand() + or (mzone_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) +end +function s.thsptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsControler(1-tp) and chkc:IsLocation(LOCATION_REMOVED) and chkc:IsAbleToHand() end + if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,0,LOCATION_REMOVED,1,nil) + and Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)>0) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOHAND) + local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,0,LOCATION_REMOVED,1,1,nil) + Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) +end +function s.thspop(e,tp,eg,ep,ev,re,r,rp) + local mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) + local sc=Duel.SelectMatchingCard(tp,s.thspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,mzone_chk):GetFirst() + if not sc then return end + local tohand_or_ss_chk=aux.ToHandOrElse(sc,tp, + function() return mzone_chk and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, + function() return Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, + aux.Stringid(id,3) + ) + local tc=Duel.GetFirstTarget() + if tohand_or_ss_chk and tc:IsRelateToEffect(e) then + Duel.SendtoHand(tc,nil,REASON_EFFECT) + end end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_REMOVED) and chkc:IsAbleToDeck() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,Card.IsAbleToDeck,tp,LOCATION_REMOVED,LOCATION_REMOVED,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c51782995.lua b/official/c51782995.lua index 832c0e6640..c735c41e62 100644 --- a/official/c51782995.lua +++ b/official/c51782995.lua @@ -2,93 +2,73 @@ --Defender of Nephthys local s,id=GetID() function s.initial_effect(c) - --special summon + --Destroy 1 card in your hand, and if you do, Special Summon 1 Level 4 or lower "Nephthys" monster from your hand, except "Defender of Nephthys" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DESTROY) + e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_IGNITION) - e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) + e1:SetCountLimit(1,id) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --reg - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e2:SetCode(EVENT_TO_GRAVE) - e2:SetOperation(s.spr) - c:RegisterEffect(e2) - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,1)) - e3:SetCategory(CATEGORY_DESTROY) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e3:SetRange(LOCATION_GRAVE) - e3:SetCountLimit(1,{id,1}) - e3:SetCode(EVENT_PHASE|PHASE_STANDBY) - e3:SetCondition(s.descon) - e3:SetTarget(s.destg) - e3:SetOperation(s.desop) - e3:SetLabelObject(e2) - c:RegisterEffect(e3) + --Register when this card is destroyed + local e2a=Effect.CreateEffect(c) + e2a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e2a:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e2a:SetCode(EVENT_DESTROYED) + e2a:SetOperation(function(e,tp) local ct=(Duel.IsTurnPlayer(tp) and Duel.IsPhase(PHASE_STANDBY)) and 2 or 1 e:GetHandler():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,0,ct,ct) end) + c:RegisterEffect(e2a) + --Destroy 1 "Nephthys" monster in your Deck, except "Defender of Nephthys" + local e2b=Effect.CreateEffect(c) + e2b:SetDescription(aux.Stringid(id,1)) + e2b:SetCategory(CATEGORY_DESTROY) + e2b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2b:SetCode(EVENT_PHASE+PHASE_STANDBY) + e2b:SetRange(LOCATION_GRAVE) + e2b:SetCountLimit(1,{id,1}) + e2b:SetCondition(function(e,tp) local c=e:GetHandler() return Duel.IsTurnPlayer(tp) and c:IsReason(REASON_EFFECT) and c:HasFlagEffect(id) and (c:GetFlagEffectLabel(id)==1 or c:GetTurnID()~=Duel.GetTurnCount()) end) + e2b:SetTarget(s.destg) + e2b:SetOperation(s.desop) + c:RegisterEffect(e2b) end s.listed_series={SET_NEPHTHYS} s.listed_names={id} -function s.spfilter(c,e,tp) - return c:IsSetCard(SET_NEPHTHYS) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) +function s.handdesfilter(c,e,tp,res_chk) + return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,c,e,tp) or res_chk end -function s.filter(c,e,tp,chk,sp) - return ((chk==0 or sp) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,c,e,tp)) - or (chk==1 and not sp) +function s.spfilter(c,e,tp) + return c:IsLevelBelow(4) and c:IsSetCard(SET_NEPHTHYS) 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.filter,tp,LOCATION_HAND,0,1,nil,e,tp,0) end + and Duel.IsExistingMatchingCard(s.handdesfilter,tp,LOCATION_HAND,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_HAND) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end function s.spop(e,tp,eg,ep,ev,re,r,rp) + local res_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not Duel.IsExistingMatchingCard(s.handdesfilter,tp,LOCATION_HAND,0,1,nil,e,tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local sp=Duel.GetMatchingGroupCount(aux.TRUE,tp,LOCATION_HAND,0,nil)>1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND,0,1,nil,e,tp) - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_HAND,0,1,1,nil,e,tp,1,sp) - if #g==0 then return end - if Duel.Destroy(g,REASON_EFFECT)~=0 and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 then + local g=Duel.SelectMatchingCard(tp,s.handdesfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp,res_chk) + if #g>0 and Duel.Destroy(g,REASON_EFFECT)>0 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g2=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) - if #g2>0 then - Duel.SpecialSummon(g2,0,tp,tp,false,false,POS_FACEUP) + local sg=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) + if #sg>0 then + Duel.SpecialSummon(sg,0,tp,tp,false,false,POS_FACEUP) end end end -function s.spr(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - if (r&(REASON_DESTROY|REASON_EFFECT)~=(REASON_DESTROY|REASON_EFFECT)) then return end - if Duel.IsTurnPlayer(tp) and Duel.IsPhase(PHASE_STANDBY) then - e:SetLabel(Duel.GetTurnCount()) - c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,0,2) - else - e:SetLabel(0) - c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY|RESET_SELF_TURN,0,1) - end -end -function s.descon(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - return e:GetLabelObject():GetLabel()~=Duel.GetTurnCount() and tp==Duel.GetTurnPlayer() and c:GetFlagEffect(id)>0 -end -function s.desfilter(c) +function s.deckdesfilter(c) return c:IsSetCard(SET_NEPHTHYS) and c:IsMonster() and not c:IsCode(id) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return Duel.IsExistingMatchingCard(s.desfilter,tp,LOCATION_DECK,0,1,nil) end - local g=Duel.GetMatchingGroup(s.desfilter,tp,LOCATION_DECK,0,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) - c:ResetFlagEffect(id) + if chk==0 then return Duel.IsExistingMatchingCard(s.deckdesfilter,tp,LOCATION_DECK,0,1,nil) end + Duel.SetOperationInfo(0,CATEGORY_DESTROY,nil,1,tp,LOCATION_DECK) end function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectMatchingCard(tp,s.desfilter,tp,LOCATION_DECK,0,1,1,nil) + local g=Duel.SelectMatchingCard(tp,s.deckdesfilter,tp,LOCATION_DECK,0,1,1,nil) if #g>0 then Duel.Destroy(g,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c52331012.lua b/official/c52331012.lua index bfcf08666b..41b7254edd 100644 --- a/official/c52331012.lua +++ b/official/c52331012.lua @@ -3,105 +3,74 @@ --Scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Link Summon - Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACES_BEAST_BWARRIOR_WINGB),2,3) c:EnableReviveLimit() - --Special Summon from hand + --Link Summon procedure: 2+ Beast, Beast-Warrior, and/or Winged Beast monsters + Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACES_BEAST_BWARRIOR_WINGB),2) + --Special Summon 1 Level 4 or lower Beast, Beast-Warrior, or Winged Beast monster from your hand or GY, but negate its effects, also, return it to the hand during the End Phase local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_DISABLE+CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_QUICK_O) - e1:SetRange(LOCATION_MZONE) e1:SetCode(EVENT_FREE_CHAIN) + e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) - e1:SetHintTiming(0,TIMING_MAIN_END) - e1:SetCondition(s.spcon) + e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) + e1:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) and Duel.IsMainPhase() end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Decrease ATK + --Make all monsters your opponent currently controls lose 300 ATK for each Monster Type you control, until the end of this turn 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_DAMAGE_STEP+EFFECT_FLAG_DAMAGE_CAL) + e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_TO_GRAVE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.atktg) e2:SetOperation(s.atkop) c:RegisterEffect(e2) end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsMainPhase() and Duel.IsTurnPlayer(1-tp) -end function s.spfilter(c,e,tp) - return c:IsLevelBelow(4) and c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp) + return c:IsLevelBelow(4) and c:IsRace(RACES_BEAST_BWARRIOR_WINGB) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_HAND|LOCATION_GRAVE,0,1,nil,e,tp) - and Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end + 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) + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_MZONE) 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 c=e:GetHandler() - local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp) - local sc=g:GetFirst() + local sc=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),tp,LOCATION_HAND|LOCATION_GRAVE,0,1,1,nil,e,tp):GetFirst() if sc and Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_DISABLE) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - sc:RegisterEffect(e1,true) - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(EFFECT_DISABLE_EFFECT) - e2:SetReset(RESET_EVENT|RESETS_STANDARD) - sc:RegisterEffect(e2,true) - local fid=c:GetFieldID() - sc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,0,1,fid) - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,2)) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - e3:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e3:SetCode(EVENT_PHASE+PHASE_END) - e3:SetCountLimit(1) - e3:SetLabel(fid) - e3:SetLabelObject(sc) - e3:SetCondition(s.thcon) - e3:SetOperation(s.thop) - Duel.RegisterEffect(e3,tp) + --Negate its effects + sc:NegateEffects(e:GetHandler()) + --Return it to the hand during the End Phase + aux.DelayedOperation(sc,PHASE_END,id,e,tp,function(ag) Duel.SendtoHand(ag,nil,REASON_EFFECT) end,nil,0,0,aux.Stringid(id,2)) end Duel.SpecialSummonComplete() end -function s.thcon(e,tp,eg,ep,ev,re,r,rp) - local tc=e:GetLabelObject() - if tc:GetFlagEffectLabel(id)~=e:GetLabel() then - e:Reset() - return false - else - return true - end -end -function s.thop(e,tp,eg,ep,ev,re,r,rp) - Duel.SendtoHand(e:GetLabelObject(),nil,REASON_EFFECT) -end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,LOCATION_MZONE,0,1,nil) end - Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,nil,0,0,LOCATION_MZONE) + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,nil,1,1-tp,LOCATION_MZONE) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) local g=Duel.GetMatchingGroup(Card.IsFaceup,tp,0,LOCATION_MZONE,nil) - local ct=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil):GetClassCount(Card.GetRace) - for tc in aux.Next(g) do - local e1=Effect.CreateEffect(e:GetHandler()) + if #g==0 then return end + local c=e:GetHandler() + local val=Duel.GetMatchingGroup(Card.IsFaceup,tp,LOCATION_MZONE,0,nil):GetClassCount(Card.GetRace)*-300 + if val==0 then return end + for tc in g:Iter() do + --All monsters your opponent currently controls lose 300 ATK for each Monster Type you control, until the end of this turn + local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_UPDATE_ATTACK) - e1:SetValue(-300*ct) + e1:SetValue(val) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c53417695.lua b/official/c53417695.lua index 2fec51ecb1..2d61fa4e5b 100644 --- a/official/c53417695.lua +++ b/official/c53417695.lua @@ -3,25 +3,25 @@ --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) - --destroy + --Destroy both 1 "Unchained" monster you control and 1 card on the field local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_END_PHASE) + e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.destg) e1:SetOperation(s.desop) c:RegisterEffect(e1) - --special summon + --Special Summon 1 "Unchained" monster from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e2:SetCode(EVENT_DESTROYED) e2:SetProperty(EFFECT_FLAG_DELAY) + e2:SetCode(EVENT_DESTROYED) e2:SetCountLimit(1,{id,1}) e2:SetCondition(s.spcon) e2:SetTarget(s.sptg) @@ -29,25 +29,23 @@ function s.initial_effect(c) c:RegisterEffect(e2) end s.listed_series={SET_UNCHAINED} -function s.desfilter(c,tp,oc) - return c:IsFaceup() and c:IsSetCard(SET_UNCHAINED) and Duel.IsExistingTarget(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,Group.FromCards(c,oc)) +function s.resconfilter(c,tp) + return c:IsSetCard(SET_UNCHAINED) and c:IsMonster() and c:IsControler(tp) and c:IsFaceup() +end +function s.rescon(sg,e,tp,mg) + return sg:IsExists(s.resconfilter,1,nil,tp) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - local c=e:GetHandler() if chkc then return false end - if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,tp,c) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,tp,c) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - g:AddCard(c) - local g2=Duel.SelectTarget(tp,aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,g) - g:RemoveCard(c) - g:Merge(g2) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,2,0,0) + local g=Duel.GetMatchingGroup(Card.IsCanBeEffectTarget,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler(),e) + if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end + local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_DESTROY) + Duel.SetTargetCard(tg) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,tg,2,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tg=Duel.GetTargetCards(e) - if #tg==2 and tg:FilterCount(Card.IsRelateToEffect,nil,e)==2 then + if #tg==2 then Duel.Destroy(tg,REASON_EFFECT) end end @@ -70,4 +68,4 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c55051920.lua b/official/c55051920.lua index 9a32883a9d..b0661c9731 100644 --- a/official/c55051920.lua +++ b/official/c55051920.lua @@ -4,82 +4,75 @@ local s,id=GetID() function s.initial_effect(c) --Activate + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_ACTIVATE) + e0:SetCode(EVENT_FREE_CHAIN) + c:RegisterEffect(e0) + --Neither player can target 1 "Orcust" or "World Legacy" card you control with card effects this turn local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetType(EFFECT_TYPE_QUICK_O) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetHintTiming(0,TIMING_END_PHASE) + e1:SetRange(LOCATION_SZONE) + e1:SetCountLimit(1) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMINGS_CHECK_MONSTER) + e1:SetCost(s.effcost) + e1:SetTarget(s.efftg) + e1:SetOperation(s.effop) c:RegisterEffect(e1) - --Targeted "Orcust" or "World Legacy" card cannot be targeted by card effects + --If other "Orcust" and/or "World Legacy" card(s) you control would be destroyed by battle or card effect, you can send this card to the GY instead local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetType(EFFECT_TYPE_QUICK_O) - e2:SetCode(EVENT_FREE_CHAIN) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) + e2:SetCode(EFFECT_DESTROY_REPLACE) e2:SetRange(LOCATION_SZONE) - e2:SetCountLimit(1) - e2:SetCost(s.immcost) - e2:SetTarget(s.immtg) - e2:SetOperation(s.immop) + e2:SetTarget(s.reptg) + e2:SetValue(function(e,c) return s.repfilter(c,e:GetHandlerPlayer()) end) + e2:SetOperation(function(e) Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT|REASON_REPLACE) end) c:RegisterEffect(e2) - --Substitute destruction for an "Orcust" or "World Legacy" card(s) - local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) - e3:SetCode(EFFECT_DESTROY_REPLACE) - e3:SetRange(LOCATION_SZONE) - e3:SetTarget(s.reptg) - e3:SetValue(s.repval) - e3:SetOperation(s.repop) - c:RegisterEffect(e3) end s.listed_series={SET_ORCUST,SET_WORLD_LEGACY} s.listed_names={id} -function s.cfilter(c,tp) +function s.effcostfilter(c,tp) return c:IsAbleToRemoveAsCost() and c:IsMonster() and aux.SpElimFilter(c,false,true) - and Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,c) + and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,c) end -function s.filter(c) - return c:IsFaceup() and (c:IsSetCard(SET_ORCUST) or c:IsSetCard(SET_WORLD_LEGACY)) and not c:IsCode(id) +function s.tgfilter(c) + return c:IsSetCard({SET_ORCUST,SET_WORLD_LEGACY}) and c:IsFaceup() and not c:IsCode(id) and not c:HasFlagEffect(id) 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,nil,tp) end - local g=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) +function s.effcost(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.effcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,nil,tp) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local g=Duel.SelectMatchingCard(tp,s.effcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,nil,tp) Duel.Remove(g,POS_FACEUP,REASON_COST) end -function s.immtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_ONFIELD) and chkc:IsControler(tp) and s.filter(chkc) end - if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_ONFIELD,0,1,nil) end - Duel.SelectTarget(tp,s.filter,tp,LOCATION_ONFIELD,0,1,1,nil) +function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and s.tgfilter(chkc) end + if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_ONFIELD,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_APPLYTO) + Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_ONFIELD,0,1,1,nil) end -function s.immop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() +function s.effop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) then - local e1=Effect.CreateEffect(c) + if tc:IsRelateToEffect(e) then + tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1) + --Neither player can target it with card effects this turn + local e1=Effect.CreateEffect(e:GetHandler()) e1:SetDescription(3002) - e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_BE_EFFECT_TARGET) - e1:SetReset(RESETS_STANDARD_PHASE_END) e1:SetValue(1) + e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end function s.repfilter(c,tp) - return c:IsFaceup() and (c:IsSetCard(SET_ORCUST) or c:IsSetCard(SET_WORLD_LEGACY)) and c:IsOnField() - and c:IsControler(tp) and c:IsReason(REASON_EFFECT|REASON_BATTLE) and not c:IsReason(REASON_REPLACE) + return c:IsSetCard({SET_ORCUST,SET_WORLD_LEGACY}) and c:IsOnField() and c:IsControler(tp) and c:IsFaceup() + and c:IsReason(REASON_BATTLE|REASON_EFFECT) and not c:IsReason(REASON_REPLACE) end function s.reptg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsAbleToGrave() and not eg:IsContains(e:GetHandler()) - and eg:IsExists(s.repfilter,1,e:GetHandler(),tp) end - if Duel.SelectEffectYesNo(tp,e:GetHandler(),96) then - return true - else - return false - end -end -function s.repval(e,c) - return s.repfilter(c,e:GetHandlerPlayer()) + local c=e:GetHandler() + if chk==0 then return c:IsAbleToGrave() and not eg:IsContains(c) and eg:IsExists(s.repfilter,1,nil,tp) end + return Duel.SelectEffectYesNo(tp,c,96) end -function s.repop(e,tp,eg,ep,ev,re,r,rp) - Duel.SendtoGrave(e:GetHandler(),REASON_EFFECT) -end \ No newline at end of file diff --git a/official/c56980148.lua b/official/c56980148.lua index b72b473f68..9b34780d57 100644 --- a/official/c56980148.lua +++ b/official/c56980148.lua @@ -3,7 +3,7 @@ --scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Search 1 "Dinowrestler" monster or 1 "World Dino Wrestling" + --Add 1 "Dinowrestler" monster or 1 "World Dino Wrestling" from your Deck to your hand local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) @@ -36,7 +36,7 @@ function s.initial_effect(c) c:RegisterEffect(e3) end s.listed_series={SET_DINOWRESTLER} -s.listed_names={90173539,id} +s.listed_names={90173539,id} --"World Dino Wrestling" function s.thfilter(c) return ((c:IsSetCard(SET_DINOWRESTLER) and c:IsMonster()) or c:IsCode(90173539)) and c:IsAbleToHand() end @@ -65,12 +65,12 @@ 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) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,1,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local tc=Duel.GetFirstTarget() if tc:IsRelateToEffect(e) then Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) diff --git a/official/c60375194.lua b/official/c60375194.lua index 0d65bf50d2..bb37a2ed1d 100644 --- a/official/c60375194.lua +++ b/official/c60375194.lua @@ -3,42 +3,45 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Destroy all cards on the field, except the targeted "Vendread" ritual monster + --Choose 1 Ritual Summoned "Vendread" monster you control, and destroy all cards on the field, except the chosen monster local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) - e1:SetCondition(s.condition) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e1:SetCondition(function(e,tp) return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0) end) e1:SetTarget(s.target) e1:SetOperation(s.activate) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_END_PHASE) c:RegisterEffect(e1) end s.listed_series={SET_VENDREAD} -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return Duel.GetFieldGroupCount(tp,0,LOCATION_ONFIELD)>Duel.GetFieldGroupCount(tp,LOCATION_ONFIELD,0) -end -function s.filter(c) - return c:IsFaceup() and c:IsSetCard(SET_VENDREAD) and c:IsRitualSummoned() +function s.vendreadfilter(c) + return c:IsRitualSummoned() and c:IsSetCard(SET_VENDREAD) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_MZONE,0,1,nil) end + if chk==0 then return Duel.IsExistingMatchingCard(s.vendreadfilter,tp,LOCATION_MZONE,0,1,nil) end local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,0,0,0) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g-2,tp,0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) - if #g==0 then return end - Duel.HintSelection(g) - local dg=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,g) - if #dg~=0 then - Duel.Destroy(dg,REASON_EFFECT) + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,1)) + local sc=Duel.SelectMatchingCard(tp,s.vendreadfilter,tp,LOCATION_MZONE,0,1,1,nil):GetFirst() + if not sc then return end + Duel.HintSelection(sc) + local c=e:GetHandler() + local exc=c:IsRelateToEffect(e) and Group.FromCards(sc,c) or sc + local g=Duel.GetMatchingGroup(nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,exc) + if #g>0 then + Duel.Destroy(g,REASON_EFFECT) end - local e1=Effect.CreateEffect(e:GetHandler()) + --It cannot attack directly while it remains face-up on the field + local e1=Effect.CreateEffect(c) + e1:SetDescription(3207) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_DIRECT_ATTACK) e1:SetReset(RESET_EVENT|RESETS_STANDARD) - g:GetFirst():RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,0)) - g:GetFirst():RegisterEffect(e1) -end \ No newline at end of file + sc:RegisterEffect(e1) +end diff --git a/official/c61245672.lua b/official/c61245672.lua index 5fa2843dde..35ef1007be 100644 --- a/official/c61245672.lua +++ b/official/c61245672.lua @@ -2,59 +2,60 @@ --Decode Talker Heatsoul local s,id=GetID() function s.initial_effect(c) - --link summon - Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2,99,s.lcheck) c:EnableReviveLimit() - --Increase ATK + --Link Summon procedure: 2+ Cyberse monsters with different Attributes + Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_CYBERSE),2,99,s.matcheck) + --Gains 500 ATK for each monster it points to local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) + e1:SetCode(EFFECT_UPDATE_ATTACK) e1:SetRange(LOCATION_MZONE) - e1:SetValue(s.atkval) + e1:SetValue(function(e,c) return c:GetLinkedGroup():FilterCount(Card.IsMonster,nil)*500 end) c:RegisterEffect(e1) - --Draw and Special Summon + --Draw 1 card, then if your LP are 2000 or less, you can apply this effect: ● Banish this card from the field, and if you do, Special Summon 1 Link-3 or lower Cyberse monster from your Extra Deck, except "Decode Talker Heatsoul" local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_DRAW+CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) - e2:SetCountLimit(1,id) e2:SetRange(LOCATION_MZONE) - e2:SetHintTiming(0,TIMING_END_PHASE) + e2:SetCountLimit(1,id) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCost(Cost.PayLP(1000)) - e2:SetTarget(s.target) - e2:SetOperation(s.operation) + e2:SetTarget(s.drtg) + e2:SetOperation(s.drop) c:RegisterEffect(e2) end s.listed_names={id} -function s.lcheck(g,lc,sumtype,tp) +function s.matcheck(g,lc,sumtype,tp) return g:CheckDifferentPropertyBinary(Card.GetAttribute,lc,sumtype,tp) end -function s.atkval(e,c) - return c:GetLinkedGroup():FilterCount(Card.IsMonster,nil)*500 -end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) +function s.drtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsPlayerCanDraw(tp,1) end Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) + Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,e:GetHandler(),1,tp,0) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) end function s.spfilter(c,e,tp,mc) - return c:IsRace(RACE_CYBERSE) and c:IsLinkBelow(3) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and not c:IsCode(id) + return c:IsLinkBelow(3) and c:IsRace(RACE_CYBERSE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and not c:IsCode(id) + and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +function s.drop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) - if Duel.Draw(p,d,REASON_EFFECT)~=0 and Duel.GetLP(tp)<=2000 and c:IsRelateToEffect(e) and c:IsAbleToRemove() - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then - Duel.BreakEffect() - if Duel.Remove(c,POS_FACEUP,REASON_EFFECT)~=0 then - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) - if #g>0 then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) - end + if Duel.Draw(p,d,REASON_EFFECT)>0 and Duel.GetLP(tp)<=2000 and c:IsRelateToEffect(e) and c:IsAbleToRemove() + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) + and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then + Duel.BreakEffect() + if Duel.Remove(c,POS_FACEUP,REASON_EFFECT)>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp) + if #g>0 then + Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end + end end -end \ No newline at end of file +end diff --git a/official/c66380357.lua b/official/c66380357.lua index 9ca4863f95..750921a1c3 100644 --- a/official/c66380357.lua +++ b/official/c66380357.lua @@ -3,11 +3,12 @@ --Anime version scripted by pyrQ, updated by Larry126 local s,id=GetID() function s.initial_effect(c) - --Activate + --Special Summon as many Link-1 "Appliancer" monsters from your GY as possible to your zones 1 "Appliancer" Link Monster you control points to, but banish them during the End Phase local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) - e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetTarget(s.target) @@ -15,66 +16,31 @@ function s.initial_effect(c) c:RegisterEffect(e1) end s.listed_series={SET_APPLIANCER} -function s.filter(c,e,tp) - return c:IsSetCard(SET_APPLIANCER) and c:IsLinkMonster() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c) +function s.tgfilter(c,e,tp) + return c:IsSetCard(SET_APPLIANCER) and c:IsLinkMonster() and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,c:GetFreeLinkedZone()) end -function s.spfilter(c,e,tp,fc) - local zone=fc:GetFreeLinkedZone()&ZONES_MMZ - return c:IsSetCard(SET_APPLIANCER) and c:IsLinkMonster() and c:IsLink(1) - and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) +function s.spfilter(c,e,tp,zone) + return c:IsLink(1) and c:IsSetCard(SET_APPLIANCER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,tp,zone) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc,e,tp) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc,e,tp) end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil,e,tp) end + and Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,e,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - local g=Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) - local sg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp,g:GetFirst()) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,sg,1,0,LOCATION_GRAVE) + Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,e,tp) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local fid=e:GetHandler():GetFieldID() - local c=Duel.GetFirstTarget() - local zone=c:GetFreeLinkedZone()&ZONES_MMZ - local count=s.zone_count(zone) - local sg=Duel.GetMatchingGroup(aux.NecroValleyFilter(s.spfilter),tp,LOCATION_GRAVE,0,nil,e,tp,c) - if #sg0 and Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP,zone) then - tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,0,1,fid) - end - end - end - Duel.SpecialSummonComplete() - --banish them during this End Phase - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE) - e1:SetCode(EVENT_PHASE+PHASE_END) - e1:SetLabel(fid) - e1:SetOperation(s.rmop) - e1:SetReset(RESET_PHASE|PHASE_END) - e1:SetCountLimit(1) - Duel.RegisterEffect(e1,tp) + local tc=Duel.GetFirstTarget() + if not (tc:IsRelateToEffect(e) and tc:IsFaceup()) then return end + local zone=tc:GetFreeLinkedZone() + local ft=Duel.GetLocationCount(tp,LOCATION_MZONE,tp,LOCATION_REASON_TOFIELD,zone) + if not (zone>0 and ft>0) then return end + if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,ft,ft,nil,e,tp,zone) + if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP,zone)>0 then + --Banish them during the End Phase + aux.DelayedOperation(g,PHASE_END,id,e,tp,function(ag) Duel.Remove(ag,POS_FACEUP,REASON_EFFECT) end,nil,nil,nil,aux.Stringid(id,1)) end end -function s.rmfilter(c,e) - return c:GetFlagEffectLabel(id)==e:GetLabel() -end -function s.rmop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_MZONE,0,nil,e) - if #g>0 then Duel.Remove(g,POS_FACEUP,REASON_EFFECT) end -end -function s.zone_count(z) - local c=0 - while z>0 do - c=c+1 - z=z&(z-1) - end - return c -end \ No newline at end of file diff --git a/official/c66809920.lua b/official/c66809920.lua index f495d77620..bd0914393a 100644 --- a/official/c66809920.lua +++ b/official/c66809920.lua @@ -3,36 +3,34 @@ --scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) - --damage + --Add 1 "Mischief of the Time Goddess" from your GY to your hand local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_TOHAND+CATEGORY_LEAVE_GRAVE) e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_TOHAND) e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_SPSUMMON_SUCCESS) - e1:SetProperty(EFFECT_FLAG_DELAY) - e1:SetCondition(s.thcon) + e1:SetCountLimit(1,id) + e1:SetCondition(function(e,tp,eg,ep,ev,re,r,rp) return re and re:IsSpellEffect() and e:GetHandler():IsSummonLocation(LOCATION_HAND) end) e1:SetTarget(s.thtg) e1:SetOperation(s.thop) - e1:SetCountLimit(1,id) c:RegisterEffect(e1) - --remove + --Banish 1 monster from your opponent's GY, then this card's ATK becomes equal to the banished monster's original ATK until the end of this turn local e2=Effect.CreateEffect(c) - e2:SetCategory(CATEGORY_REMOVE+CATEGORY_LEAVE_GRAVE) e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_REMOVE+CATEGORY_ATKCHANGE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) + e2:SetCountLimit(1,{id,1}) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetCondition(s.rmcon) e2:SetTarget(s.rmtg) e2:SetOperation(s.rmop) - e2:SetCountLimit(1,{id,1}) c:RegisterEffect(e2) end s.listed_series={SET_VALKYRIE} -s.listed_names={92182447} -function s.thcon(e,tp,eg,ep,ev,re,r,rp) - return re and re:GetHandler():IsSpell() and e:GetHandler():IsPreviousLocation(LOCATION_HAND) -end +s.listed_names={92182447,id} --"Mischief of the Time Goddess" function s.thfilter(c) return c:IsCode(92182447) and c:IsAbleToHand() end @@ -41,7 +39,7 @@ function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chk==0 then return Duel.IsExistingTarget(s.thfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,s.thfilter,tp,LOCATION_GRAVE,0,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() @@ -49,32 +47,34 @@ function s.thop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoHand(tc,nil,REASON_EFFECT) end end -function s.cfilter(c) - return c:IsSetCard(SET_VALKYRIE) and not c:IsCode(id) +function s.rmconfilter(c) + return c:IsSetCard(SET_VALKYRIE) and c:IsFaceup() and not c:IsCode(id) end function s.rmcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_MZONE,0,1,nil) + return Duel.IsExistingMatchingCard(s.rmconfilter,tp,LOCATION_MZONE,0,1,nil) end function s.rmfilter(c) return c:IsAbleToRemove() and c:IsMonster() end function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,0,LOCATION_GRAVE,1,nil) end - Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_GRAVE) + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,e:GetHandler(),1,tp,0) end function s.rmop(e,tp,eg,ep,ev,re,r,rp) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local sc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,0,LOCATION_GRAVE,1,1,nil):GetFirst() + if not sc then return end + Duel.HintSelection(sc) local c=e:GetHandler() - local rc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,0,LOCATION_GRAVE,1,1,nil):GetFirst() - if rc then - if Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)~=0 and c:IsRelateToEffect(e) and c:IsFaceup() then - Duel.BreakEffect() - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e1:SetReset(RESETS_STANDARD_PHASE_END) - e1:SetCode(EFFECT_SET_ATTACK) - e1:SetValue(rc:GetBaseAttack()) - c:RegisterEffect(e1) - end + if Duel.Remove(sc,POS_FACEUP,REASON_EFFECT)>0 and c:IsRelateToEffect(e) and c:IsFaceup() then + Duel.BreakEffect() + --This card's ATK becomes equal to the banished monster's original ATK until the end of this turn + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_SET_ATTACK) + e1:SetValue(sc:GetBaseAttack()) + e1:SetReset(RESETS_STANDARD_DISABLE_PHASE_END) + c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c67647362.lua b/official/c67647362.lua index a7f516c9e4..c80d1f2b79 100644 --- a/official/c67647362.lua +++ b/official/c67647362.lua @@ -3,11 +3,10 @@ --Scripted by ahtelel local s,id=GetID() function s.initial_effect(c) - --Must be properly summoned before reviving c:EnableReviveLimit() - --Link summon procedure - Link.AddProcedure(c,nil,2,2,s.lcheck) - --Special summon 1 "Plunder Patroll" monster from extra deck + --Link Summon procedure: 2 monsters including a "Plunder Patroll" monster + Link.AddProcedure(c,nil,2,2,s.matcheck) + --Special Summon 1 "Plunder Patroll" monster from your Extra Deck with the same Attribute as a monster your opponent controls or is in their GY, and if you do, equip that target to it, then draw 1 card local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_EQUIP+CATEGORY_DRAW) @@ -15,60 +14,46 @@ function s.initial_effect(c) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E) e1:SetCountLimit(1,id) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) end s.listed_series={SET_PLUNDER_PATROLL} -function s.lcheck(g,lc,sumtype,tp) +function s.matcheck(g,lc,sumtype,tp) return g:IsExists(Card.IsSetCard,1,nil,SET_PLUNDER_PATROLL,lc,sumtype,tp) end -function s.filter(c,e,tp,att) - return c:IsSetCard(SET_PLUNDER_PATROLL) and c:IsAttribute(att) - and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 +function s.spfilter(c,e,tp,att) + return c:IsSetCard(SET_PLUNDER_PATROLL) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 + and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttribute,c:GetAttribute()),tp,0,LOCATION_MZONE|LOCATION_GRAVE,1,nil) end -function s.cfilter(c) - return c:IsMonster() and (c:IsFaceup() or c:IsLocation(LOCATION_GRAVE)) -end -function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) - local att=0 - for gc in aux.Next(Duel.GetMatchingGroup(s.cfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,nil)) do - att=att|gc:GetAttribute() - end - if chk==0 then return att>0 and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 +function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and chkc:IsType(TYPE_EFFECT) and chkc:IsFaceup() end + if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsPlayerCanDraw(tp,1) and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,nil) - and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_EXTRA,0,1,nil,e,tp,att) - and Duel.IsPlayerCanDraw(tp,1) end + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsType,TYPE_EFFECT),tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) - Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_EQUIP,g,1,tp,0) + Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) end function s.spop(e,tp,eg,ep,ev,re,r,rp) - local att=0 - for gc in aux.Next(Duel.GetMatchingGroup(s.cfilter,tp,0,LOCATION_MZONE|LOCATION_GRAVE,nil)) do - att=att|gc:GetAttribute() - end - if att==0 then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,att):GetFirst() - if not sc or Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)<1 then return end local tc=Duel.GetFirstTarget() - if tc and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_EFFECT) - and tc:IsControler(tp) and Duel.Equip(tp,tc,sc,true) 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 sc and Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP)>0 and tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_EFFECT) + and tc:IsControler(tp) and Duel.Equip(tp,tc,sc) then + --Equip limit local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_EQUIP_LIMIT) + e1:SetValue(function(e,c) return c==sc end) e1:SetReset(RESET_EVENT|RESETS_STANDARD) - e1:SetValue(s.eqlimit) - e1:SetLabelObject(sc) tc:RegisterEffect(e1) Duel.BreakEffect() Duel.Draw(tp,1,REASON_EFFECT) end end -function s.eqlimit(e,c) - return c==e:GetLabelObject() -end \ No newline at end of file diff --git a/official/c69217334.lua b/official/c69217334.lua index 163a04fdb7..7c46eeb5e9 100644 --- a/official/c69217334.lua +++ b/official/c69217334.lua @@ -4,102 +4,107 @@ local s,id=GetID() function s.initial_effect(c) --Activate + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_ACTIVATE) + e0:SetCode(EVENT_FREE_CHAIN) + c:RegisterEffect(e0) + --Make the Level of 1 Ritual Monster in your hand become the Level of 1 Ritual Monster you control local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_LVCHANGE) + e1:SetType(EFFECT_TYPE_IGNITION) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) + e1:SetRange(LOCATION_FZONE) + e1:SetCountLimit(1) + e1:SetTarget(s.lvtg) + e1:SetOperation(s.lvop) c:RegisterEffect(e1) - --Change the level of Ritual monster + --Activate 1 of these effects local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetType(EFFECT_TYPE_IGNITION) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2:SetProperty(EFFECT_FLAG_DELAY) + e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) e2:SetCountLimit(1) - e2:SetTarget(s.lvtg) - e2:SetOperation(s.lvop) + e2:SetCondition(s.effcon) + e2:SetTarget(s.efftg) + e2:SetOperation(s.effop) c:RegisterEffect(e2) - --Draw 1 card or destroy 1 card on the field - local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e3:SetCode(EVENT_SPSUMMON_SUCCESS) - e3:SetProperty(EFFECT_FLAG_DELAY) - e3:SetRange(LOCATION_FZONE) - e3:SetCountLimit(1) - e3:SetCondition(s.condition) - e3:SetTarget(s.target) - c:RegisterEffect(e3) end -s.listed_names={46427957,72426662} -function s.lvfilter(c,tp) - return c:IsFaceup() and c:IsType(TYPE_RITUAL) - and Duel.IsExistingMatchingCard(s.lvcfilter,tp,LOCATION_HAND,0,1,nil,c) +s.listed_names={46427957,72426662} --"Ruin, Queen of Oblivion", "Demise, King of Armageddon" +function s.tgfilter(c,tp) + return c:IsRitualMonster() and c:IsFaceup() and Duel.IsExistingMatchingCard(s.revealfilter,tp,LOCATION_HAND,0,1,nil,c:GetLevel()) end -function s.lvcfilter(c,mc) - return c:IsRitualMonster() and not c:IsPublic() and not c:IsLevel(mc:GetLevel()) +function s.revealfilter(c,lv) + return c:IsRitualMonster() and not c:IsPublic() and not c:IsLevel(lv) end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.lvfilter(chkc,tp) end - if chk==0 then return Duel.IsExistingTarget(s.lvfilter,tp,LOCATION_MZONE,0,1,nil,tp) end + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.tgfilter(chkc,tp) end + if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - local g=Duel.SelectTarget(tp,s.lvfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) - local cg=Duel.SelectMatchingCard(tp,s.lvcfilter,tp,LOCATION_HAND,0,1,1,nil,g:GetFirst()) - Duel.ConfirmCards(1-tp,cg) - Duel.ShuffleHand(tp) - e:SetLabelObject(cg:GetFirst()) + Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) - if not e:GetHandler():IsRelateToEffect(e) then return end local tc=Duel.GetFirstTarget() - local pc=e:GetLabelObject() - if tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) and tc:IsFaceup() then + local lv=tc:GetLevel() + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) + local sc=Duel.SelectMatchingCard(tp,s.revealfilter,tp,LOCATION_HAND,0,1,1,nil,lv):GetFirst() + if not sc then return end + --Show it until the end of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_CHANGE_LEVEL) - e1:SetValue(tc:GetLevel()) + e1:SetCode(EFFECT_PUBLIC) e1:SetReset(RESETS_STANDARD_PHASE_END) - pc:RegisterEffect(e1) - local e2=Effect.CreateEffect(e:GetHandler()) - e2:SetType(EFFECT_TYPE_SINGLE) - e2:SetCode(EFFECT_PUBLIC) - e2:SetReset(RESETS_STANDARD_PHASE_END) - pc:RegisterEffect(e2) + sc:RegisterEffect(e1) + --The Level of the shown Ritual Monster becomes the targeted monster's Level, until the end of this turn + local e2=e1:Clone() + e2:SetCode(EFFECT_CHANGE_LEVEL) + e2:SetValue(lv) + sc:RegisterEffect(e2) end end -function s.cfilter(c,tp) - return c:IsCode(46427957,72426662) and c:IsControler(tp) and c:IsRitualSummoned() +function s.effconfilter(c,tp) + return c:IsCode(46427957,72426662) and c:IsRitualSummoned() and c:IsControler(tp) and c:IsFaceup() end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.cfilter,1,nil,tp) +function s.effcon(e,tp,eg,ep,ev,re,r,rp) + return eg:IsExists(s.effconfilter,1,nil,tp) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) +function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) local b1=Duel.IsPlayerCanDraw(tp,1) - local g=Duel.GetMatchingGroup(aux.TRUE,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,nil) + local g=Duel.GetFieldGroup(tp,LOCATION_ONFIELD,LOCATION_ONFIELD) local b2=#g>0 if chk==0 then return b1 or b2 end - local sel=Duel.SelectEffect(tp, - {b1,aux.Stringid(id,0)}, - {b2,aux.Stringid(id,1)}) - if sel==1 then + local op=Duel.SelectEffect(tp, + {b1,aux.Stringid(id,2)}, + {b2,aux.Stringid(id,3)}) + e:SetLabel(op) + if op==1 then e:SetCategory(CATEGORY_DRAW) e:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_PLAYER_TARGET) - e:SetOperation(s.drop) Duel.SetTargetPlayer(tp) Duel.SetTargetParam(1) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) - else + elseif op==2 then e:SetCategory(CATEGORY_DESTROY) - e:SetOperation(s.desop) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,0,0) + e:SetProperty(EFFECT_FLAG_DELAY) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) end end -function s.drop(e,tp,eg,ep,ev,re,r,rp) - local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) - Duel.Draw(p,d,REASON_EFFECT) -end -function s.desop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) - if #g>0 then - Duel.Destroy(g,REASON_EFFECT) +function s.effop(e,tp,eg,ep,ev,re,r,rp) + local op=e:GetLabel() + if op==1 then + --Draw 1 card + local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM) + Duel.Draw(p,d,REASON_EFFECT) + elseif op==2 then + --Destroy 1 card on the field + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) + local g=Duel.SelectMatchingCard(tp,nil,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.Destroy(g,REASON_EFFECT) + end end -end \ No newline at end of file +end diff --git a/official/c69809989.lua b/official/c69809989.lua index 9f165bb707..db76624363 100644 --- a/official/c69809989.lua +++ b/official/c69809989.lua @@ -3,7 +3,7 @@ --Scripted by Hatter local s,id=GetID() function s.initial_effect(c) - --Special Summon + --Special Summon 1 "Ghostrick" monster from your hand or GY, then you can change 1 face-down "Ghostrick" monster you control to face-up Attack Position local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_POSITION) @@ -13,9 +13,10 @@ function s.initial_effect(c) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Attach + --Attach 1 "Ghostrick" card from your GY to 1 "Ghostrick" Xyz Monster you control as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_GRAVE) @@ -44,6 +45,7 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(s.posfilter,tp,LOCATION_MZONE,0,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_POSCHANGE) local pg=Duel.SelectMatchingCard(tp,s.posfilter,tp,LOCATION_MZONE,0,1,1,nil) if #pg>0 then Duel.BreakEffect() @@ -51,15 +53,18 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) end end end -function s.xyzfilter(c) +function s.xyzfilter(c,tp) return c:IsFaceup() and c:IsType(TYPE_XYZ) and c:IsSetCard(SET_GHOSTRICK) + and Duel.IsExistingMatchingCard(s.attachfilter,tp,LOCATION_GRAVE,0,1,nil,tp,c) +end +function s.attachfilter(c,tp,xyzc) + return c:IsSetCard(SET_GHOSTRICK) and c:IsCanBeXyzMaterial(xyzc,tp,REASON_EFFECT) end function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc) end - if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil) - and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_GRAVE,0,1,e:GetHandler(),SET_GHOSTRICK) end + if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc,tp) end + if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil) + Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,nil,1,tp,0) end function s.matop(e,tp,eg,ep,ev,re,r,rp) @@ -67,7 +72,7 @@ function s.matop(e,tp,eg,ep,ev,re,r,rp) if tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsType(TYPE_XYZ) and not tc:IsImmuneToEffect(e) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_XMATERIAL) - local g=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_GRAVE,0,1,1,nil,SET_GHOSTRICK) + local g=Duel.SelectMatchingCard(tp,s.attachfilter,tp,LOCATION_GRAVE,0,1,1,nil,tp,tc) if #g==0 then return end Duel.Overlay(tc,g) end diff --git a/official/c70252926.lua b/official/c70252926.lua index f00b78c051..362f0b700a 100644 --- a/official/c70252926.lua +++ b/official/c70252926.lua @@ -2,98 +2,93 @@ --Fortune Lady Every local s,id=GetID() function s.initial_effect(c) - --synchro summon - Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_SPELLCASTER),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_SET_ATTACK) - e1:SetValue(s.value) - c:RegisterEffect(e1) - local e2=e1:Clone() - e2:SetCode(EFFECT_SET_DEFENSE) + --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner Spellcaster monsters + Synchro.AddProcedure(c,nil,1,1,Synchro.NonTunerEx(Card.IsRace,RACE_SPELLCASTER),1,99) + --This card's ATK/DEF become its Level x 400 + local e1a=Effect.CreateEffect(c) + e1a:SetType(EFFECT_TYPE_SINGLE) + e1a:SetProperty(EFFECT_FLAG_SINGLE_RANGE) + e1a:SetCode(EFFECT_SET_ATTACK) + e1a:SetRange(LOCATION_MZONE) + e1a:SetValue(function(e,c) return c:GetLevel()*400 end) + c:RegisterEffect(e1a) + local e1b=e1a:Clone() + e1b:SetCode(EFFECT_SET_DEFENSE) + c:RegisterEffect(e1b) + --Increase this card's Level by 1 (max. 12), then, you can banish 1 face-up monster your opponent controls + local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,0)) + e2:SetCategory(CATEGORY_LVCHANGE+CATEGORY_REMOVE) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) + e2:SetCode(EVENT_PHASE+PHASE_STANDBY) + e2:SetRange(LOCATION_MZONE) + e2:SetCountLimit(1) + e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(tp) end) + e2:SetTarget(s.lvtg) + e2:SetOperation(s.lvop) c:RegisterEffect(e2) - --level up + --Special Summon this card local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,0)) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F) - e3:SetCategory(CATEGORY_REMOVE) - e3:SetRange(LOCATION_MZONE) - e3:SetCountLimit(1) - e3:SetCode(EVENT_PHASE|PHASE_STANDBY) - e3:SetCondition(s.lvcon) - e3:SetOperation(s.lvop) + e3:SetDescription(aux.Stringid(id,1)) + e3:SetCategory(CATEGORY_SPECIAL_SUMMON) + e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e3:SetCode(EVENT_PHASE+PHASE_END) + e3:SetRange(LOCATION_GRAVE) + e3:SetCountLimit(1,id) + e3:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) + e3:SetCost(s.spcost) + e3:SetTarget(s.sptg) + e3:SetOperation(s.spop) c:RegisterEffect(e3) - --special summon - local e4=Effect.CreateEffect(c) - e4:SetDescription(aux.Stringid(id,1)) - e4:SetCategory(CATEGORY_SPECIAL_SUMMON) - e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e4:SetCode(EVENT_PHASE+PHASE_END) - e4:SetRange(LOCATION_GRAVE) - e4:SetCountLimit(1,id) - e4:SetCondition(s.spcon) - e4:SetTarget(s.sptg) - e4:SetOperation(s.spop) - c:RegisterEffect(e4) -end -function s.value(e,c) - return c:GetLevel()*400 -end -function s.lvcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsTurnPlayer(tp) and e:GetHandler():IsLevelAbove(1) and e:GetHandler():IsLevelBelow(11) -end -function s.filter(c) - return c:IsMonster() and c:IsFaceup() and c:IsAbleToRemove() end function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return true end - local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) - if #g>0 then - Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,1,0,0) - end + Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,e:GetHandler(),1,tp,1) + Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,1,1-tp,LOCATION_MZONE) end function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - local lvl=c:GetLevel() - if c:IsFacedown() or not c:IsRelateToEffect(e) or c:IsLevelAbove(12) then return end - local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_UPDATE_LEVEL) - e1:SetValue(1) - e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) - c:RegisterEffect(e1) - local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_MZONE,nil) - if c:GetLevel()==lvl+1 and #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,0)) then - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local rg=g:Select(tp,1,1,nil) - if #rg>0 then - Duel.BreakEffect() - Duel.Remove(rg,POS_FACEUP,REASON_EFFECT) + if c:IsRelateToEffect(e) and c:IsFaceup() and c:IsLevelBelow(11) then + local prev_lv=c:GetLevel() + --Increase this card's Level by 1 + local e1=Effect.CreateEffect(c) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetCode(EFFECT_UPDATE_LEVEL) + e1:SetValue(1) + e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE) + c:RegisterEffect(e1) + if c:IsLevel(prev_lv+1) and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_MZONE,1,nil) + and Duel.SelectYesNo(tp,aux.Stringid(id,2)) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local g=Duel.SelectMatchingCard(tp,aux.FaceupFilter(Card.IsAbleToRemove),tp,0,LOCATION_MZONE,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.BreakEffect() + Duel.Remove(g,POS_FACEUP,REASON_EFFECT) + end end end end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsTurnPlayer(1-tp) +function s.spcostfilter(c) + return c:IsRace(RACE_SPELLCASTER) and c:IsAbleToRemoveAsCost() end -function s.rmfilter(c) - return c:IsAbleToRemoveAsCost() and c:IsRace(RACE_SPELLCASTER) +function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) + local c=e:GetHandler() + if chk==0 then return Duel.IsExistingMatchingCard(s.spcostfilter,tp,LOCATION_GRAVE,0,1,c) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) + local g=Duel.SelectMatchingCard(tp,s.spcostfilter,tp,LOCATION_GRAVE,0,1,1,c) + Duel.Remove(g,POS_FACEUP,REASON_COST) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_GRAVE,0,1,c) end - local g=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_GRAVE,0,1,1,c) - Duel.Remove(g,POS_FACEUP,REASON_COST) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_GRAVE) + 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 \ No newline at end of file +end diff --git a/official/c70369116.lua b/official/c70369116.lua index b23c9b430c..3c5429e4d4 100644 --- a/official/c70369116.lua +++ b/official/c70369116.lua @@ -5,7 +5,7 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() Link.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsType,TYPE_EFFECT),2,2) - --Change attribute to DARK + --The attribute of 1 face-up monster becomes DARK until the end of this turn local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetProperty(EFFECT_FLAG_CARD_TARGET) @@ -15,7 +15,7 @@ function s.initial_effect(c) e1:SetTarget(s.attg) e1:SetOperation(s.atop) c:RegisterEffect(e1) - --Apply the effects of a "Fusion/Polymerization" spell + --This effect becomes the effect of 1 "Fusion" or "Polymerization" Normal or Quick-Play Spel when that card is activated local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) @@ -60,6 +60,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end if chk==0 then return Duel.IsExistingMatchingCard(s.copfilter,tp,LOCATION_DECK,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) local g=Duel.SelectMatchingCard(tp,s.copfilter,tp,LOCATION_DECK,0,1,1,nil) if not Duel.SendtoGrave(g,REASON_COST) then return end local te=g:GetFirst():CheckActivateEffect(true,true,false) @@ -84,11 +85,12 @@ function s.operation(e,tp,eg,ep,ev,re,r,rp) te:SetLabel(e:GetLabel()) te:SetLabelObject(e:GetLabelObject()) end + --You cannot Special Summon monsters for the rest of this turn local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetDescription(aux.Stringid(id,2)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) - e1:SetDescription(aux.Stringid(id,2)) e1:SetTargetRange(1,0) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) diff --git a/official/c72272462.lua b/official/c72272462.lua index 649b8a1c81..b5d3a765ee 100644 --- a/official/c72272462.lua +++ b/official/c72272462.lua @@ -3,86 +3,81 @@ --scripted by Rundas local s,id=GetID() function s.initial_effect(c) - Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_DESPIA),s.matfilter) c:EnableReviveLimit() - --Change ATK to 0 + --Fusion Materials: 1 "Despia" monster + 1 LIGHT or DARK monster + Fusion.AddProcMix(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_DESPIA),aux.FilterBoolFunctionEx(Card.IsAttribute,ATTRIBUTE_LIGHT|ATTRIBUTE_DARK)) + --Change the ATK of all monsters currently on the field to 0 until the end of this turn, except Level 8 or higher Fusion Monsters local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_ATKCHANGE) e1:SetType(EFFECT_TYPE_QUICK_O) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) - e1:SetHintTiming(0,TIMING_MAIN_END) e1:SetCountLimit(1,id) - e1:SetCondition(s.atkcon) + e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) + e1:SetCondition(function() return Duel.IsMainPhase() end) e1:SetTarget(s.atktg) e1:SetOperation(s.atkop) c:RegisterEffect(e1) - --Search or Special Summon + --Add to your hand, or Special Summon, 1 "Fallen of Albaz" or 1 "Despia" monster, from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_SPECIAL_SUMMON) - e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e2:SetProperty(EFFECT_FLAG_DELAY) e2:SetCode(EVENT_LEAVE_FIELD) e2:SetCountLimit(1,{id,1}) - e2:SetCondition(s.thcon) - e2:SetTarget(s.thtg) - e2:SetOperation(s.thop) + e2:SetCondition(s.thspcon) + e2:SetTarget(s.thsptg) + e2:SetOperation(s.thspop) c:RegisterEffect(e2) end s.listed_series={SET_DESPIA} s.listed_names={CARD_ALBAZ} -function s.matfilter(c,fc,st,tp) - return c:IsAttribute(ATTRIBUTE_LIGHT,fc,st,tp) or c:IsAttribute(ATTRIBUTE_DARK,fc,st,tp) -end ---Change ATK -function s.atkcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsMainPhase() -end function s.atkfilter(c) - return c:IsFaceup() and c:GetAttack()>0 and not (c:IsType(TYPE_FUSION) and c:IsLevelAbove(8)) + return c:HasNonZeroAttack() and not (c:IsLevelAbove(8) and c:IsType(TYPE_FUSION)) end function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk) local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) if chk==0 then return #g>0 end - Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,PLAYER_ALL,LOCATION_MZONE) + Duel.SetOperationInfo(0,CATEGORY_ATKCHANGE,g,#g,tp,0) end function s.atkop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() local g=Duel.GetMatchingGroup(s.atkfilter,tp,LOCATION_MZONE,LOCATION_MZONE,nil) + if #g==0 then return end + local c=e:GetHandler() for tc in g:Iter() do - --Make ATK 0 + --Their ATK becomes 0 until the end of this turn local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_SET_ATTACK_FINAL) e1:SetValue(0) e1:SetReset(RESETS_STANDARD_PHASE_END) tc:RegisterEffect(e1) end end ---Search or Special Summon -function s.thcon(e,tp,eg,ep,ev,re,r,rp) +function s.thspcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() return rp==1-tp and c:IsReason(REASON_EFFECT) and c:IsPreviousPosition(POS_FACEUP) and c:IsPreviousControler(tp) end -function s.thfilter(c,e,tp,ft) - return ((c:IsSetCard(SET_DESPIA) and c:IsMonster()) or c:IsCode(CARD_ALBAZ)) - and (c:IsAbleToHand() or (c:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0)) +function s.thspfilter(c,e,tp,mzone_chk) + return (c:IsSetCard(SET_DESPIA) or c:IsCode(CARD_ALBAZ)) and c:IsMonster() and (c:IsAbleToHand() + or (mzone_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end -function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil,e,tp,ft) end +function s.thsptg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_DECK,0,1,nil,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)>0) end + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) +end +function s.thspop(e,tp,eg,ep,ev,re,r,rp) + local mzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0 + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) + local sc=Duel.SelectMatchingCard(tp,s.thspfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,mzone_chk):GetFirst() + if not sc then return end + aux.ToHandOrElse(sc,tp, + function() return mzone_chk and sc:IsCanBeSpecialSummoned(e,0,tp,false,false) end, + function() Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, + aux.Stringid(id,3) + ) end -function s.thop(e,tp,eg,ep,ev,re,r,rp) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - local tc=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp,ft):GetFirst() - if tc then - aux.ToHandOrElse(tc,tp,function(c) - return tc:IsCanBeSpecialSummoned(e,0,tp,false,false) and ft>0 end, - function(c) - Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) end, - aux.Stringid(id,1)) - end -end \ No newline at end of file diff --git a/official/c72332074.lua b/official/c72332074.lua index acdc20d589..1cefc5c602 100644 --- a/official/c72332074.lua +++ b/official/c72332074.lua @@ -2,17 +2,17 @@ --Super Quantal Alphan Spike local s,id=GetID() function s.initial_effect(c) - --Activate + --Shuffle as many cards your opponent controls as possible into the Deck, then your opponent Special Summons 1 monster from their Extra Deck, ignoring its Summoning conditions local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TODECK) + e1:SetCategory(CATEGORY_TODECK+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetCondition(s.condition) + e1:SetCondition(function(e,tp) return Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsSetCard,SET_SUPER_QUANTUM),tp,LOCATION_MZONE,0,nil):GetClassCount(Card.GetCode)>=3 end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --activate field spell + --Activate 1 "Super Quantal Mech Ship Magnacarrier" from your Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_IGNITION) @@ -23,48 +23,37 @@ function s.initial_effect(c) c:RegisterEffect(e2) end s.listed_series={SET_SUPER_QUANTUM} -s.listed_names={58753372,10424147} -function s.cfilter(c) - return c:IsFaceup() and c:IsSetCard(SET_SUPER_QUANTUM) -end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(s.cfilter,tp,LOCATION_MZONE,0,nil) - return g:GetClassCount(Card.GetCode)>=3 -end +s.listed_names={58753372,10424147} --"Super Quantal Fairy Alphan", "Super Quantal Mech Ship Magnacarrier" function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,1,nil) and Duel.GetFieldGroupCount(tp,0,LOCATION_EXTRA)>0 and Duel.IsPlayerCanSpecialSummon(1-tp) end - local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil) - Duel.SetOperationInfo(0,CATEGORY_TODECK,g,#g,0,0) + Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,1-tp,LOCATION_ONFIELD) end -function s.spfilter(c,e,tp) - return c:IsMonster() and c:IsCanBeSpecialSummoned(e,0,tp,true,false) +function s.spfilter(c,e,opp) + return c:IsMonster() and Duel.GetLocationCountFromEx(opp,opp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,opp,true,false) end function s.activate(e,tp,eg,ep,ev,re,r,rp) + local opp=1-tp local g=Duel.GetMatchingGroup(Card.IsAbleToDeck,tp,0,LOCATION_ONFIELD,nil) - if Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 - and Duel.GetLocationCount(1-tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.spfilter,1-tp,LOCATION_EXTRA,0,1,nil,e,1-tp) then - Duel.BreakEffect() - Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(1-tp,s.spfilter,1-tp,LOCATION_EXTRA,0,1,1,nil,e,1-tp) - local tc=g:GetFirst() - if tc then - Duel.SpecialSummon(tc,0,1-tp,1-tp,true,false,POS_FACEUP) + if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and Duel.GetOperatedGroup():IsExists(Card.IsLocation,1,nil,LOCATION_DECK|LOCATION_EXTRA) then + Duel.Hint(HINT_SELECTMSG,opp,HINTMSG_SPSUMMON) + local sg=Duel.SelectMatchingCard(opp,s.spfilter,opp,LOCATION_EXTRA,0,1,1,nil,e,opp) + if #sg>0 then + Duel.BreakEffect() + Duel.SpecialSummon(sg,0,opp,opp,true,false,POS_FACEUP) end end end -function s.costfilter(c) +function s.actcostfilter(c) return c:IsCode(58753372) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) end function s.actcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return aux.bfgcost(e,tp,eg,ep,ev,re,r,rp,0) - and Duel.IsExistingMatchingCard(s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,c) end + if chk==0 then return c:IsAbleToRemoveAsCost() + and Duel.IsExistingMatchingCard(s.actcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,c) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local g=Duel.SelectMatchingCard(tp,s.costfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,c) - g:AddCard(c) - Duel.Remove(g,POS_FACEUP,REASON_COST) + local g=Duel.SelectMatchingCard(tp,s.actcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,1,1,c) + Duel.Remove(g+c,POS_FACEUP,REASON_COST) end function s.actfilter(c,tp) return c:IsCode(10424147) and c:GetActivateEffect():IsActivatable(tp,true,true) @@ -73,6 +62,9 @@ function s.acttg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.actfilter,tp,LOCATION_DECK,0,1,nil,tp) end end function s.actop(e,tp,eg,ep,ev,re,r,rp) - local tc=Duel.SelectMatchingCard(tp,s.actfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() - Duel.ActivateFieldSpell(tc,e,tp,eg,ep,ev,re,r,rp) -end \ No newline at end of file + Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) + local sc=Duel.SelectMatchingCard(tp,s.actfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() + if sc then + Duel.ActivateFieldSpell(sc,e,tp,eg,ep,ev,re,r,rp) + end +end diff --git a/official/c72498838.lua b/official/c72498838.lua index 1c6d4dc4e6..ab20b403b6 100644 --- a/official/c72498838.lua +++ b/official/c72498838.lua @@ -3,83 +3,71 @@ --Scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Add "Magistus" Spell/Trap to the hand or return 1 Spellcaster to the GY - local e1=Effect.CreateEffect(c) - e1:SetDescription(aux.Stringid(id,0)) - e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) - e1:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE) - e1:SetCode(EVENT_SUMMON_SUCCESS) - e1:SetCountLimit(1,id) - e1:SetTarget(s.target) - e1:SetOperation(s.operation) - c:RegisterEffect(e1) - local e2=e1:Clone() - e2:SetCode(EVENT_SPSUMMON_SUCCESS) + --Activate 1 of these effects + local e1a=Effect.CreateEffect(c) + e1a:SetDescription(aux.Stringid(id,0)) + e1a:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1a:SetProperty(EFFECT_FLAG_DELAY) + e1a:SetCode(EVENT_SUMMON_SUCCESS) + e1a:SetCountLimit(1,id) + e1a:SetTarget(s.efftg) + e1a:SetOperation(s.effop) + c:RegisterEffect(e1a) + local e1b=e1a:Clone() + e1b:SetCode(EVENT_SPSUMMON_SUCCESS) + c:RegisterEffect(e1b) + --Equip 1 "Magistus" monster you control with 1 "Magistus" monster from your GY, except a Level 4 monster + local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_EQUIP) + e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetRange(LOCATION_GRAVE) + e2:SetCountLimit(1,{id,1}) + e2:SetCost(Cost.SelfBanish) + e2:SetTarget(s.eqtg) + e2:SetOperation(s.eqop) c:RegisterEffect(e2) - --Equip from grave - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,3)) - e3:SetCategory(CATEGORY_EQUIP) - e3:SetType(EFFECT_TYPE_IGNITION) - e3:SetRange(LOCATION_GRAVE) - e3:SetProperty(EFFECT_FLAG_CARD_TARGET) - e3:SetCountLimit(1,{id,1}) - e3:SetCost(Cost.SelfBanish) - e3:SetTarget(s.eqtg) - e3:SetOperation(s.eqop) - c:RegisterEffect(e3) end s.listed_series={SET_MAGISTUS} -function s.schfilter(c) +function s.thfilter(c) return c:IsSetCard(SET_MAGISTUS) and c:IsSpellTrap() and c:IsAbleToHand() end -function s.tgfilter(c) - return c:IsRace(RACE_SPELLCASTER) and c:IsLevelBelow(4) and c:IsFaceup() +function s.rtgfilter(c) + return c:IsLevelBelow(4) and c:IsRace(RACE_SPELLCASTER) and c:IsFaceup() end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then - local sel=0 - if Duel.IsExistingMatchingCard(s.schfilter,tp,LOCATION_DECK,0,1,nil) then sel=sel+1 end - if Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_REMOVED,0,1,nil) then sel=sel+2 end - e:SetLabel(sel) - return sel~=0 - end - local sel=e:GetLabel() - if sel==3 then - Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,0)) - sel=Duel.SelectOption(tp,aux.Stringid(id,1),aux.Stringid(id,2))+1 - elseif sel==1 then - Duel.SelectOption(tp,aux.Stringid(id,1)) - else - Duel.SelectOption(tp,aux.Stringid(id,2)) - end - e:SetLabel(sel) - if sel==1 then +function s.efftg(e,tp,eg,ep,ev,re,r,rp,chk) + local b1=Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) + local b2=Duel.IsExistingMatchingCard(s.rtgfilter,tp,LOCATION_REMOVED,0,1,nil) + if chk==0 then return b1 or b2 end + local op=Duel.SelectEffect(tp, + {b1,aux.Stringid(id,2)}, + {b2,aux.Stringid(id,3)}) + e:SetLabel(op) + if op==1 then e:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) - else - local g=Duel.GetMatchingGroup(s.tgfilter,tp,LOCATION_REMOVED,0,nil) - e:SetCategory(CATEGORY_TOGRAVE) - Duel.SetOperationInfo(0,CATEGORY_TOGRAVE,g,1,0,0) + elseif op==2 then + e:SetCategory(0) end end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - local sel=e:GetLabel() - if sel==1 then +function s.effop(e,tp,eg,ep,ev,re,r,rp) + local op=e:GetLabel() + if op==1 then + --Add 1 "Magistus" Spell/Trap from your Deck to your hand Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) - local g=Duel.SelectMatchingCard(tp,s.schfilter,tp,LOCATION_DECK,0,1,1,nil) + 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 - else - if Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_REMOVED,0,1,nil) then - local tg=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_REMOVED,0,1,1,nil) - if #tg>0 then - Duel.SendtoGrave(tg,REASON_EFFECT|REASON_RETURN) - end + elseif op==2 then + --Return 1 of your banished Level 4 or lower Spellcaster monsters to your GY + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_RTOGRAVE) + local g=Duel.SelectMatchingCard(tp,s.rtgfilter,tp,LOCATION_REMOVED,0,1,1,nil) + if #g>0 then + Duel.HintSelection(g) + Duel.SendtoGrave(g,REASON_EFFECT|REASON_RETURN) end end end @@ -87,32 +75,28 @@ function s.eqfilter(c) return c:IsSetCard(SET_MAGISTUS) and not c:IsLevel(4) and c:IsMonster() end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - local c=e:GetHandler() - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsFaceup() and chkc:IsSetCard(SET_MAGISTUS) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsSetCard(SET_MAGISTUS) and chkc:IsFaceup() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,nil) - and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_GRAVE,0,1,c) end + and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_GRAVE,0,1,e:GetHandler()) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_GRAVE) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) - and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) - local ec=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.eqfilter),tp,LOCATION_GRAVE,0,1,1,nil):GetFirst() - if ec then - Duel.Equip(tp,ec,tc,true) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_EQUIP_LIMIT) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - e1:SetValue(s.eqlimit) - e1:SetLabelObject(tc) - ec:RegisterEffect(e1) + if tc:IsRelateToEffect(e) and tc:IsFaceup() and Duel.GetLocationCount(tp,LOCATION_SZONE)>0 then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) + local ec=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_GRAVE,0,1,1,nil):GetFirst() + if ec and Duel.Equip(tp,ec,tc) then + --Equip limit + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e1:SetCode(EFFECT_EQUIP_LIMIT) + e1:SetValue(function(e,c) return c==tc end) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + ec:RegisterEffect(e1) + end end end -function s.eqlimit(e,c) - return c==e:GetLabelObject() -end \ No newline at end of file diff --git a/official/c78199891.lua b/official/c78199891.lua index 3fad3019a1..bed2041106 100644 --- a/official/c78199891.lua +++ b/official/c78199891.lua @@ -45,12 +45,13 @@ function s.eqptg(e,tp,eg,ep,ev,re,r,rp,chk) local ft=Duel.GetLocationCount(tp,LOCATION_SZONE) if e:GetHandler():IsLocation(LOCATION_HAND) then ft=ft-1 end if chk==0 then return ft>0 and Duel.IsExistingTarget(s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,tp) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) Duel.SelectTarget(tp,s.cfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,tp) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_DECK) end function s.eqpop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if not (tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end + if not (tc:IsFaceup() and tc:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) local g=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_DECK,0,1,1,nil,tc,tp) if #g>0 then diff --git a/official/c81945678.lua b/official/c81945678.lua index 98aff1bcb6..d272dd5b20 100644 --- a/official/c81945678.lua +++ b/official/c81945678.lua @@ -2,95 +2,89 @@ --Joker's Wild local s,id=GetID() function s.initial_effect(c) - --Copy face card spell + --This effect becomes the activation effect of a Spell that mentions all of "Queen's Knight", "King's Knight", and "Jack's Knight" local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) - e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START) e1:SetCountLimit(1,id) - e1:SetCondition(s.condition) + e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START|TIMINGS_CHECK_MONSTER) + e1:SetCondition(function() return Duel.IsMainPhase() or Duel.IsBattlePhase() end) e1:SetCost(s.cost) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --to hand + --Shuffle 1 LIGHT Warrior monster from your GY into the Deck, and if you do, add this card to your hand local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_TOHAND+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_QUICK_O) - e2:SetCode(EVENT_FREE_CHAIN) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) - e2:SetHintTiming(TIMING_END_PHASE) e2:SetCountLimit(1,{id,1}) - e2:SetCondition(s.tdcon) + e2:SetHintTiming(TIMING_END_PHASE) + e2:SetCondition(function() return Duel.IsPhase(PHASE_END) end) e2:SetTarget(s.tdtg) e2:SetOperation(s.tdop) c:RegisterEffect(e2) end -s.listed_names={CARD_JACK_KNIGHT,CARD_KING_KNIGHT,CARD_QUEEN_KNIGHT} -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsMainPhase() or Duel.IsBattlePhase() -end -function s.copfilter(c) - return c:IsAbleToGraveAsCost() and c:ListsCode(CARD_JACK_KNIGHT,CARD_KING_KNIGHT,CARD_QUEEN_KNIGHT) - and c:IsSpell() and c:CheckActivateEffect(true,true,false)~=nil +s.listed_names={CARD_QUEEN_KNIGHT,CARD_KING_KNIGHT,CARD_JACK_KNIGHT} +function s.tgfilter(c) + return c:IsSpell() and c:ListsCode(CARD_QUEEN_KNIGHT,CARD_KING_KNIGHT,CARD_JACK_KNIGHT) and c:IsAbleToGraveAsCost() + and c:CheckActivateEffect(true,true,false)~=nil end function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.copfilter,tp,LOCATION_DECK,0,1,nil) end + e:SetLabel(-100) + if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) + local sc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_DECK,0,1,1,nil):GetFirst() + Duel.SendtoGrave(sc,REASON_COST) + e:SetLabelObject(sc) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then local te=e:GetLabelObject() + local tg=te:GetTarget() return tg and tg(e,tp,eg,ep,ev,re,r,rp,0,chkc) end - if chk==0 then return Duel.IsExistingMatchingCard(s.copfilter,tp,LOCATION_DECK,0,1,nil) end - local g=Duel.SelectMatchingCard(tp,s.copfilter,tp,LOCATION_DECK,0,1,1,nil) - if not Duel.SendtoGrave(g,REASON_COST) then return end - local te=g:GetFirst():CheckActivateEffect(true,true,false) - e:SetLabel(te:GetLabel()) - e:SetLabelObject(te:GetLabelObject()) + if chk==0 then local res=e:GetLabel()==-100 e:SetLabel(0) return res end + Duel.ClearTargetCard() + local sc=e:GetLabelObject() + local te,ceg,cep,cev,cre,cr,crp=sc:CheckActivateEffect(false,true,true) local tg=te:GetTarget() - if tg then - tg(e,tp,eg,ep,ev,re,r,rp,1) - end - te:SetLabel(e:GetLabel()) + e:SetProperty(te:GetProperty()) + if tg then tg(e,tp,ceg,cep,cev,cre,cr,crp,1) end te:SetLabelObject(e:GetLabelObject()) e:SetLabelObject(te) Duel.ClearOperationInfo(0) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local te=e:GetLabelObject() - if te then - e:SetLabel(te:GetLabel()) - e:SetLabelObject(te:GetLabelObject()) - local op=te:GetOperation() - if op then op(e,tp,eg,ep,ev,re,r,rp) end - te:SetLabel(e:GetLabel()) - te:SetLabelObject(e:GetLabelObject()) + if not te then return end + e:SetLabelObject(te:GetLabelObject()) + local op=te:GetOperation() + if op then + op(e,tp,eg,ep,ev,re,r,rp) end end -function s.tdcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsPhase(PHASE_END) -end function s.tdfilter(c) return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_WARRIOR) and c:IsAbleToDeck() end function s.tdtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and s.tdfilter(chkc) end - if chk==0 then return e:GetHandler():IsAbleToHand() - and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end + local c=e:GetHandler() + if chk==0 then return c:IsAbleToHand() and Duel.IsExistingTarget(s.tdfilter,tp,LOCATION_GRAVE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectTarget(tp,s.tdfilter,tp,LOCATION_GRAVE,0,1,1,nil) - Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,0,0) - Duel.SetOperationInfo(0,CATEGORY_TOHAND,e:GetHandler(),1,0,0) + Duel.SetOperationInfo(0,CATEGORY_TODECK,g,1,tp,0) + Duel.SetOperationInfo(0,CATEGORY_TOHAND,c,1,tp,0) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) - local tc=Duel.GetFirstTarget() local c=e:GetHandler() - if tc and tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)~=0 - and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) and c:IsRelateToEffect(e) then + local tc=Duel.GetFirstTarget() + if tc:IsRelateToEffect(e) and Duel.SendtoDeck(tc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and tc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) + and c:IsRelateToEffect(e) then Duel.SendtoHand(c,nil,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c84271823.lua b/official/c84271823.lua index cef9b449f5..bf879a138e 100644 --- a/official/c84271823.lua +++ b/official/c84271823.lua @@ -3,29 +3,30 @@ --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) - --link summon c:EnableReviveLimit() + --Link Summon procedure: 2 monsters with different Levels Link.AddProcedure(c,s.mfilter,2,nil,s.matcheck) - --change level + --Change the Level of a monster(s) Special Summoned to a zone this card points to local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_LVCHANGE) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetProperty(EFFECT_FLAG_DELAY) e1:SetCode(EVENT_SPSUMMON_SUCCESS) - e1:SetCountLimit(1,id) e1:SetRange(LOCATION_MZONE) + e1:SetCountLimit(1,id) e1:SetCondition(s.lvcon) e1:SetTarget(s.lvtg) e1:SetOperation(s.lvop) c:RegisterEffect(e1) - --destroy + --Destroy 2 monsters (1 from each field) with the same level local e2=Effect.CreateEffect(c) - e2:SetCategory(CATEGORY_DESTROY) e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_DESTROY) e2:SetType(EFFECT_TYPE_IGNITION) e2:SetProperty(EFFECT_FLAG_CARD_TARGET) - e2:SetCountLimit(1,{id,1}) e2:SetRange(LOCATION_MZONE) + e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) @@ -54,6 +55,7 @@ function s.lvtg(e,tp,eg,ep,ev,re,r,rp,chk) Duel.Hint(HINT_SELECTMSG,tp,aux.Stringid(id,2)) e:SetLabel(Duel.AnnounceLevel(tp,1,8,lv)) e:SetLabelObject(g) + Duel.SetOperationInfo(0,CATEGORY_LVCHANGE,g,#dg,0,e:GetLabel()) end function s.opfilter(c,e) return c:IsFaceup() and c:IsRelateToEffect(e) @@ -62,7 +64,8 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local lg=e:GetHandler():GetLinkedGroup() local g=eg:Filter(s.cfilter,nil,tp,lg) - for tc in aux.Next(g) do + --Their levels become the declared Level + for tc in g:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CHANGE_LEVEL) @@ -71,21 +74,23 @@ function s.lvop(e,tp,eg,ep,ev,re,r,rp) tc:RegisterEffect(e1) end end -function s.desfilter1(c,tp) - return c:IsFaceup() and c:IsLevelAbove(1) and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsLevel,c:GetLevel()),tp,0,LOCATION_MZONE,1,nil) +function s.desfilter(c,e) + return c:IsFaceup() and c:HasLevel() and c:IsCanBeEffectTarget(e) +end +function s.rescon(sg,e,tp,mg) + return sg:GetClassCount(Card.GetControler)==2 and sg:GetClassCount(Card.GetLevel)==1 end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_MZONE) and s.desfilter1(chkc,chkc:GetControler()) end - if chk==0 then return Duel.IsExistingTarget(s.desfilter1,tp,LOCATION_MZONE,0,1,nil,tp) end - local g=Duel.SelectTarget(tp,s.desfilter1,tp,LOCATION_MZONE,0,1,1,nil,tp) - local oc=g:GetFirst() - local sg=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsLevel,oc:GetLevel()),tp,0,LOCATION_MZONE,1,1,nil) - g:Merge(sg) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0) + if chkc then return false end + local g=Duel.GetMatchingGroup(s.desfilter,0,LOCATION_MZONE,LOCATION_MZONE,nil,e) + if chk==0 then return #g>=2 and aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end + local dg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_DESTROY) + Duel.SetTargetCard(dg) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetTargetCards(e) - if g then - Duel.Destroy(g,REASON_EFFECT) + local dg=Duel.GetTargetCards(e) + if #dg>0 then + Duel.Destroy(dg,REASON_EFFECT) end end \ No newline at end of file diff --git a/official/c84482694.lua b/official/c84482694.lua index 7633b09b7f..bf8671e204 100644 --- a/official/c84482694.lua +++ b/official/c84482694.lua @@ -1,10 +1,11 @@ --顕現する紋章 --Charged-Up Heraldry ---Logical Nonsense ---Substitute ID +--scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) + --Special Summon 2 "Heraldic Beast" monsters from your Deck in Defense Position local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) @@ -14,53 +15,48 @@ function s.initial_effect(c) e1:SetOperation(s.activate) c:RegisterEffect(e1) end - --Part of "Heraldry" archetype s.listed_series={SET_HERALDIC_BEAST} - --Cost filter -function s.cfilter(c,ft,tp) - return ft>1 or (c:IsControler(tp) and c:GetSequence()<5 and ft>0) +function s.spcheck(sg,tp,exg,dg) + return Duel.GetMZoneCount(tp,sg)>=2 end - --Tribute 1 monster cost function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - if chk==0 then return ft>-1 and Duel.CheckReleaseGroupCost(tp,s.cfilter,1,false,nil,nil,ft,tp) end - local g=Duel.SelectReleaseGroupCost(tp,s.cfilter,1,1,false,nil,nil,ft,tp) + e:SetLabel(-100) + if chk==0 then return Duel.CheckReleaseGroupCost(tp,nil,1,false,s.spcheck,nil) end + local g=Duel.SelectReleaseGroupCost(tp,nil,1,1,false,s.spcheck,nil) Duel.Release(g,REASON_COST) end - --Check for "Heraldic Beast" monster function s.spfilter(c,e,tp) return c:IsSetCard(SET_HERALDIC_BEAST) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE) end - --Activation legality function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) end + if chk==0 then + local cost_chk=e:GetLabel()==-100 + e:SetLabel(0) + return (cost_chk or Duel.GetLocationCount(tp,LOCATION_MZONE,0)>=2) and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,2,nil,e,tp) + end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_DECK) end - --Special summon 2 "Heraldic Beast" monsters, locked into machine and psychic for extra deck function s.activate(e,tp,eg,ep,ev,re,r,rp) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetDescription(aux.Stringid(id,0)) + if Duel.GetLocationCount(tp,LOCATION_MZONE)>=2 and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) + if #g==2 then + Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) + end + end + if not e:IsHasType(EFFECT_TYPE_ACTIVATE) then return end + local c=e:GetHandler() + --You cannot Special Summon monsters from the Extra Deck for the rest of this turn after this card resolves, except Psychic or Machine monsters + local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CLIENT_HINT) + e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) - e1:SetTarget(s.splimit) + e1:SetTarget(function(e,c) return c:IsLocation(LOCATION_EXTRA) and not c:IsRace(RACE_PSYCHIC|RACE_MACHINE) end) e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<2 or Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then return end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - --lizard check - aux.addTempLizardCheck(e:GetHandler(),tp,s.lizfilter) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,2,2,nil,e,tp) - if #g==2 then - Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP_DEFENSE) - end -end - --Locked into machine and psychic monsters for extra deck -function s.splimit(e,c) - return not c:IsRace(RACE_MACHINE|RACE_PSYCHIC) and c:IsLocation(LOCATION_EXTRA) + --"Clock Lizard" check + aux.addTempLizardCheck(c,tp,function(e,c) return not c:IsOriginalRace(RACE_PSYCHIC|RACE_MACHINE) end) end -function s.lizfilter(e,c) - return not c:IsOriginalRace(RACE_MACHINE|RACE_PSYCHIC) -end \ No newline at end of file diff --git a/official/c84813516.lua b/official/c84813516.lua index 6b8ec7ef9d..625ab9f15d 100644 --- a/official/c84813516.lua +++ b/official/c84813516.lua @@ -3,18 +3,27 @@ --scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Special Summon itself from the hand + --Special Summon this card from your hand local e1=Effect.CreateEffect(c) - e1:SetDescription(aux.Stringid(id,1)) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) e1:SetCode(EVENT_DAMAGE_STEP_END) e1:SetRange(LOCATION_HAND) e1:SetCountLimit(1,id) + e1:SetCondition(function() return Duel.HasFlagEffect(0,id) end) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Destroy all other monsters in the same column + --Keep track of damage calculation being performed + aux.GlobalCheck(s,function() + local ge1=Effect.CreateEffect(c) + ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) + ge1:SetCode(EVENT_BATTLED) + ge1:SetOperation(function() Duel.RegisterFlagEffect(0,id,RESET_PHASE|PHASE_DAMAGE,0,1) end) + Duel.RegisterEffect(ge1,0) + end) + --Destroy all other monsters in this card's column local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_DESTROY) @@ -25,15 +34,15 @@ function s.initial_effect(c) e2:SetTarget(s.destg) e2:SetOperation(s.desop) c:RegisterEffect(e2) - --Return a card from the GY to the hand + --Roll a six-sided die, and if the result is 6, add 1 card from your GY to your hand local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,2)) e3:SetCategory(CATEGORY_DICE+CATEGORY_TOHAND) e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) - e3:SetCode(EVENT_TO_GRAVE) + e3:SetCode(EVENT_DESTROYED) e3:SetCountLimit(1,{id,2}) - e3:SetCondition(s.thcond) + e3:SetCondition(s.thcon) e3:SetTarget(s.thtg) e3:SetOperation(s.thop) c:RegisterEffect(e3) @@ -43,7 +52,7 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,LOCATION_HAND) + 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() @@ -51,42 +60,44 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) end end -function s.cstfilter(c) - return c:IsTrap() and c:IsAbleToGraveAsCost() and (c:IsLocation(LOCATION_HAND) or c:IsFacedown()) +function s.descostfilter(c) + return c:IsTrap() and (c:IsLocation(LOCATION_HAND) or c:IsFacedown()) and c:IsAbleToGraveAsCost() end function s.descost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(s.cstfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end + if chk==0 then return Duel.IsExistingMatchingCard(s.descostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOGRAVE) - local g=Duel.SelectMatchingCard(tp,s.cstfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) + local g=Duel.SelectMatchingCard(tp,s.descostfilter,tp,LOCATION_HAND|LOCATION_ONFIELD,0,1,1,nil) Duel.SendtoGrave(g,REASON_COST) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - local cg=c:GetColumnGroup():Filter(Card.IsMonster,c) + local cg=c:GetColumnGroup():Match(Card.IsMonster,c) if chk==0 then return #cg>0 end Duel.SetOperationInfo(0,CATEGORY_DESTROY,cg,#cg,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - local cg=c:GetColumnGroup():Filter(Card.IsMonster,c) + if not c:IsRelateToEffect(e) then return end + local cg=c:GetColumnGroup():Match(Card.IsMonster,c) if #cg>0 then Duel.Destroy(cg,REASON_EFFECT) end end -function s.thcond(e,tp,eg,ep,ev,re,r,rp) +function s.thcon(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() - return c:IsReason(REASON_DESTROY) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE|REASON_EFFECT) + return c:IsPreviousLocation(LOCATION_MZONE) and c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsLocation(LOCATION_GRAVE) end -function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) +function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) + if chkc then return chkc:IsLocation(LOCATION_GRAVE) and chkc:IsControler(tp) and chkc:IsAbleToHand() end if chk==0 then return Duel.IsExistingTarget(Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,nil) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) local g=Duel.SelectTarget(tp,Card.IsAbleToHand,tp,LOCATION_GRAVE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DICE,nil,0,tp,1) - Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,g,1,tp,LOCATION_GRAVE) + Duel.SetPossibleOperationInfo(0,CATEGORY_TOHAND,g,1,tp,0) end function s.thop(e,tp,eg,ep,ev,re,r,rp) - local res=Duel.TossDice(tp,1) local tc=Duel.GetFirstTarget() - if res==6 and tc:IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) and Duel.TossDice(tp,1)==6 then Duel.SendtoHand(tc,nil,REASON_EFFECT) end -end \ No newline at end of file +end diff --git a/official/c85555787.lua b/official/c85555787.lua index 07d5bde3b1..ebc5616abd 100644 --- a/official/c85555787.lua +++ b/official/c85555787.lua @@ -5,6 +5,7 @@ local s,id=GetID() function s.initial_effect(c) --activate local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_DESTROY) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) @@ -34,20 +35,21 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() local atk=e:GetLabel() local ct=math.floor(atk/500) + Duel.Hint(HINT_SELECTMSG,1-tp,HINTMSG_DESTROY) local g=Duel.SelectMatchingCard(1-tp,nil,1-tp,LOCATION_DECK|LOCATION_HAND,0,ct,ct,nil) - if #g~=0 and Duel.Destroy(g,REASON_EFFECT)~=0 then + if #g>0 and Duel.Destroy(g,REASON_EFFECT)>=0 then local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_GRAVE) - for oc in aux.Next(og) do + for tc in og:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_GRAVE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_EXC_GRAVE|RESET_PHASE|PHASE_END) - oc:RegisterEffect(e1) + tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_ACTIVATE) - oc:RegisterEffect(e2) + tc:RegisterEffect(e2) end end if atk>=2000 then @@ -84,19 +86,19 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) if #hg==0 then return end Duel.ConfirmCards(1-ep,hg) local dg=hg:Filter(Card.IsMonster,nil) - if Duel.Destroy(dg,REASON_EFFECT)~=0 then + if Duel.Destroy(dg,REASON_EFFECT)>0 then local og=Duel.GetOperatedGroup():Filter(Card.IsLocation,nil,LOCATION_GRAVE) - for oc in aux.Next(og) do + for tc in og:Iter() do local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_SINGLE) e1:SetCode(EFFECT_CANNOT_TRIGGER) e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE) e1:SetRange(LOCATION_GRAVE) e1:SetReset(RESET_EVENT|RESETS_STANDARD_EXC_GRAVE|RESET_PHASE|PHASE_END) - oc:RegisterEffect(e1) + tc:RegisterEffect(e1) local e2=e1:Clone() e2:SetCode(EFFECT_CANNOT_ACTIVATE) - oc:RegisterEffect(e2) + tc:RegisterEffect(e2) end end Duel.ShuffleHand(ep) diff --git a/official/c85590798.lua b/official/c85590798.lua index 39efb2b0a6..1ea3416efc 100644 --- a/official/c85590798.lua +++ b/official/c85590798.lua @@ -1,89 +1,75 @@ --聖なる降誕 --Starry Knight Ceremony ---Logical Nonsense ---Substitute ID +--scripted by Logical Nonsense local s,id=GetID() function s.initial_effect(c) --Activate + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_ACTIVATE) + e0:SetCode(EVENT_FREE_CHAIN) + c:RegisterEffect(e0) + --Reveal 1 LIGHT Fairy monster in your hand, and if you do, add 1 Level 7 LIGHT Dragon monster from your Deck to your hand, then place that revealed monster on the bottom of your Deck local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK) + e1:SetType(EFFECT_TYPE_IGNITION) + e1:SetRange(LOCATION_SZONE) + e1:SetCountLimit(1,id) + e1:SetTarget(s.thtg) + e1:SetOperation(s.thop) c:RegisterEffect(e1) - --Reveal 1 LIGHT fairy monster, add 1 level 7 LIGHT dragon monster from deck + --Special Summon 1 Level 7 LIGHT Dragon monster from your hand local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH+CATEGORY_TODECK) - e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_SPECIAL_SUMMON) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2:SetProperty(EFFECT_FLAG_DELAY) + e2:SetCode(EVENT_CHAINING) e2:SetRange(LOCATION_SZONE) e2:SetCountLimit(1,id) - e2:SetTarget(s.thtg) - e2:SetOperation(s.thop) + e2:SetCondition(function(e,tp,eg,ep) return ep==1-tp end) + e2:SetTarget(s.sptg) + e2:SetOperation(s.spop) c:RegisterEffect(e2) - --Special summon 1 level 7 LIGHT dragon monster from hand - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,1)) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e3:SetCategory(CATEGORY_SPECIAL_SUMMON) - e3:SetProperty(EFFECT_FLAG_DELAY) - e3:SetCode(EVENT_CHAINING) - e3:SetRange(LOCATION_SZONE) - e3:SetCountLimit(1,id) - e3:SetCondition(function(_,tp,_,ep)return ep==1-tp end) - e3:SetTarget(s.sptg) - e3:SetOperation(s.spop) - c:RegisterEffect(e3) end - --Check for a LIGHT fairy monster -function s.cfilter(c) - return c:IsRace(RACE_FAIRY) and c:IsAttribute(ATTRIBUTE_LIGHT) and not c:IsPublic() and c:IsAbleToDeck() -end - --Check for a level 7 LIGHT dragon monster -function s.ldlv7filter(c) - return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsLevel(7) +function s.revealfilter(c) + return c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_FAIRY) and not c:IsPublic() and c:IsAbleToDeck() end function s.thfilter(c) - return s.ldlv7filter(c) and c:IsAbleToHand() + return c:IsLevel(7) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) and c:IsAbleToHand() end - --Activation legality function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk) - local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) - if chk==0 then return Duel.IsExistingMatchingCard(s.cfilter,tp,LOCATION_HAND,0,1,nil) + if chk==0 then return Duel.IsExistingMatchingCard(s.revealfilter,tp,LOCATION_HAND,0,1,nil) and Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK) Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end - --Reveal 1 LIGHT fairy monster, add 1 level 7 LIGHT dragon monster, place revealed monster on bottom of deck function s.thop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetMatchingGroup(s.thfilter,tp,LOCATION_DECK,0,nil) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONFIRM) - local rc=Duel.SelectMatchingCard(tp,s.cfilter,tp,LOCATION_HAND,0,1,1,nil) - if #rc>0 then - Duel.ConfirmCards(1-tp,rc) - local sg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) - if #sg>0 and Duel.SendtoHand(sg,nil,REASON_EFFECT)~=0 then - Duel.ConfirmCards(1-tp,sg) - Duel.ShuffleDeck(tp) - Duel.BreakEffect() - Duel.SendtoDeck(rc,tp,SEQ_DECKBOTTOM,REASON_EFFECT) - end - end + local rg=Duel.SelectMatchingCard(tp,s.revealfilter,tp,LOCATION_HAND,0,1,1,nil) + if #rg==0 then return end + Duel.ConfirmCards(1-tp,rg) + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND) + local sg=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil) + if #sg==0 or Duel.SendtoHand(sg,nil,REASON_EFFECT)==0 then return Duel.ShuffleHand(tp) end + Duel.ConfirmCards(1-tp,sg) + Duel.ShuffleDeck(tp) + Duel.BreakEffect() + Duel.SendtoDeck(rg,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end - --Check for a level 7 LIGHT dragon monster function s.spfilter(c,e,tp) - return s.ldlv7filter(c) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsLevel(7) and c:IsAttribute(ATTRIBUTE_LIGHT) and c:IsRace(RACE_DRAGON) 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,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND) end - --Special summon 1 level 7 LIGHT dragon monster from hand function s.spop(e,tp,eg,ep,ev,re,r,rp) - if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 or not e:GetHandler():IsRelateToEffect(e) then return end + if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_HAND,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end -end \ No newline at end of file +end diff --git a/official/c87074380.lua b/official/c87074380.lua index d9e245631e..06bd55c645 100644 --- a/official/c87074380.lua +++ b/official/c87074380.lua @@ -4,82 +4,72 @@ local s,id=GetID() function s.initial_effect(c) c:EnableUnsummonable() - --splimit + c:AddMustBeSpecialSummonedByCardEffect() + --Destroy 1 Machine monster you control and all monsters your opponent controls with ATK less than or equal to it local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) - e1:SetCode(EFFECT_SPSUMMON_CONDITION) - e1:SetValue(s.splimit) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_DESTROY) + e1:SetType(EFFECT_TYPE_QUICK_O) + e1:SetProperty(EFFECT_FLAG_CARD_TARGET) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetRange(LOCATION_MZONE) + e1:SetCountLimit(1,id) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e1:SetTarget(s.destg) + e1:SetOperation(s.desop) c:RegisterEffect(e1) - --destroy + --Special Summon this card local e2=Effect.CreateEffect(c) - e2:SetCategory(CATEGORY_DESTROY) - e2:SetHintTiming(TIMINGS_CHECK_MONSTER|TIMING_BATTLE_START) - e2:SetType(EFFECT_TYPE_QUICK_O) - e2:SetCode(EVENT_FREE_CHAIN) - e2:SetRange(LOCATION_MZONE) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET) - e2:SetCountLimit(1,id) - e2:SetTarget(s.destg) - e2:SetOperation(s.desop) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_SPECIAL_SUMMON) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e2:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP,EFFECT_FLAG2_CHECK_SIMULTANEOUS) + e2:SetCode(EVENT_DESTROYED) + e2:SetRange(LOCATION_GRAVE) + e2:SetCountLimit(1,{id,1}) + e2:SetCondition(s.spcon) + e2:SetTarget(s.sptg) + e2:SetOperation(s.spop) c:RegisterEffect(e2) - --special summon - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,0)) - e3:SetCategory(CATEGORY_SPECIAL_SUMMON) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e3:SetCode(EVENT_DESTROYED) - e3:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) - e3:SetRange(LOCATION_GRAVE) - e3:SetCountLimit(1,{id,1}) - e3:SetCondition(s.spcon) - e3:SetTarget(s.sptg) - e3:SetOperation(s.spop) - c:RegisterEffect(e3) end -s.listed_names={} -function s.splimit(e,se,sp,st) - return se:IsHasType(EFFECT_TYPE_ACTIONS) -end -function s.tgfilter(c,tp) - return c:IsFaceup() and c:IsRace(RACE_MACHINE) - and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttackBelow,c:GetAttack()),tp,0,LOCATION_MZONE,1,nil) +s.listed_names={id} +function s.desfilter(c,tp) + return c:IsRace(RACE_MACHINE) and c:IsFaceup() and Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsAttackBelow,c:GetAttack()),tp,0,LOCATION_MZONE,1,nil) end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - local c=e:GetHandler() - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc,tp) end - if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end - local tc=Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst() - local dg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) - dg:AddCard(tc) - Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,0,0) + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.desfilter(chkc,tp) end + if chk==0 then return Duel.IsExistingTarget(s.desfilter,tp,LOCATION_MZONE,0,1,nil,tp) end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) + local tc=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_MZONE,0,1,1,nil,tp):GetFirst() + local dg=tc+Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) + Duel.SetOperationInfo(0,CATEGORY_DESTROY,dg,#dg,tp,0) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if not tc:IsRelateToEffect(e) or not s.tgfilter(tc,tp) then return end - local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) - if #g>0 then - g:AddCard(tc) - Duel.Destroy(g,REASON_EFFECT) + if tc:IsRelateToEffect(e) and tc:IsRace(RACE_MACHINE) and tc:IsFaceup() then + local g=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsAttackBelow,tc:GetAttack()),tp,0,LOCATION_MZONE,nil) + if #g>0 then + Duel.Destroy(g+tc,REASON_EFFECT) + end end end -function s.spcfilter(c,tp) - return c:IsReason(REASON_BATTLE|REASON_EFFECT) - and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) - and c:IsPreviousPosition(POS_FACEUP) and (c:GetPreviousAttributeOnField()&ATTRIBUTE_EARTH)==ATTRIBUTE_EARTH - and (c:GetPreviousRaceOnField()&RACE_MACHINE)==RACE_MACHINE and not c:IsCode(id) +function s.spconfilter(c,tp) + return c:IsPreviousAttributeOnField(ATTRIBUTE_EARTH) and c:IsPreviousRaceOnField(RACE_MACHINE) and c:IsPreviousPosition(POS_FACEUP) + and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and not c:IsPreviousCodeOnField(id) + and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.spcfilter,1,e:GetHandler(),tp) and not eg:IsContains(e:GetHandler()) + return not eg:IsContains(e:GetHandler()) and eg:IsExists(s.spconfilter,1,nil,tp) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,LOCATION_GRAVE) + 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 \ No newline at end of file +end diff --git a/official/c8837932.lua b/official/c8837932.lua index 870555645c..528dde8383 100644 --- a/official/c8837932.lua +++ b/official/c8837932.lua @@ -1,5 +1,6 @@ --方界曼荼羅 --Cubic Mandala +local COUNTER_CUBIC=0x1038 local s,id=GetID() function s.initial_effect(c) --Activate @@ -13,14 +14,14 @@ function s.initial_effect(c) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --disable + --While your opponent controls any of the monsters Summoned by this effect, negate any monster effects your opponent activates local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e2:SetRange(LOCATION_SZONE) e2:SetCode(EVENT_CHAIN_ACTIVATING) e2:SetOperation(s.disop) c:RegisterEffect(e2) - --destroy + --When the last of the monsters Summoned by this effect leaves the field, destroy this card local e3=Effect.CreateEffect(c) e3:SetType(EFFECT_TYPE_CONTINUOUS+EFFECT_TYPE_FIELD) e3:SetRange(LOCATION_SZONE) @@ -29,7 +30,7 @@ function s.initial_effect(c) e3:SetOperation(s.desop) c:RegisterEffect(e3) end -s.counter_place_list={0x1038} +s.counter_place_list={COUNTER_CUBIC} s.listed_series={SET_CUBIC} function s.condition(e,tp,eg,ep,ev,re,r,rp) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,SET_CUBIC),tp,LOCATION_MZONE,0,1,nil) @@ -37,7 +38,7 @@ end function s.spfilter(c,e,tp,tid) return c:IsReason(REASON_DESTROY) and c:IsMonster() and c:GetTurnID()==tid and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP,1-tp) - and Duel.IsCanAddCounter(tp,0x1038,1,c) + and Duel.IsCanAddCounter(tp,COUNTER_CUBIC,1,c) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local tid=Duel.GetTurnCount() @@ -45,8 +46,8 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local ft=Duel.GetLocationCount(1-tp,LOCATION_MZONE,tp) if chk==0 then return ft>0 and Duel.IsExistingTarget(s.spfilter,tp,0,LOCATION_GRAVE,1,nil,e,tp,tid) end - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) if Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) then ft=1 end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) local g=Duel.SelectTarget(tp,s.spfilter,tp,0,LOCATION_GRAVE,1,ft,nil,e,tp,tid) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,#g,0,0) end @@ -60,8 +61,7 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) sg=sg:Select(tp,ft,ft,nil) end - local sc=sg:GetFirst() - for sc in aux.Next(sg) do + for sc in sg:Iter() do if Duel.SpecialSummonStep(sc,0,tp,1-tp,false,false,POS_FACEUP) then c:SetCardTarget(sc) local e1=Effect.CreateEffect(c) @@ -74,13 +74,12 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) end Duel.SpecialSummonComplete() local og=Duel.GetOperatedGroup() - local oc=og:GetFirst() - for oc in aux.Next(og) do - oc:AddCounter(0x1038,1) + for oc in og:Iter() do + oc:AddCounter(COUNTER_CUBIC,1) local e2=Effect.CreateEffect(c) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_CANNOT_ATTACK) - e2:SetCondition(s.disable) + e2:SetCondition(function(e) return e:GetHandler():GetCounter(COUNTER_CUBIC)>0 end) e2:SetReset(RESET_EVENT|RESETS_STANDARD) oc:RegisterEffect(e2) local e3=e2:Clone() @@ -88,15 +87,12 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) oc:RegisterEffect(e3) end end -function s.disable(e) - return e:GetHandler():GetCounter(0x1038)>0 -end function s.dfilter(c,g) return g:IsContains(c) end function s.disop(e,tp,eg,ep,ev,re,r,rp) local g=e:GetHandler():GetCardTarget() - if re:IsMonsterEffect() and rp~=tp + if re:IsMonsterEffect() and rp==1-tp and Duel.IsExistingMatchingCard(s.dfilter,tp,0,LOCATION_MZONE,1,nil,g) then Duel.NegateEffect(ev) end diff --git a/official/c91392974.lua b/official/c91392974.lua index 2345f9572d..5cc1cb188d 100644 --- a/official/c91392974.lua +++ b/official/c91392974.lua @@ -3,55 +3,58 @@ --Scripted by Larry126 local s,id=GetID() function s.initial_effect(c) - --Activate + --Special Summon 1 Level 4 or lower "Vision HERO" monster from your Deck, then you can halve the original ATK/DEF of 1 monster your opponent controls local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE+CATEGORY_DEFCHANGE) e1:SetType(EFFECT_TYPE_ACTIVATE) + e1:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_DAMAGE_STEP) e1:SetCode(EVENT_DESTROYED) - e1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY) e1:SetCountLimit(1,id,EFFECT_COUNT_CODE_OATH) e1:SetCondition(s.condition) e1:SetTarget(s.target) - e1:SetOperation(s.operation) + e1:SetOperation(s.activate) c:RegisterEffect(e1) end -s.listed_series={SET_VISION_HERO} -function s.cfilter(c,tp) - return c:IsReason(REASON_BATTLE|REASON_EFFECT) and c:IsPreviousLocation(LOCATION_MZONE) - and c:GetPreviousControler()==tp and c:IsPreviousSetCard(SET_HERO) and c:IsPreviousPosition(POS_FACEUP) +s.listed_series={SET_HERO,SET_VISION_HERO} +function s.confilter(c,tp) + return c:IsPreviousSetCard(SET_HERO) and c:IsPreviousControler(tp) and c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousPosition(POS_FACEUP) + and c:IsReason(REASON_BATTLE|REASON_EFFECT) end function s.condition(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.cfilter,1,nil,tp) + return eg:IsExists(s.confilter,1,nil,tp) end -function s.filter(c,e,tp) - return c:IsSetCard(SET_VISION_HERO) and c:IsLevelBelow(4) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +function s.spfilter(c,e,tp) + return c:IsLevelBelow(4) and c:IsSetCard(SET_VISION_HERO) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end -function s.operation(e,tp,eg,ep,ev,re,r,rp) +function s.activate(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil,e,tp) + local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,1,nil,e,tp) if #g>0 and Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP)>0 and Duel.IsExistingMatchingCard(Card.IsFaceup,tp,0,LOCATION_MZONE,1,nil) and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATKDEF) + local sc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() + if not sc then return end + Duel.HintSelection(sc) Duel.BreakEffect() - local tc=Duel.SelectMatchingCard(tp,Card.IsFaceup,tp,0,LOCATION_MZONE,1,1,nil):GetFirst() + --Its original ATK/DEF is halved local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) e1:SetCode(EFFECT_SET_BASE_ATTACK) + e1:SetValue(sc:GetBaseAttack()/2) e1:SetReset(RESET_EVENT|RESETS_STANDARD) - e1:SetValue(tc:GetBaseAttack()/2) - tc:RegisterEffect(e1) - local e2=Effect.CreateEffect(e:GetHandler()) - e2:SetType(EFFECT_TYPE_SINGLE) + sc:RegisterEffect(e1) + local e2=e1:Clone() e2:SetCode(EFFECT_SET_BASE_DEFENSE) - e2:SetReset(RESET_EVENT|RESETS_STANDARD) - e2:SetValue(tc:GetBaseDefense()/2) - tc:RegisterEffect(e2) + e2:SetValue(sc:GetBaseDefense()/2) + sc:RegisterEffect(e2) end -end \ No newline at end of file +end diff --git a/official/c91742238.lua b/official/c91742238.lua index b3ce3fc4dc..3f44875a7b 100644 --- a/official/c91742238.lua +++ b/official/c91742238.lua @@ -3,77 +3,83 @@ --Scripted by Eerie Code local s,id=GetID() function s.initial_effect(c) - --Banish 1 zombie monster from field, then controller of it special summons 1 zombie monster from their GY + --Banish 1 Zombie monster on the field, then Special Summon 1 Zombie monster from the GY of the player who controlled it, to their field, in Defense Position local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) + e1:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e1:SetTarget(s.target) e1:SetOperation(s.activate) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER|TIMING_END_PHASE) c:RegisterEffect(e1) - --Set itself from GY + --Shuffle 1 of your banished Zombie monsters into the Deck, and if you do, Set this card, but banish it when it leaves the field local e2=Effect.CreateEffect(c) - e2:SetCategory(CATEGORY_TODECK) - e2:SetDescription(aux.Stringid(id,0)) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_TODECK+CATEGORY_LEAVE_GRAVE) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) e2:SetTarget(s.settg) e2:SetOperation(s.setop) - e2:SetHintTiming(0,TIMING_END_PHASE) c:RegisterEffect(e2) end function s.rmfilter(c,e,tp) - local p=c:GetControler() - return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and c:IsAbleToRemove() - and Duel.GetMZoneCount(p,c,p,LOCATION_REASON_TOFIELD) - and Duel.IsExistingMatchingCard(s.spfilter,p,LOCATION_GRAVE,0,1,nil,e,tp,p) + local ctrl=c:GetControler() + return c:IsRace(RACE_ZOMBIE) and c:IsFaceup() and c:IsAbleToRemove() and Duel.GetMZoneCount(ctrl,c,tp)>0 + and Duel.IsExistingMatchingCard(s.spfilter,ctrl,LOCATION_GRAVE,0,1,nil,e,tp,ctrl) end -function s.spfilter(c,e,tp,p) - return c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,p) +function s.spfilter(c,e,tp,ctrl) + return c:IsRace(RACE_ZOMBIE) and c:IsCanBeSpecialSummoned(e,0,tp,false,false,POS_FACEUP_DEFENSE,ctrl) end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e,tp) end - Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,PLAYER_ALL,LOCATION_MZONE) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,PLAYER_ALL,LOCATION_GRAVE) + Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,1,PLAYER_EITHER,LOCATION_MZONE) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,PLAYER_EITHER,LOCATION_GRAVE) end function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - if not Duel.IsExistingMatchingCard(s.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil,e,tp) then return end local rc=Duel.SelectMatchingCard(tp,s.rmfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,1,nil,e,tp):GetFirst() - if rc and Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)~=0 then - local p=rc:GetPreviousControler() + if not rc then return end + Duel.HintSelection(rc) + if Duel.Remove(rc,POS_FACEUP,REASON_EFFECT)>0 then + local ctrl=rc:GetPreviousControler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.spfilter),p,LOCATION_GRAVE,0,1,1,nil,e,tp,p) - if #g>0 then Duel.SpecialSummon(g,0,tp,p,false,false,POS_FACEUP_DEFENSE) end + local g=Duel.SelectMatchingCard(tp,s.spfilter,ctrl,LOCATION_GRAVE,0,1,1,nil,e,tp,ctrl) + if #g>0 then + Duel.BreakEffect() + Duel.SpecialSummon(g,0,tp,ctrl,false,false,POS_FACEUP_DEFENSE) + end end end -function s.setfilter(c) - return c:IsFaceup() and c:IsRace(RACE_ZOMBIE) and c:IsAbleToDeck() +function s.tdfilter(c) + return c:IsRace(RACE_ZOMBIE) and c:IsFaceup() and c:IsAbleToDeck() end function s.settg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return e:GetHandler():IsSSetable() - and Duel.IsExistingMatchingCard(s.setfilter,tp,LOCATION_REMOVED,0,1,nil) end - Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,e:GetHandler(),1,0,0) + local c=e:GetHandler() + if chk==0 then return c:IsSSetable() and Duel.IsExistingMatchingCard(s.tdfilter,tp,LOCATION_REMOVED,0,1,nil) end + Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_REMOVED) + Duel.SetOperationInfo(0,CATEGORY_LEAVE_GRAVE,c,1,tp,0) end function s.setop(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) - local g=Duel.SelectMatchingCard(tp,s.setfilter,tp,LOCATION_REMOVED,0,1,1,nil) - if #g>0 and Duel.SendtoDeck(g,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 - and c:IsRelateToEffect(e) and c:IsSSetable() then - Duel.SSet(tp,c) - --Banish it if it leaves the field + local sc=Duel.SelectMatchingCard(tp,s.tdfilter,tp,LOCATION_REMOVED,0,1,1,nil):GetFirst() + if not sc then return end + Duel.HintSelection(sc) + local c=e:GetHandler() + if Duel.SendtoDeck(sc,nil,SEQ_DECKSHUFFLE,REASON_EFFECT)>0 and sc:IsLocation(LOCATION_DECK|LOCATION_EXTRA) + and c:IsRelateToEffect(e) and Duel.SSet(tp,c)>0 then + --Banish it when it leaves the field local e1=Effect.CreateEffect(c) e1:SetDescription(3300) e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) - e1:SetReset(RESET_EVENT|RESETS_REDIRECT) + e1:SetCode(EFFECT_LEAVE_FIELD_REDIRECT) e1:SetValue(LOCATION_REMOVED) + e1:SetReset(RESET_EVENT|RESETS_REDIRECT) c:RegisterEffect(e1) end -end \ No newline at end of file +end diff --git a/official/c9482987.lua b/official/c9482987.lua index 80351477d2..7fb193b7a7 100644 --- a/official/c9482987.lua +++ b/official/c9482987.lua @@ -3,7 +3,7 @@ --Scripted by AlphaKretin local s,id=GetID() function s.initial_effect(c) - --Equip from Extra Deck + --Equip 1 "Magistus" monster you control with 1 "Magistus" monster from your Extra Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_EQUIP) @@ -14,12 +14,12 @@ function s.initial_effect(c) e1:SetTarget(s.eqtg) e1:SetOperation(s.eqop) c:RegisterEffect(e1) - --Destroy, draw 1 card and return 1 card to the Deck + --Destroy 1 face-up Spell you control, and if you do, draw 1 card, then place 1 card from your hand on the bottom of the Deck local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) - e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW) - e2:SetProperty(EFFECT_FLAG_CARD_TARGET) + e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DRAW+CATEGORY_TODECK) e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,{id,1}) e2:SetTarget(s.destg) @@ -27,52 +27,50 @@ function s.initial_effect(c) c:RegisterEffect(e2) end s.listed_series={SET_MAGISTUS} -function s.eqtgfilter(c,tp) - return c:IsFaceup() and c:IsSetCard(SET_MAGISTUS) and Duel.IsExistingMatchingCard(Card.IsSetCard,tp,LOCATION_EXTRA,0,1,nil,SET_MAGISTUS) +function s.eqfilter(c,tp) + return c:IsSetCard(SET_MAGISTUS) and not c:IsForbidden() and c:CheckUniqueOnField(tp) end function s.eqtg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) local c=e:GetHandler() - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.eqtgfilter(chkc,tp) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and chkc:IsSetCard(SET_MAGISTUS) and chkc:IsFaceup() end if chk==0 then return Duel.GetLocationCount(tp,LOCATION_SZONE)>0 - and Duel.IsExistingTarget(s.eqtgfilter,tp,LOCATION_MZONE,0,1,nil,tp) end + and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,nil) + and Duel.IsExistingMatchingCard(s.eqfilter,tp,LOCATION_EXTRA,0,1,nil,tp) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) - Duel.SelectTarget(tp,s.eqtgfilter,tp,LOCATION_MZONE,0,1,1,nil,tp) + Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSetCard,SET_MAGISTUS),tp,LOCATION_MZONE,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_EQUIP,nil,1,tp,LOCATION_EXTRA) end function s.eqop(e,tp,eg,ep,ev,re,r,rp) + if Duel.GetLocationCount(tp,LOCATION_SZONE)<=0 then return end local tc=Duel.GetFirstTarget() - if not (tc:IsRelateToEffect(e) and tc:IsFaceup() and tc:IsLocation(LOCATION_MZONE) - and Duel.GetLocationCount(tp,LOCATION_SZONE)>0) then return end - local ec=Duel.SelectMatchingCard(tp,Card.IsSetCard,tp,LOCATION_EXTRA,0,1,1,nil,SET_MAGISTUS):GetFirst() - if ec then - Duel.Equip(tp,ec,tc,true) - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_EQUIP_LIMIT) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - e1:SetValue(s.eqlimit) - e1:SetLabelObject(tc) - ec:RegisterEffect(e1) + if tc:IsRelateToEffect(e) and tc:IsFaceup() then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_EQUIP) + local ec=Duel.SelectMatchingCard(tp,s.eqfilter,tp,LOCATION_EXTRA,0,1,1,nil,tp):GetFirst() + if ec and Duel.Equip(tp,ec,tc) then + --Equip limit + local e1=Effect.CreateEffect(e:GetHandler()) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e1:SetCode(EFFECT_EQUIP_LIMIT) + e1:SetValue(function(e,c) return c==tc end) + e1:SetReset(RESET_EVENT|RESETS_STANDARD) + ec:RegisterEffect(e1) + end end end -function s.eqlimit(e,c) - return c==e:GetLabelObject() -end -function s.desfilter(c) - return c:IsFaceup() and c:IsSpell() -end function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_ONFIELD) and s.desfilter(chkc) end + if chkc then return chkc:IsOnField() and chkc:IsControler(tp) and chkc:IsSpell() and chkc:IsFaceup() end if chk==0 then return Duel.IsPlayerCanDraw(tp,1) - and Duel.IsExistingTarget(s.desfilter,tp,LOCATION_ONFIELD,0,1,nil) end + and Duel.IsExistingTarget(aux.FaceupFilter(Card.IsSpell),tp,LOCATION_ONFIELD,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_DESTROY) - local g=Duel.SelectTarget(tp,s.desfilter,tp,LOCATION_ONFIELD,0,1,1,nil) + local g=Duel.SelectTarget(tp,aux.FaceupFilter(Card.IsSpell),tp,LOCATION_ONFIELD,0,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,1,tp,0) Duel.SetOperationInfo(0,CATEGORY_DRAW,nil,0,tp,1) + Duel.SetOperationInfo(0,CATEGORY_TODECK,nil,1,tp,LOCATION_HAND) end function s.desop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)~=0 and Duel.Draw(tp,1,REASON_EFFECT)~=0 then + if tc:IsRelateToEffect(e) and Duel.Destroy(tc,REASON_EFFECT)>0 and Duel.Draw(tp,1,REASON_EFFECT)>0 then Duel.ShuffleHand(tp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TODECK) local g=Duel.SelectMatchingCard(tp,Card.IsAbleToDeck,tp,LOCATION_HAND,0,1,1,nil) @@ -81,4 +79,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoDeck(g,nil,SEQ_DECKBOTTOM,REASON_EFFECT) end end -end \ No newline at end of file +end diff --git a/official/c98452268.lua b/official/c98452268.lua index fd6a5c9282..b3e63d3388 100644 --- a/official/c98452268.lua +++ b/official/c98452268.lua @@ -4,10 +4,13 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - c:SetSPSummonOnce(id) - Xyz.AddProcedure(c,nil,7,2,s.ovfilter,aux.Stringid(id,0)) + --Xyz Summon procedure: 2 Level 7 monsters OR 1 "Rebellion" Xyz Monster you control + Xyz.AddProcedure(c,nil,7,2,function(c) return c:IsSetCard(SET_REBELLION) and c:IsType(TYPE_XYZ) and c:IsFaceup() end,aux.Stringid(id,0)) + --Pendulum Summon procedure Pendulum.AddProcedure(c,false) - --special summon + --You can only Special Summon "Odd-Eyes Rebellion Dragon Overlord(s)" once per turn + c:SetSPSummonOnce(id) + --Special Summon this card from your Pendulum Zone, then Special Summon from your Extra Deck, 1 "Rebellion" or "The Phantom Knights" monster, using this card as material (this is treated as an Xyz Summon), then you can attach 1 card from your Pendulum Zone to it as material local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -17,108 +20,81 @@ function s.initial_effect(c) e1:SetTarget(s.sptg) e1:SetOperation(s.spop) c:RegisterEffect(e1) - --multi attack - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e2:SetCode(EVENT_SPSUMMON_SUCCESS) - e2:SetCondition(s.condition) - e2:SetOperation(s.operation) - c:RegisterEffect(e2) + --This card that was Xyz Summoned using a Rank 7 Xyz Monster as material can make up to 3 attacks during each Battle Phase + local e2a=Effect.CreateEffect(c) + e2a:SetType(EFFECT_TYPE_SINGLE) + e2a:SetCode(EFFECT_EXTRA_ATTACK) + e2a:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) end) + e2a:SetValue(2) + c:RegisterEffect(e2a) + local e2b=Effect.CreateEffect(c) + e2b:SetType(EFFECT_TYPE_SINGLE) + e2b:SetCode(EFFECT_MATERIAL_CHECK) + e2b:SetValue(s.valcheck) + c:RegisterEffect(e2b) + --Place this card in your Pendulum Zone local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_SINGLE) - e3:SetCode(EFFECT_MATERIAL_CHECK) - e3:SetValue(s.valcheck) - e3:SetLabelObject(e2) + e3:SetDescription(aux.Stringid(id,2)) + e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e3:SetProperty(EFFECT_FLAG_DELAY) + e3:SetCode(EVENT_DESTROYED) + e3:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) end) + e3:SetTarget(function(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.CheckPendulumZones(tp) end end) + e3:SetOperation(s.penop) c:RegisterEffect(e3) - --pendulum zone - local e4=Effect.CreateEffect(c) - e4:SetDescription(aux.Stringid(id,2)) - e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e4:SetCode(EVENT_DESTROYED) - e4:SetProperty(EFFECT_FLAG_DELAY) - e4:SetCondition(s.pencon) - e4:SetTarget(s.pentg) - e4:SetOperation(s.penop) - c:RegisterEffect(e4) end -s.listed_names={} s.pendulum_level=7 +s.listed_names={id} s.listed_series={SET_REBELLION,SET_THE_PHANTOM_KNIGHTS} -function s.ovfilter(c) - return c:IsFaceup() and c:IsSetCard(SET_REBELLION) and c:IsType(TYPE_XYZ) -end -function s.spfilter(c,e,tp,mc,pg) - return c:IsFacedown() and (c:IsSetCard(SET_REBELLION) or c:IsSetCard(SET_THE_PHANTOM_KNIGHTS)) and c:IsType(TYPE_XYZ) - and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 - and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) +function s.spfilter(c,e,tp,mc) + return c:IsSetCard({SET_REBELLION,SET_THE_PHANTOM_KNIGHTS}) and c:IsType(TYPE_XYZ) and c:IsFacedown() + and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0 and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and mc:IsCanBeXyzMaterial(c,tp) and not c:IsCode(id) - and (not pg or #pg<=0 or pg:IsContains(mc)) 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 Duel.IsPlayerCanSpecialSummonCount(tp,2) - and c:IsCanBeSpecialSummoned(e,0,tp,false,false) - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) + if chk==0 then + local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) + return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and Duel.IsPlayerCanSpecialSummonCount(tp,2) + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) and (#pg<=0 or (#pg==1 and pg:IsContains(c))) + and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) + end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,2,tp,LOCATION_EXTRA) 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)==0 then return end - local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c,pg) - local sc=g:GetFirst() - if sc then - Duel.BreakEffect() - sc:SetMaterial(Group.FromCards(c)) + if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then + local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(c),tp,nil,nil,REASON_XYZ) + if not (#pg<=0 or (#pg==1 and pg:IsContains(c))) then return end + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,c):GetFirst() + if not sc then return end + sc:SetMaterial(c) Duel.Overlay(sc,c) - Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP) + Duel.BreakEffect() + if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)==0 then return end sc:CompleteProcedure() - local xg=Duel.GetFieldGroup(tp,LOCATION_PZONE,0) - if #xg>0 and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then - local cd=Duel.SelectMatchingCard(tp,aux.TRUE,tp,LOCATION_PZONE,0,1,1,nil):GetFirst() + if Duel.IsExistingMatchingCard(Card.IsCanBeXyzMaterial,tp,LOCATION_PZONE,0,1,nil,c,tp,REASON_EFFECT) and Duel.SelectYesNo(tp,aux.Stringid(id,3)) then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATTACH) + local matc=Duel.SelectMatchingCard(tp,Card.IsCanBeXyzMaterial,tp,LOCATION_PZONE,0,1,1,nil,c,tp,REASON_EFFECT):GetFirst() + if not matc then return end + Duel.HintSelection(matc) Duel.BreakEffect() - Duel.Overlay(sc,cd) + Duel.Overlay(sc,matc) end end end -function s.valfilter(c) - return c:IsType(TYPE_XYZ) and c:GetRank()==7 +function s.valcheckfilter(c) + return c:IsRank(7) and c:IsType(TYPE_XYZ) end function s.valcheck(e,c) - e:GetLabelObject():SetLabel(c:GetMaterial():FilterCount(s.valfilter,nil)) -end -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():IsXyzSummoned() -end -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - local ct=e:GetLabel() - if ct>0 then - local e1=Effect.CreateEffect(c) - e1:SetDescription(aux.Stringid(id,4)) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) - e1:SetCode(EFFECT_EXTRA_ATTACK) - e1:SetValue(2) - e1:SetReset(RESET_EVENT|RESETS_STANDARD) - c:RegisterEffect(e1) + if c:GetMaterial():IsExists(s.valcheckfilter,1,nil) then + c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~(RESET_TOFIELD|RESET_LEAVE|RESET_TEMP_REMOVE),EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,4)) end end -function s.pencon(e,tp,eg,ep,ev,re,r,rp) - local c=e:GetHandler() - return (r&REASON_EFFECT+REASON_BATTLE)~=0 and c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup() -end -function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.CheckPendulumZones(tp) end -end function s.penop(e,tp,eg,ep,ev,re,r,rp) - if not Duel.CheckPendulumZones(tp) then return false end local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true) end -end \ No newline at end of file +end