Skip to content

Commit 318b03e

Browse files
authored
Update "Odd-Eyes Rebellion Dragon (Anime)"
- Leave field check for placing itself into Pendulum Zones did not account for use as material and other scenarios - Script modernization/notation updates - Cleaned up checks for the multi-attack effect/monster destruction register
1 parent c998c19 commit 318b03e

1 file changed

Lines changed: 60 additions & 84 deletions

File tree

unofficial/c511001791.lua

Lines changed: 60 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,59 @@
1-
--覇王黒竜オッドアイズ・リベリオン・ドラゴン
1+
--覇王黒竜オッドアイズ・リベリオン・ドラゴン (Anime)
2+
--Odd-Eyes Rebellion Dragon (Anime)
23
local s,id=GetID()
34
function s.initial_effect(c)
4-
--xyz summon
5-
Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),7,2)
65
c:EnableReviveLimit()
7-
--pendulum summon
6+
--Xyz Summon procedure: 2 Level 7 Dragon monsters
7+
Xyz.AddProcedure(c,aux.FilterBoolFunctionEx(Card.IsRace,RACE_DRAGON),7,2)
8+
--Pendulum procedure
89
Pendulum.AddProcedure(c,false)
9-
--pendulum set
10+
--Place 1 Pendulum monster from your Deck in your other Pendulum Zone
1011
local e1=Effect.CreateEffect(c)
12+
e1:SetDescription(aux.Stringid(id,0))
1113
e1:SetType(EFFECT_TYPE_IGNITION)
1214
e1:SetRange(LOCATION_PZONE)
1315
e1:SetCountLimit(1)
14-
e1:SetTarget(s.pctg)
15-
e1:SetOperation(s.pcop)
16+
e1:SetTarget(s.pltg)
17+
e1:SetOperation(s.plop)
1618
c:RegisterEffect(e1)
17-
--destroy
19+
--Destroy Level 7 or lower monsters your opponent controls to inflict damage
1820
local e2=Effect.CreateEffect(c)
1921
e2:SetCategory(CATEGORY_DESTROY+CATEGORY_DAMAGE)
2022
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
2123
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
22-
e2:SetCondition(s.descon)
23-
e2:SetTarget(s.destg)
24-
e2:SetOperation(s.desop)
24+
e2:SetCondition(function(e) return e:GetHandler():IsXyzSummoned() and e:GetLabel()==1 end)
25+
e2:SetTarget(s.xyzsumdestg)
26+
e2:SetOperation(s.xyzsumdesop)
2527
c:RegisterEffect(e2)
28+
--Check if an Xyz Monster that was treated as a Level 7 monster was used as material
2629
local e3=Effect.CreateEffect(c)
2730
e3:SetType(EFFECT_TYPE_SINGLE)
2831
e3:SetCode(EFFECT_MATERIAL_CHECK)
2932
e3:SetValue(s.valcheck)
3033
e3:SetLabelObject(e2)
3134
c:RegisterEffect(e3)
32-
--multi atk
35+
--This card can attack a number of times each Battle Phase this turn, up to the current number of monsters destroyed in your opponent's possession
3336
local e4=Effect.CreateEffect(c)
3437
e4:SetDescription(aux.Stringid(id,0))
3538
e4:SetType(EFFECT_TYPE_IGNITION)
3639
e4:SetRange(LOCATION_MZONE)
3740
e4:SetCountLimit(1)
38-
e4:SetCondition(s.atkcon)
39-
e4:SetCost(s.atkcost)
41+
e4:SetCondition(function(e) return Duel.IsAbleToEnterBP() and s[1-e:GetHandlerPlayer()]>0 end)
42+
e4:SetCost(Cost.Detach(1))
4043
e4:SetTarget(s.atktg)
4144
e4:SetOperation(s.atkop)
42-
c:RegisterEffect(e4,false,EFFECT_MARKER_DETACH_XMAT)
43-
--To Pendulum
45+
c:RegisterEffect(e4)
46+
--Destroy all other cards in your Pendulum Zones, then place this card in your Pendulum Zone
4447
local e5=Effect.CreateEffect(c)
45-
e5:SetDescription(aux.Stringid(35952884,1))
46-
e5:SetType(EFFECT_TYPE_TRIGGER_O+EFFECT_TYPE_SINGLE)
47-
e5:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
48-
e5:SetCode(EVENT_TO_GRAVE)
49-
e5:SetCondition(s.pencon)
48+
e5:SetDescription(aux.Stringid(id,1))
49+
e5:SetCategory(CATEGORY_DESTROY)
50+
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
51+
e5:SetProperty(EFFECT_FLAG_DELAY)
52+
e5:SetCode(EVENT_LEAVE_FIELD)
53+
e5:SetCondition(function(e) return e:GetHandler():IsPreviousLocation(LOCATION_ONFIELD) end)
5054
e5:SetTarget(s.pentg)
5155
e5:SetOperation(s.penop)
5256
c:RegisterEffect(e5)
53-
local e6=e5:Clone()
54-
e6:SetCode(EVENT_REMOVE)
55-
c:RegisterEffect(e6)
56-
local e7=e5:Clone()
57-
e7:SetCode(EVENT_TO_DECK)
58-
c:RegisterEffect(e7)
5957
aux.GlobalCheck(s,function()
6058
s[0]=0
6159
s[1]=0
@@ -65,45 +63,48 @@ function s.initial_effect(c)
6563
ge1:SetProperty(EFFECT_FLAG_DAMAGE_STEP)
6664
ge1:SetOperation(s.checkop)
6765
Duel.RegisterEffect(ge1,0)
68-
local ge2=Effect.CreateEffect(c)
69-
ge2:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
70-
ge2:SetCode(EVENT_ADJUST)
71-
ge2:SetCountLimit(1)
72-
ge2:SetOperation(s.clear)
73-
Duel.RegisterEffect(ge2,0)
66+
aux.AddValuesReset(function()
67+
s[0]=0
68+
s[1]=0
69+
end)
7470
end)
7571
end
76-
function s.pcfilter(c)
77-
return c:IsType(TYPE_PENDULUM) and not c:IsForbidden()
72+
function s.chkfilter(c,tp,tid)
73+
return c:IsPreviousLocation(LOCATION_MZONE) and c:IsPreviousControler(tp) and c:GetTurnID()==tid
7874
end
79-
function s.pctg(e,tp,eg,ep,ev,re,r,rp,chk)
80-
if chk==0 then return Duel.CheckPendulumZones(tp)
81-
and Duel.IsExistingMatchingCard(s.pcfilter,tp,LOCATION_DECK,0,1,nil) end
75+
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
76+
local tid=Duel.GetTurnCount()
77+
local g=eg:Filter(s.chkfilter,nil,1-tp,tid)
78+
if #g>0 then
79+
s[1-tp]=s[1-tp]+#g
80+
end
8281
end
83-
function s.pcop(e,tp,eg,ep,ev,re,r,rp)
84-
if not e:GetHandler():IsRelateToEffect(e) then return end
85-
if not Duel.CheckPendulumZones(tp) then return end
82+
function s.plfilter(c)
83+
return c:IsType(TYPE_PENDULUM) and not c:IsForbidden()
84+
end
85+
function s.pltg(e,tp,eg,ep,ev,re,r,rp,chk)
86+
if chk==0 then return Duel.CheckPendulumZones(tp) and Duel.IsExistingMatchingCard(s.plfilter,tp,LOCATION_DECK,0,1,nil) end
87+
end
88+
function s.plop(e,tp,eg,ep,ev,re,r,rp)
89+
if not (e:GetHandler():IsRelateToEffect(e) or Duel.CheckPendulumZones(tp)) then return end
8690
Duel.Hint(HINT_SELECTMSG,tp,HINTMSG_TOFIELD)
87-
local g=Duel.SelectMatchingCard(tp,s.pcfilter,tp,LOCATION_DECK,0,1,1,nil)
91+
local g=Duel.SelectMatchingCard(tp,s.plfilter,tp,LOCATION_DECK,0,1,1,nil)
8892
if #g>0 then
8993
Duel.MoveToField(g:GetFirst(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
9094
end
9195
end
92-
function s.descon(e,tp,eg,ep,ev,re,r,rp)
93-
return e:GetHandler():GetSummonType()==SUMMON_TYPE_XYZ and e:GetLabel()==1
96+
function s.xyzsumdesfilter(c)
97+
return c:IsFaceup() and c:IsLevelBelow(7)
9498
end
95-
function s.desfilter(c)
96-
return c:IsFaceup() and c:IsLevelBelow(7) and c:IsDestructable()
97-
end
98-
function s.destg(e,tp,eg,ep,ev,re,r,rp,chk)
99+
function s.xyzsumdestg(e,tp,eg,ep,ev,re,r,rp,chk)
99100
if chk==0 then return true end
100-
local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil)
101-
local sum=g:GetSum(Card.GetAttack)
101+
local g=Duel.GetMatchingGroup(s.xyzsumdesfilter,tp,0,LOCATION_MZONE,nil)
102+
local atk=g:GetSum(Card.GetAttack)
102103
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
103-
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,sum)
104+
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,atk)
104105
end
105-
function s.desop(e,tp,eg,ep,ev,re,r,rp)
106-
local g=Duel.GetMatchingGroup(s.desfilter,tp,0,LOCATION_MZONE,nil)
106+
function s.xyzsumdesop(e,tp,eg,ep,ev,re,r,rp)
107+
local g=Duel.GetMatchingGroup(s.xyzsumdesfilter,tp,0,LOCATION_MZONE,nil)
107108
if Duel.Destroy(g,REASON_EFFECT)>0 then
108109
local dg=Duel.GetOperatedGroup()
109110
local sum=dg:GetSum(Card.GetPreviousAttackOnField)
@@ -121,13 +122,6 @@ function s.valcheck(e,c)
121122
e:GetLabelObject():SetLabel(0)
122123
end
123124
end
124-
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
125-
return Duel.GetCurrentPhase()==PHASE_MAIN1 and s[tp]>0
126-
end
127-
function s.atkcost(e,tp,eg,ep,ev,re,r,rp,chk)
128-
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
129-
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
130-
end
131125
function s.atktg(e,tp,eg,ep,ev,re,r,rp,chk)
132126
if chk==0 then return e:GetHandler():GetEffectCount(EFFECT_EXTRA_ATTACK)==0 end
133127
end
@@ -138,39 +132,21 @@ function s.atkop(e,tp,eg,ep,ev,re,r,rp)
138132
e1:SetType(EFFECT_TYPE_SINGLE)
139133
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
140134
e1:SetCode(EFFECT_EXTRA_ATTACK)
141-
e1:SetValue(s[tp]-1)
142-
e1:SetReset(RESET_EVENT+RESETS_STANDARD+RESET_PHASE+PHASE_END)
135+
e1:SetValue(s[1-tp]-1)
136+
e1:SetReset(RESETS_STANDARD_PHASE_END)
143137
c:RegisterEffect(e1)
144138
end
145139
end
146-
function s.pencon(e,tp,eg,ep,ev,re,r,rp)
147-
return e:GetHandler():IsPreviousPosition(POS_FACEUP) and e:GetHandler():IsPreviousLocation(LOCATION_MZONE)
148-
end
149140
function s.pentg(e,tp,eg,ep,ev,re,r,rp,chk)
150141
local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,0)
151142
if chk==0 then return #g>0 end
152143
Duel.SetOperationInfo(0,CATEGORY_DESTROY,g,#g,0,0)
153144
end
154145
function s.penop(e,tp,eg,ep,ev,re,r,rp)
146+
local c=e:GetHandler()
147+
if not c:IsRelateToEffect(e) then return end
155148
local g=Duel.GetFieldGroup(tp,LOCATION_PZONE,0)
156-
if Duel.Destroy(g,REASON_EFFECT)~=0 and e:GetHandler():IsRelateToEffect(e) then
157-
Duel.MoveToField(e:GetHandler(),tp,tp,LOCATION_PZONE,POS_FACEUP,true)
158-
end
159-
end
160-
function s.desfilter2(c,tp)
161-
return c:IsPreviousControler(tp) and (c:GetPreviousTypeOnField()&TYPE_MONSTER)==TYPE_MONSTER
162-
end
163-
function s.checkop(e,tp,eg,ep,ev,re,r,rp)
164-
local ct1=eg:FilterCount(s.desfilter2,nil,1-tp)
165-
local ct2=eg:FilterCount(s.desfilter2,nil,tp)
166-
if ct1>0 then
167-
s[tp]=s[tp]+ct1
168-
end
169-
if ct2>0 then
170-
s[1-tp]=s[1-tp]+ct2
149+
if Duel.Destroy(g,REASON_EFFECT)>0 and Duel.CheckPendulumZones(tp) then
150+
Duel.MoveToField(c,tp,tp,LOCATION_PZONE,POS_FACEUP,true)
171151
end
172152
end
173-
function s.clear(e,tp,eg,ep,ev,re,r,rp)
174-
s[0]=0
175-
s[1]=0
176-
end

0 commit comments

Comments
 (0)