Skip to content

Commit 43ca0c4

Browse files
authored
Update "Supreme King Gate Zero (Anime)"
- Effect to prevent Pendulum Summoning should be negatable. - General script polish/modernization update
1 parent 16ddb00 commit 43ca0c4

File tree

1 file changed

+43
-57
lines changed

1 file changed

+43
-57
lines changed

unofficial/c511009443.lua

Lines changed: 43 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,53 @@
1-
--覇王門零
1+
--覇王門零 (Anime)
2+
--Supreme King Gate Zero (Anime)
23
local s,id=GetID()
34
function s.initial_effect(c)
5+
--Pendulum procedure
46
Pendulum.AddProcedure(c)
5-
--splimit
7+
--While you control a monster, you cannot Pendulum Summon
68
local e0=Effect.CreateEffect(c)
79
e0:SetType(EFFECT_TYPE_FIELD)
8-
e0:SetRange(LOCATION_PZONE)
10+
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
911
e0:SetCode(EFFECT_CANNOT_SPECIAL_SUMMON)
10-
e0:SetProperty(EFFECT_FLAG_PLAYER_TARGET+EFFECT_FLAG_CANNOT_DISABLE+EFFECT_FLAG_CANNOT_NEGATE)
12+
e0:SetRange(LOCATION_PZONE)
1113
e0:SetTargetRange(1,0)
12-
e0:SetCondition(s.splimcon)
13-
e0:SetTarget(s.splimit)
14+
e0:SetCondition(function(e) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_MZONE,0)>0 end)
15+
e0:SetTarget(function(e,c,sump,sumtype,sumpos,targetp) return (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM end)
1416
c:RegisterEffect(e0)
15-
--avoid damage
16-
local e1=Effect.CreateEffect(c)
17-
e1:SetType(EFFECT_TYPE_FIELD)
18-
e1:SetCode(EFFECT_CHANGE_DAMAGE)
19-
e1:SetRange(LOCATION_PZONE)
20-
e1:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
21-
e1:SetTargetRange(1,0)
22-
e1:SetLabel(0)
23-
e1:SetCondition(s.damcon)
24-
e1:SetValue(s.damval)
25-
c:RegisterEffect(e1)
26-
--copy
17+
--While you control a "Supreme King" monster, you take no damage
18+
local e1a=Effect.CreateEffect(c)
19+
e1a:SetType(EFFECT_TYPE_FIELD)
20+
e1a:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
21+
e1a:SetCode(EFFECT_CHANGE_DAMAGE)
22+
e1a:SetRange(LOCATION_PZONE)
23+
e1a:SetTargetRange(1,0)
24+
e1a:SetLabel(0)
25+
e1a:SetCondition(function(e) return Duel.IsExistingMatchingCard(aux.FaceupFilter(Card.IsSetCard,0xf8),e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil) end)
26+
e1a:SetValue(s.damval)
27+
c:RegisterEffect(e1a)
28+
--Handling for "Supreme King Gate Infinity (Anime)" for above effect application
29+
local e1b=Effect.CreateEffect(c)
30+
e1b:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
31+
e1b:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
32+
e1b:SetCode(EVENT_ADJUST)
33+
e1b:SetRange(LOCATION_PZONE)
34+
e1b:SetLabelObject(e1a)
35+
e1b:SetOperation(s.trig)
36+
c:RegisterEffect(e1b)
37+
--Add 1 "Supreme King Gate Infinity" from your Deck to your hand
2738
local e2=Effect.CreateEffect(c)
28-
e2:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
29-
e2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
30-
e2:SetCode(EVENT_ADJUST)
31-
e2:SetRange(LOCATION_PZONE)
32-
e2:SetLabelObject(e1)
33-
e2:SetOperation(s.trig)
39+
e2:SetDescription(aux.Stringid(id,2))
40+
e2:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
41+
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
42+
e2:SetProperty(EFFECT_FLAG_DELAY)
43+
e2:SetCode(EVENT_DESTROYED)
44+
e2:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_MZONE) and e:GetHandler():IsFaceup() end)
45+
e2:SetTarget(s.thtg)
46+
e2:SetOperation(s.thop)
3447
c:RegisterEffect(e2)
35-
--tohand
36-
local e3=Effect.CreateEffect(c)
37-
e3:SetDescription(aux.Stringid(id,2))
38-
e3:SetCategory(CATEGORY_TOHAND+CATEGORY_SEARCH)
39-
e3:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
40-
e3:SetCode(EVENT_DESTROYED)
41-
e3:SetProperty(EFFECT_FLAG_DELAY)
42-
e3:SetCondition(s.thcon)
43-
e3:SetTarget(s.thtg)
44-
e3:SetOperation(s.thop)
45-
c:RegisterEffect(e3)
46-
end
47-
s.listed_series={0xf8}
48-
s.listed_names={22211622}
49-
function s.splimcon(e)
50-
return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_MZONE,0)>0
51-
end
52-
function s.splimit(e,c,sump,sumtype,sumpos,targetp)
53-
return (sumtype&SUMMON_TYPE_PENDULUM)==SUMMON_TYPE_PENDULUM
54-
end
55-
function s.cfilter(c)
56-
return c:IsFaceup() and c:IsSetCard(0xf8)
57-
end
58-
function s.damcon(e)
59-
return Duel.IsExistingMatchingCard(s.cfilter,e:GetHandlerPlayer(),LOCATION_MZONE,0,1,nil)
6048
end
49+
s.listed_series={0xf8} --"Supreme King" archetype
50+
s.listed_names={22211622} --"Supreme King Gate Infinity"
6151
function s.damval(e,re,val,r,rp,rc)
6252
local tp=e:GetHandlerPlayer()
6353
if val~=0 then
@@ -72,22 +62,18 @@ function s.trig(e,tp,eg,ep,ev,re,r,rp)
7262
e:GetLabelObject():SetLabel(0)
7363
end
7464
end
75-
function s.thcon(e,tp,eg,ep,ev,re,r,rp)
76-
local c=e:GetHandler()
77-
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsFaceup()
78-
end
79-
function s.filter(c)
65+
function s.thfilter(c)
8066
return c:IsCode(22211622) and c:IsAbleToHand()
8167
end
8268
function s.thtg(e,tp,eg,ep,ev,re,r,rp,chk)
83-
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,LOCATION_DECK,0,1,nil) end
69+
if chk==0 then return Duel.IsExistingMatchingCard(s.thfilter,tp,LOCATION_DECK,0,1,nil) end
8470
Duel.SetOperationInfo(0,CATEGORY_TOHAND,nil,1,tp,LOCATION_DECK)
8571
end
8672
function s.thop(e,tp,eg,ep,ev,re,r,rp)
8773
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_ATOHAND)
88-
local g=Duel.SelectMatchingCard(tp,s.filter,tp,LOCATION_DECK,0,1,1,nil)
74+
local g=Duel.SelectMatchingCard(tp,s.thfilter,tp,LOCATION_DECK,0,1,1,nil)
8975
if #g>0 then
9076
Duel.SendtoHand(g,nil,REASON_EFFECT)
9177
Duel.ConfirmCards(1-tp,g)
9278
end
93-
end
79+
end

0 commit comments

Comments
 (0)