Skip to content

Commit 8ab890a

Browse files
authored
Update "Number 92: Heart-eartH Dragon"
- Cleaned up descriptions - Removed extra function normally reserved for "Number" battle protection - Script modernization updates - Made ATK gain an inherent effect that depends on it being Summoned by its own effect
1 parent a3e9304 commit 8ab890a

File tree

1 file changed

+113
-135
lines changed

1 file changed

+113
-135
lines changed

unofficial/c511000368.lua

Lines changed: 113 additions & 135 deletions
Original file line numberDiff line numberDiff line change
@@ -3,173 +3,151 @@
33
Duel.LoadCardScript("c97403510.lua")
44
local s,id=GetID()
55
function s.initial_effect(c)
6-
--xyz summon
7-
Xyz.AddProcedure(c,nil,9,3)
86
c:EnableReviveLimit()
7+
--Xyz Summon procedure: 3 Level 9 monsters
8+
Xyz.AddProcedure(c,nil,9,3)
9+
--Cannot be destroyed by battle
10+
local e1=Effect.CreateEffect(c)
11+
e1:SetType(EFFECT_TYPE_SINGLE)
12+
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
13+
e1:SetValue(1)
14+
c:RegisterEffect(e1)
15+
--Change all monsters your opponent controls to Defense Position
916
local e2=Effect.CreateEffect(c)
10-
e2:SetType(EFFECT_TYPE_SINGLE)
11-
e2:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
12-
e2:SetValue(1)
17+
e2:SetDescription(aux.Stringid(id,0))
18+
e2:SetCategory(CATEGORY_POSITION)
19+
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
20+
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
21+
e2:SetTarget(s.postg)
22+
e2:SetOperation(s.posop)
1323
c:RegisterEffect(e2)
14-
--remove
24+
--Banish all cards placed on your opponent's field
1525
local e3=Effect.CreateEffect(c)
16-
e3:SetDescription(aux.Stringid(id,0))
26+
e3:SetDescription(aux.Stringid(id,1))
1727
e3:SetCategory(CATEGORY_REMOVE)
18-
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_O)
28+
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
1929
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
2030
e3:SetRange(LOCATION_MZONE)
2131
e3:SetCountLimit(1)
22-
e3:SetCondition(s.rmcon)
23-
e3:SetCost(s.rmcost)
32+
e3:SetCondition(function(e,tp) return Duel.GetTurnPlayer()~=tp end)
2433
e3:SetTarget(s.rmtg)
2534
e3:SetOperation(s.rmop)
26-
c:RegisterEffect(e3,false,REGISTER_FLAG_DETACH_XMAT)
27-
--spsummon
28-
local e4=Effect.CreateEffect(c)
29-
e4:SetDescription(aux.Stringid(id,1))
30-
e4:SetCategory(CATEGORY_SPECIAL_SUMMON)
31-
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
32-
e4:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
33-
e4:SetCode(EVENT_TO_GRAVE)
34-
e4:SetCost(s.spcost)
35-
e4:SetCondition(s.spcon)
36-
e4:SetTarget(s.sptg)
37-
e4:SetOperation(s.spop)
38-
c:RegisterEffect(e4)
39-
--atkup
40-
local e5=Effect.CreateEffect(c)
41-
e5:SetDescription(aux.Stringid(id,2))
42-
e5:SetCategory(CATEGORY_ATKCHANGE)
43-
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
44-
e5:SetCode(EVENT_SPSUMMON_SUCCESS)
45-
e5:SetCondition(s.atkcon)
46-
e5:SetOperation(s.atkop)
47-
c:RegisterEffect(e5)
48-
--pos
35+
c:RegisterEffect(e3)
36+
--Battle damage from battles involving this card becomes 0
37+
local e4=Effect.CreateEffect(c)
38+
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
39+
e4:SetCode(EVENT_PRE_BATTLE_DAMAGE)
40+
e4:SetRange(LOCATION_MZONE)
41+
e4:SetOperation(s.battledamageop)
42+
c:RegisterEffect(e4)
43+
--Inflict damage to your opponent equal to the battle damage you would have taken, then gain LP equal to that amount
44+
local e5=Effect.CreateEffect(c)
45+
e5:SetDescription(aux.Stringid(id,2))
46+
e5:SetCategory(CATEGORY_DAMAGE+CATEGORY_RECOVER)
47+
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
48+
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
49+
e5:SetCode(EVENT_BATTLED)
50+
e5:SetRange(LOCATION_MZONE)
51+
e5:SetLabelObject(e4)
52+
e5:SetTarget(s.damrectg)
53+
e5:SetOperation(s.damrecop)
54+
c:RegisterEffect(e5)
55+
--Special Summon this card from the GY
4956
local e6=Effect.CreateEffect(c)
5057
e6:SetDescription(aux.Stringid(id,3))
51-
e6:SetCategory(CATEGORY_POSITION)
52-
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
53-
e6:SetCode(EVENT_SPSUMMON_SUCCESS)
54-
e6:SetTarget(s.postg)
55-
e6:SetOperation(s.posop)
58+
e6:SetCategory(CATEGORY_SPECIAL_SUMMON)
59+
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
60+
e6:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
61+
e6:SetCode(EVENT_TO_GRAVE)
62+
e6:SetCost(s.spcost)
63+
e6:SetCondition(s.spcon)
64+
e6:SetTarget(s.sptg)
65+
e6:SetOperation(s.spop)
5666
c:RegisterEffect(e6)
57-
--Activate
58-
local e8=Effect.CreateEffect(c)
59-
e8:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
60-
e8:SetCode(EVENT_PRE_BATTLE_DAMAGE)
61-
e8:SetOperation(s.dam)
62-
e8:SetRange(LOCATION_MZONE)
63-
c:RegisterEffect(e8)
64-
--recover
67+
--Gains 1000 ATK for each banished card if it's Special Summoned by its own effect
6568
local e7=Effect.CreateEffect(c)
6669
e7:SetDescription(aux.Stringid(id,4))
67-
e7:SetCategory(CATEGORY_RECOVER)
68-
e7:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
69-
e7:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
70+
e7:SetCategory(CATEGORY_ATKCHANGE)
71+
e7:SetType(EFFECT_TYPE_SINGLE)
7072
e7:SetRange(LOCATION_MZONE)
71-
e7:SetCode(EVENT_BATTLED)
72-
e7:SetLabelObject(e8)
73-
e7:SetTarget(s.rectg)
74-
e7:SetOperation(s.recop)
73+
e7:SetCode(EFFECT_UPDATE_ATTACK)
74+
e7:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL+1) end)
75+
e7:SetValue(function(e,c) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_REMOVED,LOCATION_REMOVED)*1000)
7576
c:RegisterEffect(e7)
76-
--number generic effect
77-
local e9=Effect.CreateEffect(c)
78-
e9:SetType(EFFECT_TYPE_SINGLE)
79-
e9:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
80-
e9:SetValue(s.indes)
81-
c:RegisterEffect(e9)
8277
end
8378
s.xyz_number=92
84-
function s.rmcon(e,tp,eg,ep,ev,re,r,rp)
85-
return Duel.GetTurnPlayer()~=tp
86-
end
87-
function s.rmcost(e,tp,eg,ep,ev,re,r,rp,chk)
88-
if chk==0 then return e:GetHandler():CheckRemoveOverlayCard(tp,1,REASON_COST) end
89-
e:GetHandler():RemoveOverlayCard(tp,1,1,REASON_COST)
79+
function s.postg(e,tp,eg,ep,ev,re,r,rp,chk)
80+
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil) end
81+
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
82+
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0)
9083
end
91-
function s.filter(c)
92-
return c:IsAbleToRemove()
84+
function s.posop(e,tp,eg,ep,ev,re,r,rp)
85+
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
86+
if Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,0,0,true)>0 then
87+
local og=Duel.GetOperatedGroup()
88+
for tc in og:Iter() do
89+
--Cannot change their battle positions
90+
local e1=Effect.CreateEffect(e:GetHandler())
91+
e1:SetDescription(3313)
92+
e1:SetType(EFFECT_TYPE_SINGLE)
93+
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
94+
e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
95+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
96+
tc:RegisterEffect(e1)
97+
end
98+
end
99+
end
100+
function s.rmfilter(c,turn)
101+
return c:IsAbleToRemove() and c:GetTurnID()~=turn
93102
end
94103
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
95-
if chk==0 then return Duel.IsExistingMatchingCard(s.filter,tp,0,LOCATION_ONFIELD,1,nil) end
96-
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil,Duel.GetTurnCount())
97-
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
104+
if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,0,LOCATION_ONFIELD,1,nil,Duel.GetTurnCount()) end
105+
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD,nil,Duel.GetTurnCount())
106+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
98107
end
99108
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
100-
local g=Duel.GetMatchingGroup(s.filter,tp,0,LOCATION_ONFIELD,nil)
101-
if #g>0 then
102-
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
109+
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD,nil,Duel.GetTurnCount())
110+
if #g>0 then
111+
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
112+
end
113+
end
114+
function s.battledamageop(e,tp,eg,ep,ev,re,r,rp)
115+
Duel.ChangeBattleDamage(ep,0)
116+
e:SetLabel(ev)
117+
end
118+
function s.damrectg(e,tp,eg,ep,ev,re,r,rp,chk)
119+
local dam=e:GetLabelObject():GetLabel()
120+
if chk==0 then return dam>0 end
121+
Duel.SetTargetPlayer(1-tp)
122+
Duel.SetTargetParam(dam)
123+
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
124+
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,dam)
125+
end
126+
function s.damrecop(e,tp,eg,ep,ev,re,r,rp)
127+
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
128+
if Duel.Damage(p,d,REASON_EFFECT) then
129+
Duel.Recover(tp,d,REASON_EFFECT)
103130
end
131+
e:GetLabelObject():SetLabel(0)
104132
end
105133
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
106-
local c=e:GetHandler()
107-
if chk==0 then return c:GetFlagEffect(id)==0 end
134+
local c=e:GetHandler()
135+
if chk==0 then return c:GetFlagEffect(id)==0 end
108136
c:RegisterFlagEffect(id,0,0,1)
109137
end
110138
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
111-
return e:GetHandler():IsReason(REASON_DESTROY) and e:GetHandler():GetOverlayCount()==0
139+
local c=e:GetHandler()
140+
return c:IsReason(REASON_DESTROY) and e:GetHandler():GetOverlayCount()==0
112141
end
113142
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
114-
if chk==0 then return e:GetHandler():IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
115-
and e:GetHandler():IsCanBeSpecialSummoned(e,0,tp,false,false) end
116-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
143+
local c=e:GetHandler()
144+
if chk==0 then return c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
145+
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
146+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
117147
end
118148
function s.spop(e,tp,eg,ep,ev,re,r,rp)
119-
local c=e:GetHandler()
120-
if c:IsRelateToEffect(e) then
121-
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
122-
end
123-
end
124-
function s.atkcon(e,tp,eg,ep,ev,re,r,rp)
125-
return e:GetHandler():GetSummonType()==SUMMON_TYPE_SPECIAL+1
126-
end
127-
function s.atkop(e,tp,eg,ep,ev,re,r,rp)
128-
local c=e:GetHandler()
129-
local atk=Duel.GetFieldGroupCount(tp,LOCATION_REMOVED,LOCATION_REMOVED)*1000
130-
if atk>0 and c:IsFaceup() and c:IsRelateToEffect(e) then
131-
local e1=Effect.CreateEffect(c)
132-
e1:SetType(EFFECT_TYPE_SINGLE)
133-
e1:SetCode(EFFECT_UPDATE_ATTACK)
134-
e1:SetValue(atk)
135-
e1:SetReset(RESET_EVENT+RESETS_STANDARD_DISABLE)
136-
c:RegisterEffect(e1)
137-
end
138-
end
139-
function s.postg(e,tp,eg,ep,ev,re,r,rp,chk)
140-
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil) end
141-
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
142-
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0)
143-
end
144-
function s.posop(e,tp,eg,ep,ev,re,r,rp)
145-
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
146-
Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,0,0,true)
147-
local tc=g:GetFirst()
148-
while tc do
149-
local e2=Effect.CreateEffect(e:GetHandler())
150-
e2:SetType(EFFECT_TYPE_SINGLE)
151-
e2:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
152-
e2:SetReset(RESET_EVENT+RESETS_STANDARD)
153-
tc:RegisterEffect(e2)
154-
tc=g:GetNext()
155-
end
156-
end
157-
function s.dam(e,tp,eg,ep,ev,re,r,rp)
158-
Duel.ChangeBattleDamage(ep,0)
159-
e:SetLabel(ev)
160-
end
161-
function s.rectg(e,tp,eg,ep,ev,re,r,rp,chk)
162-
if chk==0 then return true end
163-
Duel.SetTargetPlayer(1-tp)
164-
Duel.SetTargetParam(e:GetLabelObject():GetLabel())
165-
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,e:GetLabelObject():GetLabel())
166-
end
167-
function s.recop(e,tp,eg,ep,ev,re,r,rp)
168-
if Duel.Damage(1-tp,e:GetLabelObject():GetLabel(),REASON_EFFECT) then
169-
Duel.Recover(tp,e:GetLabelObject():GetLabel(),REASON_EFFECT)
170-
end
171-
e:GetLabelObject():SetLabel(0)
172-
end
173-
function s.indes(e,c)
174-
return not c:IsSetCard(0x48)
149+
local c=e:GetHandler()
150+
if c:IsRelateToEffect(e) then
151+
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
152+
end
175153
end

0 commit comments

Comments
 (0)