Skip to content

Commit 836d441

Browse files
committed
"Supreme Rage" fix
- prevent script errors due to operations with an undefined group - fixed a bug where it would possible to attach a card from the GY even if "Necrovalley" was applying - added proper verification when looking for valid cards to attach
1 parent dca822a commit 836d441

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

official/c84869738.lua

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22
--Supreme Rage
33
local s,id=GetID()
44
function s.initial_effect(c)
5-
--Activate
5+
--Destroy as many monsters you control as possible, and if you do, Special Summon up to 4 "Supreme King Dragon" monsters
66
local e1=Effect.CreateEffect(c)
7+
e1:SetDescription(aux.Stringid(id,0))
78
e1:SetCategory(CATEGORY_DESTROY+CATEGORY_SPECIAL_SUMMON)
89
e1:SetType(EFFECT_TYPE_ACTIVATE)
910
e1:SetCode(EVENT_FREE_CHAIN)
1011
e1:SetCondition(s.condition)
1112
e1:SetTarget(s.target)
1213
e1:SetOperation(s.activate)
1314
c:RegisterEffect(e1)
14-
--Attach Xyz Materials
15+
--Attach 2 "Supreme King Dragon" monsters to 1 "Supreme King Dragon" Xyz Monster you control
1516
local e2=Effect.CreateEffect(c)
17+
e2:SetDescription(aux.Stringid(id,1))
1618
e2:SetType(EFFECT_TYPE_QUICK_O)
1719
e2:SetCode(EVENT_FREE_CHAIN)
1820
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
@@ -29,8 +31,8 @@ function s.condition(e,tp,eg,ep,ev,re,r,rp)
2931
end
3032
function s.spfilter(c,e,tp)
3133
if not (c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)) then return false end
34+
local g=Duel.GetMatchingGroup(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,nil)
3235
if c:IsLocation(LOCATION_EXTRA) then
33-
local g=Duel.GetMatchingGroup(aux.NOT(aux.FaceupFilter(Card.IsCode,CARD_ZARC)),tp,LOCATION_MZONE,0,nil)
3436
return Duel.GetLocationCountFromEx(tp,tp,g,c)>0
3537
else
3638
return Duel.GetMZoneCount(tp,g)>0
@@ -44,7 +46,7 @@ function s.target(e,tp,eg,ep,ev,re,r,rp,chk)
4446
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,LOCATION_HAND|LOCATION_DECK|LOCATION_GRAVE|LOCATION_EXTRA)
4547
end
4648
function s.exfilter1(c)
47-
return c:IsLocation(LOCATION_EXTRA) and c:IsFacedown() and c:IsType(TYPE_FUSION+TYPE_SYNCHRO+TYPE_XYZ)
49+
return c:IsLocation(LOCATION_EXTRA) and c:IsFacedown() and c:IsType(TYPE_FUSION|TYPE_SYNCHRO|TYPE_XYZ)
4850
end
4951
function s.exfilter2(c)
5052
return c:IsLocation(LOCATION_EXTRA) and (c:IsType(TYPE_LINK) or (c:IsFaceup() and c:IsType(TYPE_PENDULUM)))
@@ -92,24 +94,25 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
9294
local rg=aux.SelectUnselectGroup(sg,e,tp,1,ft,s.rescon(ft1,ft2,ft3,ft4,ft),1,tp,HINTMSG_SPSUMMON)
9395
Duel.SpecialSummon(rg,0,tp,tp,true,false,POS_FACEUP)
9496
end
95-
function s.xyzfilter(c)
96-
return c:IsFaceup() and c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsType(TYPE_XYZ)
97+
function s.xyzfilter(c,tp)
98+
return c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsType(TYPE_XYZ) and c:IsFaceup()
99+
and Duel.IsExistingMatchingCard(s.matfilter,tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,nil,tp,c)
97100
end
98-
function s.matfilter(c)
99-
return c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsMonster() and (c:IsFaceup() or not c:IsLocation(LOCATION_EXTRA))
101+
function s.matfilter(c,tp,xyzc)
102+
return c:IsSetCard(SET_SUPREME_KING_DRAGON) and c:IsMonster()
103+
and c:IsFaceup() and c:IsCanBeXyzMaterial(xyzc,tp,REASON_EFFECT)
100104
end
101105
function s.mattg(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
102-
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc) end
103-
if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil)
104-
and Duel.IsExistingMatchingCard(s.matfilter,tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,nil) end
105-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
106-
Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil)
106+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE) and s.xyzfilter(chkc,tp) end
107+
if chk==0 then return Duel.IsExistingTarget(s.xyzfilter,tp,LOCATION_MZONE,0,1,nil,tp) end
108+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
109+
Duel.SelectTarget(tp,s.xyzfilter,tp,LOCATION_MZONE,0,1,1,nil,tp)
107110
end
108111
function s.matop(e,tp,eg,ep,ev,re,r,rp)
109112
local tc=Duel.GetFirstTarget()
110-
if tc and tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
113+
if tc:IsRelateToEffect(e) and not tc:IsImmuneToEffect(e) then
111114
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_FACEUP)
112-
local g=Duel.SelectMatchingCard(tp,s.matfilter,tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,2,nil)
115+
local g=Duel.SelectMatchingCard(tp,aux.NecroValleyFilter(s.matfilter),tp,LOCATION_GRAVE|LOCATION_EXTRA,0,2,2,nil,tp,tc)
113116
if #g>0 then
114117
Duel.Overlay(tc,g)
115118
end

0 commit comments

Comments
 (0)