diff --git a/cards_specific_functions.lua b/cards_specific_functions.lua index 64751054c3..7a0d7d84ea 100644 --- a/cards_specific_functions.lua +++ b/cards_specific_functions.lua @@ -871,32 +871,33 @@ end Drytron={} function Drytron.TributeCostFilter(c,tp) return ((c:IsSetCard(SET_DRYTRON) and c:IsMonster()) or c:IsRitualMonster()) and (c:IsControler(tp) or c:IsFaceup()) - and (c:IsInMainMZone(tp) or Duel.GetLocationCount(tp,LOCATION_MZONE)>0) + and Duel.GetMZoneCount(tp,c)>0 end function Drytron.TributeBaseCost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.CheckReleaseGroupCost(tp,Drytron.TributeCostFilter,1,true,nil,e:GetHandler(),tp) end - local sg=Duel.SelectReleaseGroupCost(tp,Drytron.TributeCostFilter,1,1,true,nil,e:GetHandler(),tp) + local c=e:GetHandler() + if chk==0 then return Duel.CheckReleaseGroupCost(tp,Drytron.TributeCostFilter,1,true,nil,c,tp) end + local sg=Duel.SelectReleaseGroupCost(tp,Drytron.TributeCostFilter,1,1,true,nil,c,tp) Duel.Release(sg,REASON_COST) end +function Drytron.ExtraCon(base,e,tp,eg,ep,ev,re,r,rp) + return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 +end function Drytron.TributeExtraCost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() local id=c:GetOriginalCode() if chk==0 then return Duel.GetCustomActivityCount(id,tp,ACTIVITY_SPSUMMON)==0 end - --Cannot Special Summon this turn, except Unsummonable + --You cannot Special Summon monsters, except monsters that cannot be Normal Summoned/Set, the turn you activate this effect local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,1)) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_OATH+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) - e1:SetReset(RESET_PHASE+PHASE_END) e1:SetTargetRange(1,0) - e1:SetTarget(Drytron.TributeSummonLimit) + e1:SetTarget(function(e,c) return c:IsSummonableCard() end) + e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end -function Drytron.TributeSummonLimit(e,c) - return c:IsSummonableCard() -end -Drytron.TributeCost=aux.CostWithReplace(Drytron.TributeBaseCost,CARD_URSARCTIC_DRYTRON,nil,Drytron.TributeExtraCost) +Drytron.TributeCost=aux.CostWithReplace(Drytron.TributeBaseCost,CARD_URSARCTIC_DRYTRON,Drytron.ExtraCon,Drytron.TributeExtraCost) --[[ Effect.CreateMysteruneQPEffect(c,id,[uniquecat,uniquetg,uniqueop,rmcount,uniqueprop,uniquecode]) diff --git a/official/c16471775.lua b/official/c16471775.lua index 398f985371..2369b692f4 100644 --- a/official/c16471775.lua +++ b/official/c16471775.lua @@ -3,37 +3,34 @@ --Scripted by edo9300 local s,id=GetID() function s.initial_effect(c) - --add 2 + --Add 2 "Ursarctic" monsters from your Deck to your hand local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetCountLimit(1,id) - e1:SetCost(s.cost) + e1:SetCost(Cost.Discard(nil,true)) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --Banish replace + --If you would Tribute a monster(s) to activate an "Ursarctic" monster's effect, except the turn this card was sent to the GY, you can banish this card from your GY instead local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) + e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) - e2:SetTargetRange(1,0) + e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) e2:SetRange(LOCATION_GRAVE) + e2:SetTargetRange(1,0) e2:SetCountLimit(1,{id,1}) - e2:SetCondition(aux.AND(s.repcon,aux.exccon)) + e2:SetCondition(aux.AND(aux.exccon,function(e) return e:GetHandler():IsAbleToRemoveAsCost() end)) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end -s.listed_series={0xa3} -function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,e:GetHandler()) end - Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST+REASON_DISCARD) -end +s.listed_series={SET_URSARCTIC} function s.thfilter(c) - return c:IsSetCard(0x165) and c:IsMonster() and c:IsAbleToHand() + return c:IsSetCard(SET_URSARCTIC) and c:IsMonster() and c:IsAbleToHand() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,2,2,nil) end @@ -47,14 +44,11 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp) Duel.ConfirmCards(1-tp,g) end end -function s.repcon(e) - return e:GetHandler():IsAbleToRemoveAsCost() -end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - return c:IsMonster() and c:IsSetCard(0x165) and (not extracon or extracon(base,c,e,tp,eg,ep,ev,re,r,rp,chk)) + return c:IsSetCard(SET_URSARCTIC) and c:IsMonster() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) - Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST+REASON_REPLACE) -end + Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST|REASON_REPLACE) +end \ No newline at end of file diff --git a/official/c25725326.lua b/official/c25725326.lua index 769f988796..56779badea 100644 --- a/official/c25725326.lua +++ b/official/c25725326.lua @@ -4,62 +4,52 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - --1 Level 4 or lower "Prank-Kids" monster - Link.AddProcedure(c,s.mfilter,1,1) - --Can only Link Summon "Prank-Kids Meow-Meow-Mu" once per turn + --Link Summon procedure: 1 Level 4 or lower "Prank-Kids" monster + Link.AddProcedure(c,s.matfilter,1,1) + --You can only Link Summon "Prank-Kids Meow-Meow-Mu" once per turn + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) + e0:SetCode(EVENT_SPSUMMON_SUCCESS) + e0:SetCondition(function(e) return e:GetHandler():IsLinkSummoned() end) + e0:SetOperation(s.regop) + c:RegisterEffect(e0) + --If a "Prank-Kids" monster you control would Tribute itself to activate its effect during your opponent's turn, you can banish this card you control or from your GY instead local e1=Effect.CreateEffect(c) - e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE) - e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) - e1:SetCode(EVENT_SPSUMMON_SUCCESS) - e1:SetCondition(s.regcon) - e1:SetOperation(s.regop) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetType(EFFECT_TYPE_FIELD) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) + e1:SetCode(CARD_PRANKKIDS_MEOWMU) + e1:SetRange(LOCATION_MZONE|LOCATION_GRAVE) + e1:SetTargetRange(1,0) + e1:SetCountLimit(1,id) + e1:SetCondition(function(e) return e:GetHandler():IsAbleToRemoveAsCost() end) + e1:SetValue(s.repval) + e1:SetOperation(s.repop) c:RegisterEffect(e1) - --Replace "Prank-Kids" monsters' Tribute cost - local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetType(EFFECT_TYPE_FIELD) - e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) - e2:SetCode(CARD_PRANKKIDS_MEOWMU) - e2:SetRange(LOCATION_MZONE+LOCATION_GRAVE) - e2:SetTargetRange(1,0) - e2:SetCountLimit(1,id) - e2:SetCondition(s.repcon) - e2:SetValue(s.repval) - e2:SetOperation(s.repop) - c:RegisterEffect(e2) end +s.listed_series={SET_PRANK_KIDS} s.listed_names={id} -s.listed_series={0x120} -function s.mfilter(c,lc,sumtype,tp) - return c:IsSetCard(0x120,lc,sumtype,tp) and c:IsLevelBelow(4) -end -function s.regcon(e,tp,eg,ep,ev,re,r,rp) - return e:GetHandler():IsSummonType(SUMMON_TYPE_LINK) +function s.matfilter(c,lc,sumtype,tp) + return c:IsSetCard(SET_PRANK_KIDS,lc,sumtype,tp) and c:IsLevelBelow(4) end function s.regop(e,tp,eg,ep,ev,re,r,rp) - --Cannot Link Summon "Prank-Kids Meow-Meow-Mu" + --You cannot Link Summon "Prank-Kids Meow-Meow-Mu" for the rest of this turn local e1=Effect.CreateEffect(e:GetHandler()) e1:SetType(EFFECT_TYPE_FIELD) - e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) + e1:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON) e1:SetTargetRange(1,0) - e1:SetReset(RESET_PHASE+PHASE_END) - e1:SetTarget(s.splimit) + e1:SetTarget(function(e,c,sump,sumtype,sumpos,targetp,se) return c:IsCode(id) and sumtype&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK end) + e1:SetReset(RESET_PHASE|PHASE_END) Duel.RegisterEffect(e1,tp) end -function s.splimit(e,c,sump,sumtype,sumpos,targetp,se) - return c:IsCode(id) and sumtype&SUMMON_TYPE_LINK==SUMMON_TYPE_LINK -end -function s.repcon(e) - return e:GetHandler():IsAbleToRemoveAsCost() -end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - local bp=e:GetHandlerPlayer() - return Duel.IsTurnPlayer(1-bp) and c:IsSetCard(0x120) and c:IsLocation(LOCATION_MZONE) and c:IsControler(bp) - and (not extracon or extracon(base,e,tp,eg,ep,ev,re,r,rp)) + return Duel.IsTurnPlayer(1-tp) and c:IsSetCard(SET_PRANK_KIDS) and c:IsLocation(LOCATION_MZONE) and c:IsControler(tp) + and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) - Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST+REASON_REPLACE) + Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST|REASON_REPLACE) end \ No newline at end of file diff --git a/official/c27693363.lua b/official/c27693363.lua index ef4f8de96d..29d312b16b 100644 --- a/official/c27693363.lua +++ b/official/c27693363.lua @@ -2,45 +2,39 @@ --Ursarctic Polari local s,id=GetID() function s.initial_effect(c) - --Must be properly summoned before reviving c:EnableReviveLimit() - --Must be Special Summoned by its own method + c:AddMustBeSpecialSummoned() + --Must be Special Summoned (from your Extra Deck) by sending 2 monsters you control with a Level difference of 1 to the GY (1 Tuner and 1 non-Tuner) + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_FIELD) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) + e0:SetCode(EFFECT_SPSUMMON_PROC) + e0:SetRange(LOCATION_EXTRA) + e0:SetCondition(s.sprcon) + e0:SetTarget(s.sprtg) + e0:SetOperation(s.sprop) + c:RegisterEffect(e0) + --Activate 1 "Ursarctic Big Dipper" from your Deck 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:SetDescription(aux.Stringid(id,0)) + e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) + e1:SetProperty(EFFECT_FLAG_DELAY) + e1:SetCode(EVENT_SPSUMMON_SUCCESS) + e1:SetCountLimit(1,id) + e1:SetTarget(s.acttg) + e1:SetOperation(s.actop) c:RegisterEffect(e1) - --Special Summon procedure (from the Extra Deck) + --Add to your hand, or Special Summon, 1 "Ursarctic" monster from your GY local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(EFFECT_SPSUMMON_PROC) - e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) - e2:SetRange(LOCATION_EXTRA) - e2:SetCondition(s.sprcon) - e2:SetTarget(s.sprtg) - e2:SetOperation(s.sprop) + e2:SetDescription(aux.Stringid(id,1)) + e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SPECIAL_SUMMON) + e2:SetType(EFFECT_TYPE_IGNITION) + e2:SetRange(LOCATION_MZONE) + e2:SetCountLimit(1,{id,1}) + e2:SetCost(aux.CostWithReplace(s.thspcost,CARD_URSARCTIC_BIG_DIPPER,s.extracon)) + e2:SetTarget(s.thsptg) + e2:SetOperation(s.thspop) c:RegisterEffect(e2) - --Activate 1 "Ursarctic Big Dipper" from your Deck - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,0)) - e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O) - e3:SetCode(EVENT_SPSUMMON_SUCCESS) - e3:SetProperty(EFFECT_FLAG_DELAY) - e3:SetCountLimit(1,id) - e3:SetCondition(s.accon) - e3:SetOperation(s.acop) - c:RegisterEffect(e3) - --Add to hand or Special Summon 1 "Ursarctic" monster from the GY - local e4=Effect.CreateEffect(c) - e4:SetDescription(aux.Stringid(id,1)) - e4:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_TOHAND) - e4:SetType(EFFECT_TYPE_IGNITION) - e4:SetRange(LOCATION_MZONE) - e4:SetCountLimit(1,{id,1}) - e4:SetCost(aux.CostWithReplace(s.cost,CARD_URSARCTIC_BIG_DIPPER,s.extracon)) - e4:SetTarget(s.target) - e4:SetOperation(s.operation) - c:RegisterEffect(e4) end s.listed_series={SET_URSARCTIC} s.listed_names={CARD_URSARCTIC_BIG_DIPPER} @@ -83,50 +77,51 @@ function s.sprop(e,tp,eg,ep,ev,re,r,rp,c) if not g then return end Duel.SendtoGrave(g,REASON_COST) end -function s.fieldfilter(c,tp) +function s.actfilter(c,tp) return c:IsCode(CARD_URSARCTIC_BIG_DIPPER) and c:GetActivateEffect() and c:GetActivateEffect():IsActivatable(tp,true,true) end -function s.accon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsExistingMatchingCard(s.fieldfilter,tp,LOCATION_DECK,0,1,nil,tp) +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.acop(e,tp,eg,ep,ev,re,r,rp) +function s.actop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD) - local tc=Duel.SelectMatchingCard(tp,s.fieldfilter,tp,LOCATION_DECK,0,1,1,nil,tp):GetFirst() - Duel.ActivateFieldSpell(tc,e,tp,eg,ep,ev,re,r,rp) + 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 -function s.cost(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then return Duel.CheckReleaseGroupCost(tp,Card.IsLevelAbove,1,false,nil,nil,7) end - local sg=Duel.SelectReleaseGroupCost(tp,Card.IsLevelAbove,1,1,false,nil,nil,7) - Duel.Release(sg,REASON_COST) +function s.thspcostfilter(c,e,tp) + return c:IsLevelAbove(7) and Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp,Duel.GetMZoneCount(tp,c)>0) end -function s.extracon(base,c,e,tp) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,c,ft,base,tp) +function s.thspfilter(c,e,tp,mmz_chk) + return (c:IsSetCard(SET_URSARCTIC) and c:IsMonster()) and (c:IsAbleToHand() or (mmz_chk and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) end -function s.filter(c,ft,e,tp) - return (c:IsSetCard(SET_URSARCTIC) and c:IsMonster()) and (c:IsAbleToHand() or (ft>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false))) +function s.thspcost(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.CheckReleaseGroupCost(tp,s.thspcostfilter,1,false,nil,nil,e,tp) end + local g=Duel.SelectReleaseGroupCost(tp,s.thspcostfilter,1,1,false,nil,nil,e,tp) + Duel.Release(g,REASON_COST) end -function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_GRAVE,0,1,nil,ft,e,tp) - end +function s.thsptg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return true end 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 -function s.operation(e,tp,eg,ep,ev,re,r,rp) - local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) - Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SELF) - local tc=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_GRAVE,0,1,1,nil,ft,e,tp):GetFirst() - if tc then - aux.ToHandOrElse(tc,tp, - function(tc) - return ft>0 and tc:IsCanBeSpecialSummoned(e,0,tp,false,false) +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_GRAVE,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(tc) - Duel.SpecialSummon(tc,0,tp,tp,false,false,POS_FACEUP) + function() + Duel.SpecialSummon(sc,0,tp,tp,false,false,POS_FACEUP) end, - aux.Stringid(id,1)) - end + aux.Stringid(id,3) + ) +end +function s.extracon(base,e,tp,eg,ep,ev,re,r,rp,c) + return Duel.IsExistingMatchingCard(s.thspfilter,tp,LOCATION_GRAVE,0,1,c,e,tp,Duel.GetLocationCount(tp,LOCATION_MZONE)>0) end \ No newline at end of file diff --git a/official/c29942771.lua b/official/c29942771.lua index 1d46011d84..79ac33ed49 100644 --- a/official/c29942771.lua +++ b/official/c29942771.lua @@ -1,9 +1,9 @@ --- ナチュル・カメリア --- Naturia Camellia --- Scripted by Hatter +--ナチュル・カメリア +--Naturia Camellia +--Scripted by Hatter local s,id=GetID() function s.initial_effect(c) - -- Send 1 "Naturia" card to the GY + --Send 1 "Naturia" card from your Deck to the GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_TOGRAVE) @@ -17,7 +17,7 @@ function s.initial_effect(c) local e2=e1:Clone() e2:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e2) - -- "Naturia" tribute replacement + --If you would Tribute a monster(s) to activate a "Naturia" monster's effect, you can send the top 2 cards of your Deck to the GY instead local e3=Effect.CreateEffect(c) e3:SetDescription(aux.Stringid(id,1)) e3:SetType(EFFECT_TYPE_FIELD) @@ -26,11 +26,11 @@ function s.initial_effect(c) e3:SetRange(LOCATION_MZONE) e3:SetTargetRange(1,0) e3:SetCountLimit(1,{id,1}) - e3:SetCondition(s.repcon) + e3:SetCondition(function(e) return Duel.IsPlayerCanDiscardDeckAsCost(e:GetHandlerPlayer(),2) end) e3:SetValue(s.repval) e3:SetOperation(s.repop) c:RegisterEffect(e3) - -- Special Summon 1 "Naturia" monster + --Special Summon 1 "Naturia" monster from your GY local e4=Effect.CreateEffect(c) e4:SetDescription(aux.Stringid(id,2)) e4:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -39,7 +39,7 @@ function s.initial_effect(c) e4:SetCode(EVENT_SUMMON_SUCCESS) e4:SetRange(LOCATION_MZONE) e4:SetCountLimit(1,{id,2}) - e4:SetCondition(s.spcon) + e4:SetCondition(function(e,tp,eg) return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) end) e4:SetTarget(s.sptg) e4:SetOperation(s.spop) c:RegisterEffect(e4) @@ -47,9 +47,9 @@ function s.initial_effect(c) e5:SetCode(EVENT_SPSUMMON_SUCCESS) c:RegisterEffect(e5) end -s.listed_series={0x2a} +s.listed_series={SET_NATURIA} function s.tgfilter(c) - return c:IsSetCard(0x2a) and c:IsAbleToGrave() + return c:IsSetCard(SET_NATURIA) and c:IsAbleToGrave() end function s.tgtg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_DECK,0,1,nil) end @@ -62,22 +62,16 @@ function s.tgop(e,tp,eg,ep,ev,re,r,rp) Duel.SendtoGrave(g,REASON_EFFECT) end end -function s.repcon(e) - return Duel.IsPlayerCanDiscardDeckAsCost(e:GetHandlerPlayer(),2) -end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - return c:IsMonster() and c:IsSetCard(0x2a) + return c:IsSetCard(SET_NATURIA) and c:IsMonster() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) Duel.DiscardDeck(tp,2,REASON_COST) end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(Card.IsSummonPlayer,1,nil,1-tp) -end function s.spfilter(c,e,tp) - return c:IsSetCard(0x2a) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) + return c:IsSetCard(SET_NATURIA) 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 diff --git a/official/c30983281.lua b/official/c30983281.lua index 35f2581259..7d23d7e736 100644 --- a/official/c30983281.lua +++ b/official/c30983281.lua @@ -2,9 +2,9 @@ --Accel Synchro Stardust Dragon local s,id=GetID() function s.initial_effect(c) - --Synchro Summon procedure - Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) c:EnableReviveLimit() + --Synchro Summon procedure: 1 Tuner + 1+ non-Tuner monsters + Synchro.AddProcedure(c,nil,1,1,Synchro.NonTuner(nil),1,99) --Special Summon 1 Level 2 or lower Tuner from your GY local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) @@ -14,101 +14,85 @@ function s.initial_effect(c) e1:SetCode(EVENT_SPSUMMON_SUCCESS) e1:SetCountLimit(1,{id,1}) e1:SetCondition(function(e) return e:GetHandler():IsSynchroSummoned() end) - e1:SetTarget(s.sptg) - e1:SetOperation(s.spop) + e1:SetTarget(s.gysptg) + e1:SetOperation(s.gyspop) c:RegisterEffect(e1) - --Special Summon 1 "Stardust Dragon" from your Extra Deck, then Synchro Summon + --Special Summon 1 "Stardust Dragon" from your Extra Deck (this is treated as a Synchro Summon), then, immediately after this effect resolves, Synchro Summon using monsters you control as material local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) - e2:SetHintTiming(0,TIMING_MAIN_END) + e2:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e2:SetCountLimit(1,{id,2}) e2:SetCondition(function() return Duel.IsMainPhase() end) - e2:SetCost(aux.CostWithReplace(s.spcost,84012625,function() return e2:GetLabel()==1 end)) - e2:SetTarget(s.sptg2) - e2:SetOperation(s.spop2) + e2:SetCost(aux.CostWithReplace(Cost.AND(Cost.SelfTribute,s.exspcost),84012625,s.extracon)) + e2:SetTarget(s.exsptg) + e2:SetOperation(s.exspop) c:RegisterEffect(e2) end s.listed_names={CARD_STARDUST_DRAGON} -function s.spfilter(c,e,tp) +function s.gyspfilter(c,e,tp) return c:IsLevelBelow(2) and c:IsType(TYPE_TUNER) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end - --Activation legality -function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) +function s.gysptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.gyspfilter,tp,LOCATION_GRAVE,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_GRAVE) end - --Special Summon 1 Level 2 or lower Tuner from GY -function s.spop(e,tp,eg,ep,ev,re,r,rp) +function s.gyspop(e,tp,eg,ep,ev,re,r,rp) if Duel.GetLocationCount(tp,LOCATION_MZONE)<=0 then return end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) + local g=Duel.SelectMatchingCard(tp,s.gyspfilter,tp,LOCATION_GRAVE,0,1,1,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end -function s.spfilter2(c,e,tp,rc,step) - local mg=Duel.GetMatchingGroup(Card.IsCanBeSynchroMaterial,tp,LOCATION_MZONE,0,rc) +function s.exspfilter(c,e,tp,rc,step) + local mg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeSynchroMaterial),tp,LOCATION_MZONE,0,rc) local pg=aux.GetMustBeMaterialGroup(tp,Group.CreateGroup(),tp,c,nil,REASON_SYNCHRO) return c:IsCode(CARD_STARDUST_DRAGON) and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_SYNCHRO,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,rc,c)>0 and (step or (#pg<=0 and aux.CheckSummonGate(tp,2) - and Duel.IsExistingMatchingCard(s.scfilter,tp,LOCATION_EXTRA,0,1,c,mg+c))) -end -function s.scfilter(c,mg) - return c:IsSynchroSummonable(nil,mg) + and Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,c,nil,mg+c))) end - --Activation legality -function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return c:IsReleasable() and Duel.IsPlayerCanSpecialSummonCount(tp,2) - and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp,c) end - Duel.Release(c,REASON_COST) +function s.exspcost(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsExistingMatchingCard(s.exspfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,e:GetHandler()) end end -function s.sptg2(e,tp,eg,ep,ev,re,r,rp,chk) - if chk==0 then - if e:GetHandler():IsReleasable() and Duel.IsPlayerCanSpecialSummonCount(tp,2) - and Duel.IsExistingMatchingCard(s.spfilter2,tp,LOCATION_EXTRA,0,1,nil,e,tp) then - e:SetLabel(1) - else - e:SetLabel(0) - end - return true - end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) +function s.exsptg(e,tp,eg,ep,ev,re,r,rp,chk) + if chk==0 then return Duel.IsPlayerCanSpecialSummonCount(tp,2) end + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,2,tp,LOCATION_EXTRA) end - --Special Summon 1 "Stardust Dragon" from your Extra Deck, then Synchro Summon -function s.spop2(e,tp,eg,ep,ev,re,r,rp) +function s.exspop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local tc=Duel.SelectMatchingCard(tp,s.spfilter2,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil,true):GetFirst() - if tc and Duel.SpecialSummon(tc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)>0 then - tc:CompleteProcedure() - --Unaffected by the opponent's activated effects - local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetDescription(aux.Stringid(id,2)) - e1:SetType(EFFECT_TYPE_SINGLE) - e1:SetCode(EFFECT_IMMUNE_EFFECT) - e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE+EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT) - e1:SetRange(LOCATION_MZONE) - e1:SetValue(s.immval) - e1:SetReset(RESET_EVENT|(RESETS_STANDARD&~RESET_TOFIELD)|RESET_PHASE|PHASE_END) - tc:RegisterEffect(e1,true) - local mg=Duel.GetMatchingGroup(aux.FaceupFilter(Card.IsCanBeSynchroMaterial),tp,LOCATION_MZONE,0,nil) - local eg=Duel.GetMatchingGroup(s.scfilter,tp,LOCATION_EXTRA,0,nil,mg) - if #eg>0 then + local stardustc=Duel.SelectMatchingCard(tp,s.exspfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp,nil,true):GetFirst() + if not stardustc then return end + stardustc:SetMaterial(nil) + if Duel.SpecialSummon(stardustc,SUMMON_TYPE_SYNCHRO,tp,tp,false,false,POS_FACEUP)>0 then + stardustc:CompleteProcedure() + local sg=Group.CreateGroup(stardustc) + if Duel.IsExistingMatchingCard(Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,nil,nil) then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local sc=eg:Select(tp,1,1,nil):GetFirst() - if not sc then return end - Duel.SynchroSummon(tp,sc,nil,mg) - --Unaffected by the opponent's activated effects - local e2=e1:Clone() - sc:RegisterEffect(e2,true) + local sync=Duel.SelectMatchingCard(tp,Card.IsSynchroSummonable,tp,LOCATION_EXTRA,0,1,1,nil,nil):GetFirst() + if sync then + sg:AddCard(sync) + Duel.SynchroSummon(tp,sync,nil) + end + end + local c=e:GetHandler() + for sc in sg:Iter() do + --For the rest of this turn, the monsters Synchro Summoned by this effect are unaffected by your opponent's activated effects + local e1=Effect.CreateEffect(c) + e1:SetDescription(aux.Stringid(id,2)) + e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_IGNORE_IMMUNE+EFFECT_FLAG_CLIENT_HINT) + e1:SetCode(EFFECT_IMMUNE_EFFECT) + e1:SetValue(function(e,te) return te:GetOwnerPlayer()==1-e:GetHandlerPlayer() and te:IsActivated() end) + e1:SetReset(RESETS_STANDARD_PHASE_END&~RESET_TOFIELD) + sc:RegisterEffect(e1,true) end end end -function s.immval(e,te) - return te:GetOwnerPlayer()~=e:GetHandlerPlayer() and te:IsActivated() +function s.extracon(base,e,tp,eg,ep,ev,re,r,rp) + return Duel.IsExistingMatchingCard(s.exspfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end \ No newline at end of file diff --git a/official/c44509529.lua b/official/c44509529.lua index bd8b4c25b1..e7b4335867 100644 --- a/official/c44509529.lua +++ b/official/c44509529.lua @@ -4,85 +4,81 @@ local s,id=GetID() function s.initial_effect(c) c:EnableReviveLimit() - --2 "Prank-Kids" monsters - Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,0x120),2) - --Activation Limit + --Fusion Materials: 2 "Prank-Kids" monsters + Fusion.AddProcMixN(c,true,true,aux.FilterBoolFunctionEx(Card.IsSetCard,SET_PRANK_KIDS),2) + --If your "Prank-Kids" monster attacks, your opponent cannot activate cards or effects until the end of the Damage Step local e1=Effect.CreateEffect(c) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) e1:SetRange(LOCATION_MZONE) e1:SetTargetRange(0,1) - e1:SetValue(1) e1:SetCondition(s.actcon) + e1:SetValue(1) c:RegisterEffect(e1) - --Special Summon 2 non-Fusion "Prank-Kids" monsters with different names from GY + --Special Summon 2 "Prank-Kids" non-Fusion Monsters with different names from your GY local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,0)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_QUICK_O) + e2:SetProperty(EFFECT_FLAG_CARD_TARGET) e2:SetCode(EVENT_FREE_CHAIN) e2:SetRange(LOCATION_MZONE) e2:SetCountLimit(1,id) - e2:SetHintTiming(0,TIMINGS_CHECK_MONSTER_E+TIMING_MAIN_END) - e2:SetCondition(s.spcon) - e2:SetCost(aux.CostWithReplace(s.spcost,CARD_PRANKKIDS_MEOWMU,s.spcostextracon)) + e2:SetHintTiming(0,TIMING_STANDBY_PHASE|TIMING_MAIN_END|TIMINGS_CHECK_MONSTER_E) + e2:SetCondition(function(e,tp) return Duel.IsTurnPlayer(1-tp) end) + e2:SetCost(aux.CostWithReplace(Cost.SelfTribute,CARD_PRANKKIDS_MEOWMU,s.extracon)) e2:SetTarget(s.sptg) e2:SetOperation(s.spop) c:RegisterEffect(e2) end -s.listed_series={0x120} +s.listed_series={SET_PRANK_KIDS} function s.actcon(e) - local a=Duel.GetAttacker() - return a and a:IsControler(e:GetHandlerPlayer()) and a:IsSetCard(0x120) -end -function s.spcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsTurnPlayer(1-tp) -end -function s.spcostextracon(base,e,tp,eg,ep,ev,re,r,rp) - local bc=base:GetHandler() - if Duel.GetMZoneCount(tp,bc)<2 then return false end - local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,bc,e,tp) - return aux.SelectUnselectGroup(g,e,tp,2,2,s.spcheck,0) -end -function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return c:IsReleasable() and Duel.GetMZoneCount(tp,c)>1 end - Duel.Release(c,REASON_COST) + local ac=Duel.GetAttacker() + return ac and ac:IsControler(e:GetHandlerPlayer()) and ac:IsSetCard(SET_PRANK_KIDS) and ac:IsRelateToBattle() end function s.spfilter(c,e,tp) - return c:IsSetCard(0x120) and not c:IsType(TYPE_FUSION) - and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) -end -function s.spcheck(sg,e,tp) - return sg:GetClassCount(Card.GetCode)==2 + return c:IsSetCard(SET_PRANK_KIDS) and not c:IsType(TYPE_FUSION) and c:IsCanBeEffectTarget(e) + and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return false end local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,nil,e,tp) - if chk==0 then return not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) - and aux.SelectUnselectGroup(g,e,tp,2,2,s.spcheck,0) end - local tg=aux.SelectUnselectGroup(g,e,tp,2,2,s.spcheck,1,tp,HINTMSG_SPSUMMON) + if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>=2 + and not Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT) + and aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) end + local tg=aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,1,tp,HINTMSG_SPSUMMON) Duel.SetTargetCard(tg) - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,#tg,0,0) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,tg,2,tp,0) end function s.spop(e,tp,eg,ep,ev,re,r,rp) - local g=Duel.GetTargetCards(e) - if #g==0 or Duel.GetLocationCount(tp,LOCATION_MZONE)<#g - or (#g>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end + local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) + if ft<=0 then return end + local tg=Duel.GetTargetCards(e) + if #tg==0 or (#tg>1 and Duel.IsPlayerAffectedByEffect(tp,CARD_BLUEEYES_SPIRIT)) then return end + if ft<#tg then + Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) + tg=tg:FilterSelect(tp,Card.IsCanBeSpecialSummoned,ft,ft,nil,e,0,tp,false,false) + end local c=e:GetHandler() - for tc in g:Iter() do - if Duel.SpecialSummonStep(tc,0,tp,tp,false,false,POS_FACEUP) then - --Cannot be destroyed by battle + for sc in tg:Iter() do + if Duel.SpecialSummonStep(sc,0,tp,tp,false,false,POS_FACEUP) then + --They cannot be destroyed by battle this turn local e1=Effect.CreateEffect(c) e1:SetDescription(3000) - e1:SetProperty(EFFECT_FLAG_CLIENT_HINT) e1:SetType(EFFECT_TYPE_SINGLE) + e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CLIENT_HINT) e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE) e1:SetValue(1) - e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) - tc:RegisterEffect(e1) + e1:SetReset(RESETS_STANDARD_PHASE_END) + sc:RegisterEffect(e1) end end Duel.SpecialSummonComplete() end +function s.extracon(base,e,tp,eg,ep,ev,re,r,rp) + local repl_c=base:GetHandler() + if Duel.GetMZoneCount(tp,repl_c)<2 then return false end + local g=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_GRAVE,0,repl_c,e,tp) + return aux.SelectUnselectGroup(g,e,tp,2,2,aux.dncheck,0) +end \ No newline at end of file diff --git a/official/c62714453.lua b/official/c62714453.lua index 227d5c3788..eea206d634 100644 --- a/official/c62714453.lua +++ b/official/c62714453.lua @@ -3,34 +3,28 @@ --scripted by Naim local s,id=GetID() function s.initial_effect(c) - --Must be properly summoned before reviving c:EnableReviveLimit() - --Must be Special Summoned by its own method + c:AddMustBeSpecialSummoned() + --Must be Special Summoned (from your Extra Deck) by sending 2 monsters you control with a Level difference of 1 to the GY (1 Tuner and 1 non-Tuner) + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_FIELD) + e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) + e0:SetCode(EFFECT_SPSUMMON_PROC) + e0:SetRange(LOCATION_EXTRA) + e0:SetCondition(s.sprcon) + e0:SetTarget(s.sprtg) + e0:SetOperation(s.sprop) + c:RegisterEffect(e0) + --Special Summon 1 Level 7 "Ursarctic" Synchro Monster from your Extra Deck 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:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_SPECIAL_SUMMON) + e1:SetType(EFFECT_TYPE_IGNITION) + e1:SetRange(LOCATION_MZONE) + e1:SetCost(aux.CostWithReplace(s.spcost,CARD_URSARCTIC_BIG_DIPPER,s.extracon)) + e1:SetTarget(s.sptg) + e1:SetOperation(s.spop) c:RegisterEffect(e1) - --Special Summon procedure (from the Extra Deck) - local e2=Effect.CreateEffect(c) - e2:SetType(EFFECT_TYPE_FIELD) - e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE) - e2:SetCode(EFFECT_SPSUMMON_PROC) - e2:SetRange(LOCATION_EXTRA) - e2:SetCondition(s.sprcon) - e2:SetTarget(s.sprtg) - e2:SetOperation(s.sprop) - c:RegisterEffect(e2) - --Special Summon 1 Level 7 "Ursactic" Synchro Monster from the Extra Deck - local e3=Effect.CreateEffect(c) - e3:SetDescription(aux.Stringid(id,0)) - e3:SetCategory(CATEGORY_SPECIAL_SUMMON) - e3:SetType(EFFECT_TYPE_IGNITION) - e3:SetRange(LOCATION_MZONE) - e3:SetCost(aux.CostWithReplace(s.spcost,CARD_URSARCTIC_BIG_DIPPER,s.extracon)) - e3:SetTarget(s.sptg) - e3:SetOperation(s.spop) - c:RegisterEffect(e3) end s.listed_series={SET_URSARCTIC} function s.sprfilter(c) @@ -72,20 +66,16 @@ function s.sprop(e,tp,eg,ep,ev,re,r,rp,c) if not g then return end Duel.SendtoGrave(g,REASON_COST) end -function s.extracon(base,c,e,tp) - return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) -end -function s.ursfilter(c) - return c:IsSetCard(SET_URSARCTIC) and c:IsLevel(8) -end function s.spcheck(sg,tp,exg,e) local c=e:GetHandler() return sg:IsExists(s.ursfilter,1,c) and sg:IsContains(c) and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg+c) end +function s.ursfilter(c) + return c:IsSetCard(SET_URSARCTIC) and c:IsLevel(8) +end function s.spfilter(c,e,tp,mustg) - return c:IsLevel(7) and c:IsSetCard(SET_URSARCTIC) - and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) + return c:IsLevel(7) and c:IsSetCard(SET_URSARCTIC) and c:IsType(TYPE_SYNCHRO) and c:IsCanBeSpecialSummoned(e,0,tp,true,false) and Duel.GetLocationCountFromEx(tp,tp,mustg,c)>0 end function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) @@ -99,11 +89,10 @@ function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) end function s.spop(e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() - if tc and Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP)>0 then - local c=e:GetHandler() - --Grant an effect to the summoned monster - local e1=Effect.CreateEffect(tc) + 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,true,false,POS_FACEUP)>0 then + --It gains this effect: ● Your opponent cannot activate the effects of monsters with a Level, that were Special Summoned from the Extra Deck. + local e1=Effect.CreateEffect(sc) e1:SetType(EFFECT_TYPE_FIELD) e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) e1:SetCode(EFFECT_CANNOT_ACTIVATE) @@ -111,19 +100,22 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) e1:SetTargetRange(0,1) e1:SetValue(s.aclimit) e1:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e1,true) - if not tc:IsType(TYPE_EFFECT) then - local e2=Effect.CreateEffect(c) + sc:RegisterEffect(e1,true) + if not sc:IsType(TYPE_EFFECT) then + local e2=Effect.CreateEffect(e:GetHandler()) e2:SetType(EFFECT_TYPE_SINGLE) e2:SetCode(EFFECT_ADD_TYPE) e2:SetValue(TYPE_EFFECT) e2:SetReset(RESET_EVENT|RESETS_STANDARD) - tc:RegisterEffect(e2,true) + sc:RegisterEffect(e2,true) end - tc:RegisterFlagEffect(0,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) + sc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,1)) end end function s.aclimit(e,re,tp) local rc=re:GetHandler() return re:IsMonsterEffect() and rc:HasLevel() and rc:IsSummonLocation(LOCATION_EXTRA) and rc:IsLocation(LOCATION_MZONE) +end +function s.extracon(base,e,tp,eg,ep,ev,re,r,rp) + return Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp) end \ No newline at end of file diff --git a/official/c84012625.lua b/official/c84012625.lua index 3a0bb1eca3..c6cd8a45b5 100644 --- a/official/c84012625.lua +++ b/official/c84012625.lua @@ -2,71 +2,71 @@ --Cosmic Flare local s,id=GetID() function s.initial_effect(c) - --activate + --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_CARD_TARGET) - e1:SetCondition(s.condition) + e1:SetCode(EVENT_FREE_CHAIN) + e1:SetHintTiming(0,TIMING_MAIN_END|TIMING_BATTLE_START) + e1:SetCondition(function() return Duel.IsAbleToEnterBP() or (Duel.IsBattlePhase() and not Duel.IsPhase(PHASE_BATTLE)) end) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) + --If a "Stardust" Synchro Monster you control would Tribute itself to activate its effect, you can banish this card from your GY instead local e2=Effect.CreateEffect(c) + e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetCode(id) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) - e2:SetTargetRange(1,0) + e2:SetCode(84012625) e2:SetRange(LOCATION_GRAVE) - e2:SetCondition(s.repcon) + e2:SetTargetRange(1,0) + e2:SetCondition(function(e) return e:GetHandler():IsAbleToRemoveAsCost() end) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) end -s.listed_series={0xa3} -function s.condition(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsAbleToEnterBP() or (Duel.GetCurrentPhase()>=PHASE_BATTLE_START and Duel.GetCurrentPhase()<=PHASE_BATTLE) -end -function s.filter(c) - return c:IsFaceup() and c:IsSetCard(0xa3) and c:IsType(TYPE_SYNCHRO) +s.listed_series={SET_STARDUST} +function s.tgfilter(c) + return c:IsSetCard(SET_STARDUST) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() end function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc) - if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.filter(chkc) end - if chk==0 then return Duel.IsExistingTarget(s.filter,tp,LOCATION_MZONE,0,1,nil) end + if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(tp) and s.tgfilter(chkc) end + if chk==0 then return Duel.IsExistingTarget(s.tgfilter,tp,LOCATION_MZONE,0,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET) - Duel.SelectTarget(tp,s.filter,tp,LOCATION_MZONE,0,1,1,nil) + Duel.SelectTarget(tp,s.tgfilter,tp,LOCATION_MZONE,0,1,1,nil) end function s.activate(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() if tc:IsFaceup() and tc:IsRelateToEffect(e) then - --return to hand + tc:RegisterFlagEffect(id,RESETS_STANDARD_PHASE_END,EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,2)) + --This turn, if that Synchro Monster you control battles an opponent's monster, shuffle that opponent's monster into the Deck at the start of the Damage Step local e1=Effect.CreateEffect(e:GetHandler()) - e1:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS) + e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) e1:SetCode(EVENT_BATTLE_START) - e1:SetOwnerPlayer(tp) e1:SetCondition(s.tdcon) e1:SetOperation(s.tdop) - e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END) - tc:RegisterEffect(e1,true) + e1:SetReset(RESET_PHASE|PHASE_END) + Duel.RegisterEffect(e1,tp) end end function s.tdcon(e,tp,eg,ep,ev,re,r,rp) - local tc=e:GetHandler():GetBattleTarget() - return tp==e:GetOwnerPlayer() and tc and tc:IsControler(1-tp) + local bc1=Duel.GetBattleMonster(tp) + if not bc1 then return false end + local bc2=bc1:GetBattleTarget() + return bc1 and bc1:IsType(TYPE_SYNCHRO) and bc1:IsFaceup() and bc1:HasFlagEffect(id) + and bc2 and bc2:IsControler(1-tp) end function s.tdop(e,tp,eg,ep,ev,re,r,rp) - local tc=e:GetHandler():GetBattleTarget() - Duel.SendtoDeck(tc,nil,2,REASON_EFFECT) -end -function s.repcon(e) - return e:GetHandler():IsAbleToRemoveAsCost() + local bc1=Duel.GetBattleMonster(tp) + Duel.SendtoDeck(bc1:GetBattleTarget(),nil,SEQ_DECKSHUFFLE,REASON_EFFECT) end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - return c:IsFaceup() and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) - and c:IsSetCard(0xa3) and c:IsType(TYPE_SYNCHRO) and (extracon==nil or extracon()) + return c:IsSetCard(SET_STARDUST) and c:IsType(TYPE_SYNCHRO) and c:IsControler(tp) and c:IsLocation(LOCATION_MZONE) + and c:IsFaceup() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) - Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST+REASON_REPLACE) + Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST|REASON_REPLACE) end \ No newline at end of file diff --git a/official/c89264428.lua b/official/c89264428.lua index 76936ef327..992209f702 100644 --- a/official/c89264428.lua +++ b/official/c89264428.lua @@ -2,92 +2,87 @@ --Ursarctic Big Dipper --Scripted by Eerie Code local s,id=GetID() +local COUNTER_BIG_DIPPER=0x204 function s.initial_effect(c) - c:EnableCounterPermit(0x204) + c:EnableCounterPermit(COUNTER_BIG_DIPPER) --Activate + local e0=Effect.CreateEffect(c) + e0:SetType(EFFECT_TYPE_ACTIVATE) + e0:SetCode(EVENT_FREE_CHAIN) + c:RegisterEffect(e0) + --Once per turn, if your "Ursarctic" monster would Tribute a monster(s) to activate its effect, you can banish 1 Level 7 or higher "Ursarctic" monster from your GY instead local e1=Effect.CreateEffect(c) - e1:SetType(EFFECT_TYPE_ACTIVATE) - e1:SetCode(EVENT_FREE_CHAIN) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetType(EFFECT_TYPE_FIELD) + e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET) + e1:SetCode(CARD_URSARCTIC_BIG_DIPPER) + e1:SetRange(LOCATION_FZONE) + e1:SetTargetRange(1,0) + e1:SetCountLimit(1) + e1:SetCondition(s.repcon) + e1:SetValue(s.repval) + e1:SetOperation(s.repop) c:RegisterEffect(e1) - --Tribute Substitute + --Each time a monster(s) is Special Summoned, place 1 counter on this card local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) - e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) - e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) + e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) + e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_FZONE) - e2:SetTargetRange(1,0) - e2:SetCountLimit(1) - e2:SetCondition(s.repcon) - e2:SetValue(s.repval) - e2:SetOperation(s.repop) + e2:SetOperation(function(e) e:GetHandler():AddCounter(COUNTER_BIG_DIPPER,1) end) c:RegisterEffect(e2) - --Add 1 counter to itself each time a monster is Special Summoned + --Take control of 1 monster your opponent controls local e3=Effect.CreateEffect(c) - e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS) - e3:SetRange(LOCATION_FZONE) + e3:SetDescription(aux.Stringid(id,1)) + e3:SetCategory(CATEGORY_CONTROL) + e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) + e3:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) e3:SetCode(EVENT_SPSUMMON_SUCCESS) - e3:SetOperation(s.countop) + e3:SetRange(LOCATION_FZONE) + e3:SetCountLimit(1) + e3:SetCost(s.ctrlcost) + e3:SetTarget(s.ctrltg) + e3:SetOperation(s.ctrlop) c:RegisterEffect(e3) - --Take control of 1 monster the opponent controls - local e4=Effect.CreateEffect(c) - e4:SetDescription(aux.Stringid(id,1)) - e4:SetCategory(CATEGORY_CONTROL) - e4:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e4:SetCode(EVENT_SPSUMMON_SUCCESS) - e4:SetProperty(EFFECT_FLAG_DELAY+EFFECT_FLAG_CARD_TARGET) - e4:SetRange(LOCATION_FZONE) - e4:SetCountLimit(1) - e4:SetCondition(s.ctcon) - e4:SetCost(s.ctcost) - e4:SetTarget(s.cttg) - e4:SetOperation(s.ctop) - c:RegisterEffect(e4) end s.listed_series={SET_URSARCTIC} -s.counter_place_list={0x204} -function s.repcfilter(c,extracon,base,params) - return c:IsSetCard(SET_URSARCTIC) and c:IsLevelAbove(7) and c:IsAbleToRemoveAsCost() - and (not extracon or extracon(base,c,table.unpack(params))) +s.counter_place_list={COUNTER_BIG_DIPPER} +function s.repconfilter(c,extracon,base,e,tp,eg,ep,ev,re,r,rp) + return c:IsLevelAbove(7) and c:IsSetCard(SET_URSARCTIC) and c:IsAbleToRemoveAsCost() + and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp,c)) end function s.repcon(e) - return Duel.IsExistingMatchingCard(s.repcfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil) + return Duel.IsExistingMatchingCard(s.repconfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil) end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - return c:IsMonster() and c:IsSetCard(SET_URSARCTIC) and - (not extracon or Duel.IsExistingMatchingCard(s.repcfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil,extracon,base,{e,tp,eg,ep,ev,re,r,rp,chk})) + return c:IsSetCard(SET_URSARCTIC) and c:IsMonster() + and (extracon==nil or Duel.IsExistingMatchingCard(s.repconfilter,e:GetHandlerPlayer(),LOCATION_GRAVE,0,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp)) end -function s.repop(base,e,tp,eg,ep,ev,re,r,rp) +function s.repop(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) Duel.Hint(HINT_CARD,0,id) Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_REMOVE) - local g=Duel.SelectMatchingCard(tp,s.repcfilter,tp,LOCATION_GRAVE,0,1,1,nil) - Duel.Remove(g,POS_FACEUP,REASON_COST+REASON_REPLACE) -end -function s.countop(e,tp,eg,ep,ev,re,r,rp) - e:GetHandler():AddCounter(0x204,1) + local g=Duel.SelectMatchingCard(tp,s.repconfilter,tp,LOCATION_GRAVE,0,1,1,nil,extracon,base,e,tp,eg,ep,ev,re,r,rp) + Duel.Remove(g,POS_FACEUP,REASON_COST|REASON_REPLACE) end -function s.ctcfilter(c) - return c:IsFaceup() and c:IsType(TYPE_SYNCHRO) and c:IsSetCard(SET_URSARCTIC) -end -function s.ctcon(e,tp,eg,ep,ev,re,r,rp) - return Duel.IsExistingMatchingCard(s.ctcfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) -end -function s.ctcost(e,tp,eg,ep,ev,re,r,rp,chk) +function s.ctrlcost(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() - if chk==0 then return c:IsCanRemoveCounter(tp,0x204,7,REASON_COST) end - c:RemoveCounter(tp,0x204,c:GetCounter(0x204),REASON_COST) + if chk==0 then return c:IsCanRemoveCounter(tp,COUNTER_BIG_DIPPER,7,REASON_COST) end + c:RemoveCounter(tp,COUNTER_BIG_DIPPER,c:GetCounter(COUNTER_BIG_DIPPER),REASON_COST) +end +function s.ctrlconfilter(c) + return c:IsSetCard(SET_URSARCTIC) and c:IsType(TYPE_SYNCHRO) and c:IsFaceup() end -function s.cttg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) +function s.ctrltg(e,tp,eg,ep,ev,re,r,rp,chk,chkc) if chkc then return chkc:IsLocation(LOCATION_MZONE) and chkc:IsControler(1-tp) and chkc:IsControlerCanBeChanged() end - if chk==0 then return Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) end + if chk==0 then return Duel.IsExistingMatchingCard(s.ctrlconfilter,tp,LOCATION_MZONE,LOCATION_MZONE,1,nil) + and Duel.IsExistingTarget(Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,nil) end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_CONTROL) local g=Duel.SelectTarget(tp,Card.IsControlerCanBeChanged,tp,0,LOCATION_MZONE,1,1,nil) Duel.SetOperationInfo(0,CATEGORY_CONTROL,g,1,tp,0) end -function s.ctop(e,tp,eg,ep,ev,re,r,rp) +function s.ctrlop(e,tp,eg,ep,ev,re,r,rp) local tc=Duel.GetFirstTarget() - if tc:IsRelateToEffect(e) and e:GetHandler():IsRelateToEffect(e) then + if tc:IsRelateToEffect(e) then Duel.GetControl(tc,tp) end end \ No newline at end of file diff --git a/official/c89771220.lua b/official/c89771220.lua index 6a7e5d8578..6fc5932656 100644 --- a/official/c89771220.lua +++ b/official/c89771220.lua @@ -5,22 +5,23 @@ local s,id=GetID() function s.initial_effect(c) --Activate local e1=Effect.CreateEffect(c) - e1:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_REMOVE) + e1:SetDescription(aux.Stringid(id,0)) + e1:SetCategory(CATEGORY_REMOVE+CATEGORY_SPECIAL_SUMMON) e1:SetType(EFFECT_TYPE_ACTIVATE) e1:SetCode(EVENT_FREE_CHAIN) e1:SetTarget(s.target) e1:SetOperation(s.activate) c:RegisterEffect(e1) - --Banish replace + --If you would Tribute a monster(s) to activate an "Ursarctic" or "Drytron" monster's effect, you can banish this card from your GY instead local e2=Effect.CreateEffect(c) - e2:SetDescription(aux.Stringid(id,0)) + e2:SetDescription(aux.Stringid(id,1)) e2:SetType(EFFECT_TYPE_FIELD) - e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) e2:SetProperty(EFFECT_FLAG_PLAYER_TARGET) - e2:SetTargetRange(1,0) + e2:SetCode(CARD_URSARCTIC_BIG_DIPPER) e2:SetRange(LOCATION_GRAVE) + e2:SetTargetRange(1,0) e2:SetCountLimit(1,id) - e2:SetCondition(s.repcon) + e2:SetCondition(function(e) return e:GetHandler():IsAbleToRemoveAsCost() end) e2:SetValue(s.repval) e2:SetOperation(s.repop) c:RegisterEffect(e2) @@ -29,55 +30,52 @@ function s.initial_effect(c) c:RegisterEffect(e3) end s.listed_names={33250142,89264428,58793369,27693363,97148796} -s.listed_series={0x165,0x151} +--"Ultimate Flagship Ursatron", "Ursarctic Big Dipper", "Drytron Fafnir", "Ursarctic Polari", "Drytron Alpha Thuban" +s.listed_series={SET_URSARCTIC,SET_DRYTRON} function s.rmfilter(c) return c:IsCode(89264428,58793369) and c:IsAbleToRemove() end -function s.excheck(tp) - return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,27693363,97148796),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) -end -function s.spfilter(c,e,tp,sg) - return c:IsCode(33250142) and Duel.GetLocationCountFromEx(tp,tp,sg,c)>0 - and c:IsCanBeSpecialSummoned(e,0,tp,true,false) -end -function s.spcheck(sg,e,tp,mg) +function s.rescon(sg,e,tp,mg) return sg:GetClassCount(Card.GetCode)==2 and sg:FilterCount(Card.IsLocation,nil,LOCATION_DECK)<=1 and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_EXTRA,0,1,nil,e,tp,sg) end +function s.spfilter(c,e,tp,sg) + return c:IsCode(33250142) and Duel.GetLocationCountFromEx(tp,tp,sg,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false) +end function s.target(e,tp,eg,ep,ev,re,r,rp,chk) - local loc=LOCATION_HAND | LOCATION_ONFIELD - if s.excheck(tp) then - loc = loc | LOCATION_DECK + local locations=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,27693363,97148796),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) + and LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK + or LOCATION_HAND|LOCATION_ONFIELD + if chk==0 then + local g=Duel.GetMatchingGroup(s.rmfilter,tp,locations,0,nil) + return aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,0) end - local g=Duel.GetMatchingGroup(s.rmfilter,tp,loc,0,nil) - if chk==0 then return aux.SelectUnselectGroup(g,e,tp,2,2,s.spcheck,0) end - Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_HAND+LOCATION_ONFIELD) + Duel.SetOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,locations) Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_EXTRA) - Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,1,tp,LOCATION_DECK) + Duel.SetPossibleOperationInfo(0,CATEGORY_REMOVE,nil,2,tp,LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK) end function s.activate(e,tp,eg,ep,ev,re,r,rp) - local loc=LOCATION_HAND | LOCATION_ONFIELD - if s.excheck(tp) then - loc = loc | LOCATION_DECK - end - local g=Duel.GetMatchingGroup(s.rmfilter,tp,loc,0,nil) - local sg=aux.SelectUnselectGroup(g,e,tp,2,2,s.spcheck,1,tp,HINTMSG_REMOVE) - if #sg==2 and Duel.Remove(sg,POS_FACEUP,REASON_EFFECT)==2 then + local locations=Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsCode,27693363,97148796),tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) + and LOCATION_HAND|LOCATION_ONFIELD|LOCATION_DECK + or LOCATION_HAND|LOCATION_ONFIELD + local g=Duel.GetMatchingGroup(s.rmfilter,tp,locations,0,nil) + if #g<=1 then return end + local rg=aux.SelectUnselectGroup(g,e,tp,2,2,s.rescon,1,tp,HINTMSG_REMOVE) + if #rg==2 and Duel.Remove(rg,POS_FACEUP,REASON_EFFECT)==2 then Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local tc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() - if tc then - Duel.SpecialSummon(tc,0,tp,tp,true,false,POS_FACEUP) + local sc=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst() + if not sc then return end + Duel.BreakEffect() + if Duel.SpecialSummon(sc,0,tp,tp,true,false,POS_FACEUP)>0 then + sc:CompleteProcedure() end end end -function s.repcon(e) - return e:GetHandler():IsAbleToRemoveAsCost() -end function s.repval(base,e,tp,eg,ep,ev,re,r,rp,chk,extracon) local c=e:GetHandler() - return c:IsMonster() and (c:IsSetCard(0x165) or c:IsSetCard(0x151)) and (not extracon or extracon(base,c,e,tp,eg,ep,ev,re,r,rp,chk)) + return c:IsSetCard({SET_URSARCTIC,SET_DRYTRON}) and c:IsMonster() and (extracon==nil or extracon(base,e,tp,eg,ep,ev,re,r,rp)) end function s.repop(base,e,tp,eg,ep,ev,re,r,rp) Duel.Hint(HINT_CARD,0,id) - Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST+REASON_REPLACE) + Duel.Remove(base:GetHandler(),POS_FACEUP,REASON_COST|REASON_REPLACE) end \ No newline at end of file diff --git a/official/c93454062.lua b/official/c93454062.lua index cdb534f47e..d61c182302 100644 --- a/official/c93454062.lua +++ b/official/c93454062.lua @@ -1,9 +1,9 @@ --- ナチュル・モルクリケット --- Naturia Molcricket --- Scripted by Hatter +--ナチュル・モルクリケット +--Naturia Mole Cricket +--Scripted by Hatter local s,id=GetID() function s.initial_effect(c) - -- Special Summon 1 "Naturia" monster + --Special Summon 1 "Naturia" monster from your Deck local e1=Effect.CreateEffect(c) e1:SetDescription(aux.Stringid(id,0)) e1:SetCategory(CATEGORY_SPECIAL_SUMMON) @@ -11,41 +11,36 @@ function s.initial_effect(c) e1:SetCode(EVENT_FREE_CHAIN) e1:SetRange(LOCATION_MZONE) e1:SetCountLimit(1,id) - e1:SetHintTiming(0,TIMINGS_CHECK_MONSTER+TIMING_MAIN_END) + e1:SetHintTiming(0,TIMING_MAIN_END|TIMINGS_CHECK_MONSTER) e1:SetCondition(function() return Duel.IsMainPhase() end) - e1:SetCost(aux.CostWithReplace(s.spcost,CARD_NATURIA_CAMELLIA)) - e1:SetTarget(s.sptg) - e1:SetOperation(s.spop) + e1:SetCost(aux.CostWithReplace(Cost.SelfTribute,CARD_NATURIA_CAMELLIA,function(base,e,tp,eg,ep,ev,re,r,rp) return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 end)) + e1:SetTarget(s.decksptg) + e1:SetOperation(s.deckspop) c:RegisterEffect(e1) - -- Special Summon this card + --Special Summon this card local e2=Effect.CreateEffect(c) e2:SetDescription(aux.Stringid(id,1)) e2:SetCategory(CATEGORY_SPECIAL_SUMMON) e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O) - e2:SetProperty(EFFECT_FLAG_DELAY) + e2:SetProperty(EFFECT_FLAG_DELAY,EFFECT_FLAG2_CHECK_SIMULTANEOUS) e2:SetCode(EVENT_SPSUMMON_SUCCESS) e2:SetRange(LOCATION_GRAVE) e2:SetCountLimit(1,{id,1}) - e2:SetCondition(s.gspcon) - e2:SetTarget(s.gsptg) - e2:SetOperation(s.gspop) + e2:SetCondition(s.selfspcon) + e2:SetTarget(s.selfsptg) + e2:SetOperation(s.selfspop) c:RegisterEffect(e2) end -s.listed_series={0x2a} -function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk) - local c=e:GetHandler() - if chk==0 then return c:IsReleasable() end - Duel.Release(c,REASON_COST) -end -function s.spfilter(c,e,tp) - return c:IsSetCard(0x2a) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) +s.listed_series={SET_NATURIA} +function s.deckspfilter(c,e,tp) + return c:IsSetCard(SET_NATURIA) and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end -function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk) +function s.decksptg(e,tp,eg,ep,ev,re,r,rp,chk) if chk==0 then return Duel.GetMZoneCount(tp,e:GetHandler())>0 - and Duel.IsExistingMatchingCard(s.spfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end + and Duel.IsExistingMatchingCard(s.deckspfilter,tp,LOCATION_DECK,0,1,nil,e,tp) end Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_DECK) end -function s.spop(e,tp,eg,ep,ev,re,r,rp) +function s.deckspop(e,tp,eg,ep,ev,re,r,rp) local ft=Duel.GetLocationCount(tp,LOCATION_MZONE) if ft<1 then return end local ct=1 @@ -54,24 +49,24 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp) if maxg and maxg:IsExists(Card.IsControler,1,nil,1-tp) then ct=2 end end Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON) - local g=Duel.SelectMatchingCard(tp,s.spfilter,tp,LOCATION_DECK,0,1,ct,nil,e,tp) + local g=Duel.SelectMatchingCard(tp,s.deckspfilter,tp,LOCATION_DECK,0,1,ct,nil,e,tp) if #g>0 then Duel.SpecialSummon(g,0,tp,tp,false,false,POS_FACEUP) end end -function s.gspconfilter(c,tp) - return c:IsSummonLocation(LOCATION_EXTRA) and (c:IsSummonPlayer(1-tp) or (c:IsFaceup() and c:IsSetCard(0x2a))) +function s.selfspconfilter(c,tp) + return c:IsSummonLocation(LOCATION_EXTRA) and (c:IsSummonPlayer(1-tp) or (c:IsFaceup() and c:IsSetCard(SET_NATURIA))) end -function s.gspcon(e,tp,eg,ep,ev,re,r,rp) - return eg:IsExists(s.gspconfilter,1,nil,tp) +function s.selfspcon(e,tp,eg,ep,ev,re,r,rp) + return eg:IsExists(s.selfspconfilter,1,nil,tp) end -function s.gsptg(e,tp,eg,ep,ev,re,r,rp,chk) +function s.selfsptg(e,tp,eg,ep,ev,re,r,rp,chk) local c=e:GetHandler() if chk==0 then return Duel.GetLocationCount(tp,LOCATION_MZONE)>0 and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end - Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,0,0) + Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0) end -function s.gspop(e,tp,eg,ep,ev,re,r,rp) +function s.selfspop(e,tp,eg,ep,ev,re,r,rp) local c=e:GetHandler() if c:IsRelateToEffect(e) then Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP) diff --git a/utility.lua b/utility.lua index 663f992eca..421ae05cf5 100644 --- a/utility.lua +++ b/utility.lua @@ -191,7 +191,7 @@ function Auxiliary.CostWithReplace(base,replacecode,extracon,alwaysexecute) elseif cost_chk and not Duel.SelectEffectYesNo(tp,eff:GetHandler()) then return base(e,tp,eg,ep,ev,re,r,rp,1) end - local res={eff:GetOperation()(eff,e,tp,eg,ep,ev,re,r,rp,chk)} + local res={eff:GetOperation()(eff,e,tp,eg,ep,ev,re,r,rp,chk,extracon)} eff:UseCountLimit(tp) return table.unpack(res) end