Skip to content

Commit 8cd9e23

Browse files
authored
"Desert Twister" updates
- Use "Card.AddMustBeSpecialSummoned" and "Cost.Discard". - The Special Summon procedure should have the "EFFECT_FLAG_CANNOT_DISABLE" property. - Simplify the checks for the monsters to banish for the procedure.
1 parent 9fba643 commit 8cd9e23

File tree

1 file changed

+31
-48
lines changed

1 file changed

+31
-48
lines changed

official/c81977953.lua

Lines changed: 31 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,47 @@
11
--デザート・ツイスター
22
--Desert Twister
3-
--Substitute ID
43
local s,id=GetID()
54
function s.initial_effect(c)
65
c:EnableReviveLimit()
7-
--Special summon status
8-
local e1=Effect.CreateEffect(c)
9-
e1:SetType(EFFECT_TYPE_SINGLE)
10-
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
11-
e1:SetCode(EFFECT_SPSUMMON_CONDITION)
12-
c:RegisterEffect(e1)
6+
c:AddMustBeSpecialSummoned()
137
--Must be Special Summoned (from your hand) by banishing 2 WIND and 1 EARTH monsters from your GY
14-
local e2=Effect.CreateEffect(c)
15-
e2:SetDescription(aux.Stringid(id,0))
16-
e2:SetType(EFFECT_TYPE_FIELD)
17-
e2:SetCode(EFFECT_SPSUMMON_PROC)
18-
e2:SetProperty(EFFECT_FLAG_UNCOPYABLE)
19-
e2:SetRange(LOCATION_HAND)
20-
e2:SetCondition(s.spcon)
21-
e2:SetTarget(s.sptg)
22-
e2:SetOperation(s.spop)
23-
c:RegisterEffect(e2)
8+
local e0=Effect.CreateEffect(c)
9+
e0:SetDescription(aux.Stringid(id,0))
10+
e0:SetType(EFFECT_TYPE_FIELD)
11+
e0:SetProperty(EFFECT_FLAG_UNCOPYABLE+EFFECT_FLAG_CANNOT_DISABLE)
12+
e0:SetCode(EFFECT_SPSUMMON_PROC)
13+
e0:SetRange(LOCATION_HAND)
14+
e0:SetCondition(s.spcon)
15+
e0:SetTarget(s.sptg)
16+
e0:SetOperation(s.spop)
17+
c:RegisterEffect(e0)
2418
--Destroy 1 Spell/Trap on the field
25-
local e3=Effect.CreateEffect(c)
26-
e3:SetDescription(aux.Stringid(id,1))
27-
e3:SetCategory(CATEGORY_DESTROY)
28-
e3:SetProperty(EFFECT_FLAG_CARD_TARGET)
29-
e3:SetType(EFFECT_TYPE_IGNITION)
30-
e3:SetCountLimit(1)
31-
e3:SetRange(LOCATION_MZONE)
32-
e3:SetCost(s.descost)
33-
e3:SetTarget(s.destg)
34-
e3:SetOperation(s.desop)
35-
c:RegisterEffect(e3)
36-
end
37-
function s.rescon(sg,e,tp,mg)
38-
return aux.ChkfMMZ(1)(sg,e,tp,mg) and sg:IsExists(s.atchk1,1,nil,sg)
19+
local e1=Effect.CreateEffect(c)
20+
e1:SetDescription(aux.Stringid(id,1))
21+
e1:SetCategory(CATEGORY_DESTROY)
22+
e1:SetType(EFFECT_TYPE_IGNITION)
23+
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
24+
e1:SetRange(LOCATION_MZONE)
25+
e1:SetCountLimit(1)
26+
e1:SetCost(Cost.Discard())
27+
e1:SetTarget(s.destg)
28+
e1:SetOperation(s.desop)
29+
c:RegisterEffect(e1)
3930
end
40-
function s.atchk1(c,sg)
41-
return c:IsAttribute(ATTRIBUTE_EARTH) and sg:FilterCount(Card.IsAttribute,c,ATTRIBUTE_WIND)==2
31+
function s.spcostfilter(c)
32+
return c:IsAttribute(ATTRIBUTE_WIND|ATTRIBUTE_EARTH) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
4233
end
43-
function s.spfilter(c,att)
44-
return c:IsAttribute(att) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
34+
function s.rescon(sg,e,tp,mg)
35+
return Duel.GetMZoneCount(tp,sg)>0 and sg:IsExists(Card.IsAttribute,2,nil,ATTRIBUTE_WIND) and sg:IsExists(Card.IsAttribute,1,nil,ATTRIBUTE_EARTH)
4536
end
4637
function s.spcon(e,c)
4738
if c==nil then return true end
4839
local tp=c:GetControler()
49-
local rg1=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_EARTH)
50-
local rg2=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_WIND)
51-
local rg=rg1:Clone()
52-
rg:Merge(rg2)
53-
return Duel.GetLocationCount(tp,LOCATION_MZONE)>-3 and #rg1>0 and #rg2>1
54-
and aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,0)
40+
local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil)
41+
return #rg>=3 and aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,0)
5542
end
56-
function s.sptg(e,tp,eg,ep,ev,re,r,rp,c)
57-
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,ATTRIBUTE_EARTH+ATTRIBUTE_WIND)
43+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
44+
local rg=Duel.GetMatchingGroup(s.spcostfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil)
5845
local g=aux.SelectUnselectGroup(rg,e,tp,3,3,s.rescon,1,tp,HINTMSG_REMOVE,nil,nil,true)
5946
if #g>0 then
6047
g:KeepAlive()
@@ -69,10 +56,6 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
6956
Duel.Remove(g,POS_FACEUP,REASON_COST)
7057
g:DeleteGroup()
7158
end
72-
function s.descost(e,tp,eg,ep,ev,re,r,rp,chk)
73-
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsDiscardable,tp,LOCATION_HAND,0,1,nil) end
74-
Duel.DiscardHand(tp,Card.IsDiscardable,1,1,REASON_COST|REASON_DISCARD)
75-
end
7659
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
7760
if chkc then return chkc:IsOnField() and chkc:IsSpellTrap() end
7861
if chk==0 then return Duel.IsExistingTarget(Card.IsSpellTrap,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,1,nil) end
@@ -85,4 +68,4 @@ function s.desop(e,tp,eg,ep,ev,re,r,rp)
8568
if tc:IsRelateToEffect(e) then
8669
Duel.Destroy(tc,REASON_EFFECT)
8770
end
88-
end
71+
end

0 commit comments

Comments
 (0)