Skip to content

Commit c4e268c

Browse files
authored
use Duel.GetMZoneCount
1 parent 64a3f52 commit c4e268c

File tree

1 file changed

+23
-31
lines changed

1 file changed

+23
-31
lines changed

official/c71544954.lua

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,30 @@
33
local s,id=GetID()
44
function s.initial_effect(c)
55
c:EnableReviveLimit()
6-
--special summon
7-
local e1=Effect.CreateEffect(c)
8-
e1:SetDescription(aux.Stringid(id,0))
9-
e1:SetType(EFFECT_TYPE_FIELD)
10-
e1:SetCode(EFFECT_SPSUMMON_PROC)
11-
e1:SetProperty(EFFECT_FLAG_UNCOPYABLE)
12-
e1:SetRange(LOCATION_HAND)
13-
e1:SetCondition(s.spcon)
14-
e1:SetTarget(s.sptg)
15-
e1:SetOperation(s.spop)
16-
c:RegisterEffect(e1)
17-
--cannot special summon
18-
local e2=Effect.CreateEffect(c)
19-
e2:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
20-
e2:SetType(EFFECT_TYPE_SINGLE)
21-
e2:SetCode(EFFECT_SPSUMMON_CONDITION)
22-
c:RegisterEffect(e2)
6+
c:AddMustBeSpecialSummoned()
7+
--Must be Special Summoned (from your hand) by banishing any number of Rock monster(s) from your GY
8+
local e0=Effect.CreateEffect(c)
9+
e0:SetDescription(aux.Stringid(id,0))
10+
e0:SetType(EFFECT_TYPE_FIELD)
11+
e0:SetProperty(EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_UNCOPYABLE)
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)
2318
end
24-
function s.spfilter(c,tp)
25-
return c:IsRace(RACE_ROCK) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true)
26-
and (Duel.GetLocationCount(tp,LOCATION_MZONE)>0 or (c:IsLocation(LOCATION_MZONE) and c:GetSequence()<5))
19+
function s.spconfilter(c,tp)
20+
return c:IsRace(RACE_ROCK) and c:IsAbleToRemoveAsCost() and aux.SpElimFilter(c,true) and Duel.GetMZoneCount(tp,c)>0
2721
end
2822
function s.spcon(e,c)
2923
if c==nil then return true end
3024
local tp=e:GetHandlerPlayer()
31-
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp)
32-
local ft=Duel.GetLocationCount(tp,LOCATION_MZONE)
33-
return ft>-1 and #rg>0 and aux.SelectUnselectGroup(rg,e,tp,1,#rg,nil,0)
25+
local g=Duel.GetMatchingGroup(s.spconfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp)
26+
return #g>0 and aux.SelectUnselectGroup(g,e,tp,1,1,nil,0)
3427
end
35-
function s.sptg(e,tp,eg,ep,ev,re,r,rp,c)
36-
local c=e:GetHandler()
37-
local g=nil
38-
local rg=Duel.GetMatchingGroup(s.spfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp)
28+
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk,c)
29+
local rg=Duel.GetMatchingGroup(s.spconfilter,tp,LOCATION_MZONE|LOCATION_GRAVE,0,nil,tp)
3930
local g=aux.SelectUnselectGroup(rg,e,tp,1,#rg,nil,1,tp,HINTMSG_REMOVE,nil,nil,true)
4031
if #g>0 then
4132
g:KeepAlive()
@@ -49,16 +40,17 @@ function s.spop(e,tp,eg,ep,ev,re,r,rp,c)
4940
if not g then return end
5041
Duel.Remove(g,POS_FACEUP,REASON_COST)
5142
local val=#g*700
43+
g:DeleteGroup()
44+
--The original ATK/DEF of this card become the number of Rock monsters banished to Special Summon it x 700
5245
local e1=Effect.CreateEffect(c)
5346
e1:SetType(EFFECT_TYPE_SINGLE)
5447
e1:SetProperty(EFFECT_FLAG_SINGLE_RANGE)
55-
e1:SetRange(LOCATION_MZONE)
56-
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE-RESET_TOFIELD)
5748
e1:SetCode(EFFECT_SET_BASE_ATTACK)
49+
e1:SetRange(LOCATION_MZONE)
5850
e1:SetValue(val)
51+
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE&~RESET_TOFIELD)
5952
c:RegisterEffect(e1)
6053
local e2=e1:Clone()
6154
e2:SetCode(EFFECT_SET_BASE_DEFENSE)
6255
c:RegisterEffect(e2)
63-
g:DeleteGroup()
64-
end
56+
end

0 commit comments

Comments
 (0)