Skip to content

Commit 632f2e3

Browse files
authored
"Rank-Up-Magic - The Seventh One (Anime)" fix
- The 2 Summons shouldn't be simultaneous. - Added handling for "must be material" effects. - Resolve doing nothing if the target was in the Monster Zone and on resolution it's face-down or the opponent controls it. - Should always be an effect that would Special Summon from the Extra Deck. - General simplifications and polishing.
1 parent 574eebd commit 632f2e3

File tree

1 file changed

+45
-50
lines changed

1 file changed

+45
-50
lines changed

unofficial/c513000008.lua

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,69 @@
1-
--RUM-七皇の剣 (Anime)
1+
--RUM-七皇の剣 (Anime)
22
--Rank-Up-Magic - The Seventh One (Anime)
33
Duel.LoadScript("c420.lua")
44
local s,id=GetID()
55
function s.initial_effect(c)
66
--Activate
77
local e1=Effect.CreateEffect(c)
8+
e1:SetDescription(aux.Stringid(id,0))
89
e1:SetCategory(CATEGORY_SPECIAL_SUMMON)
910
e1:SetType(EFFECT_TYPE_ACTIVATE)
10-
e1:SetCode(EVENT_FREE_CHAIN)
1111
e1:SetProperty(EFFECT_FLAG_CARD_TARGET)
12+
e1:SetCode(EVENT_FREE_CHAIN)
1213
e1:SetTarget(s.target)
1314
e1:SetOperation(s.activate)
1415
c:RegisterEffect(e1)
1516
end
16-
s.listed_series={0x48}
17-
function s.filter1(c,e,tp)
18-
local m = c:GetMetatable(true)
19-
if not m then return false end
20-
local no, rk=tonumber(m.xyz_number), c:GetRank()
21-
if not no or no < 101 or no > 107 or not c:IsSetCard(0x48) or rk <= 0 then return false end
22-
return (c:IsLocation(LOCATION_MZONE) and c:IsFaceup() and c:IsCanBeEffectTarget(e))
23-
or (c:IsLocation(LOCATION_GRAVE|LOCATION_EXTRA) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
24-
and ((c:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE) > 0)
25-
or (c:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,c) > 0)))
26-
end
27-
function s.filter2(c,e,tp,mc,rk)
28-
return c:IsC() and mc:IsCanBeXyzMaterial(c) and c:IsRank(rk)
29-
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false) and Duel.GetLocationCountFromEx(tp,tp,mc,c) > 0
17+
s.listed_series={SET_NUMBER}
18+
function s.tgfilter(c,e,tp,mmzone_chk)
19+
local no=c.xyz_number
20+
if not (no and no>=101 and no<=107 and c:IsSetCard(SET_NUMBER) and c:IsType(TYPE_XYZ)) then return false end
21+
if c:IsLocation(LOCATION_MZONE) then
22+
return c:IsFaceup() and c:IsCanBeEffectTarget(e)
23+
elseif c:IsLocation(LOCATION_GRAVE) then
24+
return mmzone_chk>0 and c:IsCanBeEffectTarget(e) and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
25+
elseif c:IsLocation(LOCATION_EXTRA) then
26+
return Duel.GetLocationCountFromEx(tp,tp,nil,c)>0 and c:IsCanBeSpecialSummoned(e,0,tp,true,false)
27+
end
3028
end
3129
function s.target(e,tp,eg,ep,ev,re,r,rp,chk,chkc)
32-
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA) and s.filter1(chkc,e,tp) end
33-
if chk == 0 then return Duel.IsExistingMatchingCard(s.filter1,tp,LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA,0,1,nil,e,tp) end
30+
local mmzone_chk=Duel.GetLocationCount(tp,LOCATION_MZONE)>0
31+
if chkc then return chkc:IsControler(tp) and chkc:IsLocation(LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA) and s.tgfilter(chkc,e,tp,mmzone_chk) end
32+
if chk==0 then return Duel.IsExistingMatchingCard(s.tgfilter,tp,LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA,0,1,nil,e,tp,mmzone_chk) end
3433
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TARGET)
35-
local tc = Duel.SelectMatchingCard(tp,s.filter1,tp,LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA,0,1,1,nil,e,tp):GetFirst()
34+
local tc=Duel.SelectMatchingCard(tp,s.tgfilter,tp,LOCATION_MZONE|LOCATION_GRAVE|LOCATION_EXTRA,0,1,1,nil,e,tp,mmzone_chk):GetFirst()
3635
Duel.SetTargetCard(tc)
37-
if not tc:IsLocation(LOCATION_MZONE) then
38-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,nil,1,tp,e:GetHandler():GetLocation())
39-
end
36+
local target_not_in_mzone=not tc:IsLocation(LOCATION_MZONE)
37+
local g=target_not_in_mzone and tc or nil
38+
local ct=target_not_in_mzone and 2 or 1
39+
local loc=target_not_in_mzone and tc:GetLocation()|LOCATION_EXTRA or LOCATION_EXTRA
40+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,g,ct,tp,LOCATION_EXTRA)
41+
end
42+
function s.exspfilter(c,e,tp,mc,rk)
43+
return c:IsC() and mc:IsCanBeXyzMaterial(c) and c:IsRank(rk) and c:IsType(TYPE_XYZ) and Duel.GetLocationCountFromEx(tp,tp,mc,c)>0
44+
and c:IsCanBeSpecialSummoned(e,SUMMON_TYPE_XYZ,tp,false,false)
4045
end
4146
function s.activate(e,tp,eg,ep,ev,re,r,rp)
4247
local tc=Duel.GetFirstTarget()
43-
if not tc then return end
44-
if tc and tc:IsRelateToEffect(e) and tc:IsLocation(LOCATION_GRAVE|LOCATION_EXTRA) then
45-
if (tc:IsLocation(LOCATION_GRAVE) and Duel.GetLocationCount(tp,LOCATION_MZONE) > 0 and not tc:IsHasEffect(EFFECT_NECRO_VALLEY))
46-
or (tc:IsLocation(LOCATION_EXTRA) and Duel.GetLocationCountFromEx(tp,tp,nil,tc) > 0)then
47-
if Duel.SpecialSummonStep(tc,0,tp,tp,true,false,POS_FACEUP) then
48-
local e1=Effect.CreateEffect(e:GetHandler())
49-
e1:SetType(EFFECT_TYPE_SINGLE)
50-
e1:SetCode(EFFECT_DISABLE)
51-
e1:SetReset(RESET_EVENT+RESETS_STANDARD)
52-
tc:RegisterEffect(e1)
53-
local e2=Effect.CreateEffect(e:GetHandler())
54-
e2:SetType(EFFECT_TYPE_SINGLE)
55-
e2:SetCode(EFFECT_DISABLE_EFFECT)
56-
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
57-
tc:RegisterEffect(e2)
58-
Duel.SpecialSummonComplete()
59-
end
60-
end
61-
if not Duel.IsPlayerCanSpecialSummonCount(tp,2) then return end
48+
if not tc:IsRelateToEffect(e) then return end
49+
if tc:IsLocation(LOCATION_MZONE) and (tc:IsFacedown() or tc:IsControler(1-tp)) then return end
50+
if tc:IsLocation(LOCATION_GRAVE|LOCATION_EXTRA) and Duel.SpecialSummonStep(tc,0,tp,tp,true,false,POS_FACEUP) then
51+
--Negate its effects
52+
tc:NegateEffects(e:GetHandler())
53+
if Duel.SpecialSummonComplete()==0 then return end
6254
end
63-
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
64-
local sg=Duel.GetMatchingGroup(s.filter2,tp,LOCATION_EXTRA,0,tc,e,tp,tc,tc:GetRank()+1)
65-
if #sg>0 and Duel.SelectYesNo(tp,aux.Stringid(58988903,0)) then
66-
local sc=sg:Select(tp,1,1,nil):GetFirst()
67-
if tc:IsLocation(LOCATION_MZONE) then
68-
Duel.Overlay(sc,tc)
69-
end
55+
local pg=aux.GetMustBeMaterialGroup(tp,Group.FromCards(tc),tp,nil,nil,REASON_XYZ)
56+
if #pg>1 or (#pg==1 and not pg:IsContains(tc)) then return end
57+
local g=Duel.GetMatchingGroup(s.exspfilter,tp,LOCATION_EXTRA,0,nil,e,tp,tc,tc:GetRank()+1)
58+
if #g>0 and Duel.SelectYesNo(tp,aux.Stringid(id,1)) then
59+
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_SPSUMMON)
60+
local sc=g:Select(tp,1,1,nil):GetFirst()
61+
if not sc then return end
62+
Duel.BreakEffect()
7063
sc:SetMaterial(tc)
71-
Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)
72-
sc:CompleteProcedure()
64+
Duel.Overlay(sc,tc)
65+
if Duel.SpecialSummon(sc,SUMMON_TYPE_XYZ,tp,tp,false,false,POS_FACEUP)>0 then
66+
sc:CompleteProcedure()
67+
end
7368
end
7469
end

0 commit comments

Comments
 (0)