Skip to content

Commit c0a2849

Browse files
authored
"Number 92: Heart-eartH Dragon (Anime)" fixes
- The position change effect should trigger even if the opponent has no Attack Position monsters since it's mandatory. - The position change effect targets. - The damage changing, inflicting, and LP gaining, is all one effect. - The banishing effect should trigger even if there aren't any cards to banish since it's mandatory. - Should banish any cards placed on the opponent's field even if the opponent doesn't control them anymore during the next turn's Standby Phase. - The banishing effect should only trigger once during the Standby Phase of the next turn after this card is Special Summoned, not during every Standby Phase. - Start keeping track only after this card is Special Summoned. - Have the card forget what was already tracked if it's flipped face-down. - The Special Summoning effect is a "When" effect. - Its ATK should become the set value, it shouldn't gain ATK. - The ATK change is part of the Special Summoning effect. - Allow the Special Summoning effect to be used again if this card stops being in the Monster Zone or GY (e.g. if it's banished, returned to the Extra Deck, etc). - Register a hint on the card to indicate that the Special Summoning effect has already been used. - Fixed indentation throughout the whole script.
1 parent faab733 commit c0a2849

File tree

1 file changed

+119
-121
lines changed

1 file changed

+119
-121
lines changed

unofficial/c511000368.lua

Lines changed: 119 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -12,164 +12,162 @@ function s.initial_effect(c)
1212
e1:SetCode(EFFECT_INDESTRUCTABLE_BATTLE)
1313
e1:SetValue(1)
1414
c:RegisterEffect(e1)
15-
--Change all monsters your opponent controls to Defense Position
15+
--Change all Attack Position monsters your opponent controls to Defense Position
1616
local e2=Effect.CreateEffect(c)
1717
e2:SetDescription(aux.Stringid(id,0))
1818
e2:SetCategory(CATEGORY_POSITION)
1919
e2:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
20+
e2:SetProperty(EFFECT_FLAG_CARD_TARGET)
2021
e2:SetCode(EVENT_SPSUMMON_SUCCESS)
2122
e2:SetTarget(s.postg)
2223
e2:SetOperation(s.posop)
2324
c:RegisterEffect(e2)
24-
--Banish all cards placed on your opponent's field
25+
--Negate any battle damage you would have taken from a battle involving this card, and if you do, inflict damage to your opponent equal to that amount, and if you do that, you gain LP equal to the amount of damage inflicted
2526
local e3=Effect.CreateEffect(c)
26-
e3:SetDescription(aux.Stringid(id,1))
27-
e3:SetCategory(CATEGORY_REMOVE)
28-
e3:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
29-
e3:SetCode(EVENT_PHASE+PHASE_STANDBY)
27+
e3:SetType(EFFECT_TYPE_FIELD)
28+
e3:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
29+
e3:SetCode(EFFECT_CHANGE_DAMAGE)
3030
e3:SetRange(LOCATION_MZONE)
31-
e3:SetCountLimit(1)
32-
e3:SetTarget(s.rmtg)
33-
e3:SetOperation(s.rmop)
31+
e3:SetTargetRange(1,0)
32+
e3:SetValue(s.damval)
3433
c:RegisterEffect(e3)
35-
--Register cards placed on your opponent's the field
36-
aux.GlobalCheck(s,function()
37-
local ge1=Effect.CreateEffect(c)
38-
ge1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
39-
ge1:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_CANNOT_DISABLE)
40-
ge1:SetCode(EVENT_MOVE)
41-
ge1:SetRange(LOCATION_MZONE)
42-
ge1:SetCondition(s.chkcon)
43-
ge1:SetOperation(s.chkop)
44-
Duel.RegisterEffect(ge1,0)
45-
end)
46-
--Battle damage from battles involving this card becomes 0
47-
local e4=Effect.CreateEffect(c)
48-
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
49-
e4:SetCode(EVENT_PRE_BATTLE_DAMAGE)
50-
e4:SetRange(LOCATION_MZONE)
51-
e4:SetOperation(s.battledamageop)
52-
c:RegisterEffect(e4)
53-
--Inflict damage to your opponent equal to the battle damage you would have taken, then gain LP equal to that amount
54-
local e5=Effect.CreateEffect(c)
55-
e5:SetDescription(aux.Stringid(id,2))
56-
e5:SetCategory(CATEGORY_DAMAGE+CATEGORY_RECOVER)
57-
e5:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_F)
58-
e5:SetProperty(EFFECT_FLAG_PLAYER_TARGET)
59-
e5:SetCode(EVENT_BATTLED)
60-
e5:SetRange(LOCATION_MZONE)
61-
e5:SetLabelObject(e4)
62-
e5:SetTarget(s.damrectg)
63-
e5:SetOperation(s.damrecop)
64-
c:RegisterEffect(e5)
65-
--Special Summon this card from the GY
34+
--Register the tracking effect upon successful Special Summon
35+
local e4=Effect.CreateEffect(c)
36+
e4:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_CONTINUOUS)
37+
e4:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
38+
e4:SetCode(EVENT_SPSUMMON_SUCCESS)
39+
e4:SetOperation(s.regop)
40+
c:RegisterEffect(e4)
41+
--Banish all cards placed on your opponent's field during the Standby Phase of the next turn after this card was Special Summoned
42+
local e5=Effect.CreateEffect(c)
43+
e5:SetDescription(aux.Stringid(id,1))
44+
e5:SetCategory(CATEGORY_REMOVE)
45+
e5:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_TRIGGER_F)
46+
e5:SetCode(EVENT_PHASE+PHASE_STANDBY)
47+
e5:SetRange(LOCATION_MZONE)
48+
e5:SetCountLimit(1)
49+
e5:SetCondition(function(e) return e:GetHandler():HasFlagEffect(id) and e:GetHandler():GetTurnID()~=Duel.GetTurnCount() end)
50+
e5:SetTarget(s.rmtg)
51+
e5:SetOperation(s.rmop)
52+
c:RegisterEffect(e5)
53+
--Special Summon this card from your GY
6654
local e6=Effect.CreateEffect(c)
67-
e6:SetDescription(aux.Stringid(id,3))
68-
e6:SetCategory(CATEGORY_SPECIAL_SUMMON)
55+
e6:SetDescription(aux.Stringid(id,2))
56+
e6:SetCategory(CATEGORY_SPECIAL_SUMMON+CATEGORY_ATKCHANGE)
6957
e6:SetType(EFFECT_TYPE_SINGLE+EFFECT_TYPE_TRIGGER_O)
70-
e6:SetProperty(EFFECT_FLAG_DAMAGE_STEP+EFFECT_FLAG_DELAY)
7158
e6:SetCode(EVENT_TO_GRAVE)
72-
e6:SetCost(s.spcost)
7359
e6:SetCondition(s.spcon)
7460
e6:SetTarget(s.sptg)
7561
e6:SetOperation(s.spop)
7662
c:RegisterEffect(e6)
77-
--Gains 1000 ATK for each banished card if it's Special Summoned by its own effect
78-
local e7=Effect.CreateEffect(c)
79-
e7:SetDescription(aux.Stringid(id,4))
80-
e7:SetCategory(CATEGORY_ATKCHANGE)
81-
e7:SetType(EFFECT_TYPE_SINGLE)
82-
e7:SetRange(LOCATION_MZONE)
83-
e7:SetCode(EFFECT_UPDATE_ATTACK)
84-
e7:SetCondition(function(e) return e:GetHandler():IsSummonType(SUMMON_TYPE_SPECIAL+1) end)
85-
e7:SetValue(function(e,c) return Duel.GetFieldGroupCount(e:GetHandlerPlayer(),LOCATION_REMOVED,LOCATION_REMOVED)*1000 end)
86-
c:RegisterEffect(e7)
8763
end
8864
s.xyz_number=92
65+
function s.posfilter(c,e)
66+
return c:IsAttackPos() and c:IsCanBeEffectTarget(e)
67+
end
8968
function s.postg(e,tp,eg,ep,ev,re,r,rp,chk)
90-
if chk==0 then return Duel.IsExistingMatchingCard(Card.IsAttackPos,tp,0,LOCATION_MZONE,1,nil) end
91-
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
92-
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,0,0)
69+
if chk==0 then return true end
70+
local g=Duel.GetMatchingGroup(s.posfilter,tp,0,LOCATION_MZONE,nil,e)
71+
if #g>0 then
72+
Duel.SetTargetCard(g)
73+
Duel.SetOperationInfo(0,CATEGORY_POSITION,g,#g,tp,0)
74+
end
9375
end
9476
function s.posop(e,tp,eg,ep,ev,re,r,rp)
95-
local g=Duel.GetMatchingGroup(Card.IsAttackPos,tp,0,LOCATION_MZONE,nil)
96-
if Duel.ChangePosition(g,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE,0,0,true)>0 then
97-
local og=Duel.GetOperatedGroup()
98-
for tc in og:Iter() do
77+
local tg=Duel.GetTargetCards(e)
78+
if tg and #tg>0 then
79+
local posg=tg:Filter(Card.IsAttackPos,nil)
80+
if #posg>0 then
81+
Duel.ChangePosition(posg,POS_FACEUP_DEFENSE,POS_FACEDOWN_DEFENSE)
82+
end
83+
local c=e:GetHandler()
84+
for tc in tg:Iter() do
9985
--Cannot change their battle positions
100-
local e1=Effect.CreateEffect(e:GetHandler())
101-
e1:SetDescription(3313)
102-
e1:SetType(EFFECT_TYPE_SINGLE)
103-
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
104-
e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
105-
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
106-
tc:RegisterEffect(e1)
107-
end
108-
end
109-
end
110-
function s.chkfilter(c,tp)
111-
return c:IsControler(tp) and c:IsLocation(LOCATION_ONFIELD)
86+
local e1=Effect.CreateEffect(c)
87+
e1:SetDescription(3313)
88+
e1:SetType(EFFECT_TYPE_SINGLE)
89+
e1:SetProperty(EFFECT_FLAG_CLIENT_HINT)
90+
e1:SetCode(EFFECT_CANNOT_CHANGE_POSITION)
91+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
92+
tc:RegisterEffect(e1)
93+
end
94+
end
11295
end
113-
function s.chkcon(e,tp,eg,ep,ev,re,r,rp)
114-
return e:GetHandler():IsSpecialSummoned() and eg:IsExists(s.chkfilter,1,nil,1-tp)
96+
function s.damval(e,re,val,r,rp,rc)
97+
local c=e:GetHandler()
98+
if not (c:IsRelateToBattle() and r&REASON_BATTLE==REASON_BATTLE) then return val end
99+
local tp=e:GetHandlerPlayer()
100+
--Inflict damage to your opponent equal to the damage you would have taken, and if you do, you gain LP equal to the damage inflicted
101+
local e1=Effect.CreateEffect(c)
102+
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
103+
e1:SetCode(EVENT_BATTLED)
104+
e1:SetOperation(function()
105+
local dam=Duel.Damage(1-tp,val,REASON_EFFECT)
106+
if dam>0 then
107+
Duel.Recover(tp,dam,REASON_EFFECT)
108+
end
109+
end)
110+
e1:SetReset(RESET_PHASE|PHASE_DAMAGE)
111+
Duel.RegisterEffect(e1,tp)
112+
return 0
113+
end
114+
function s.regop(e,tp,eg,ep,ev,re,r,rp)
115+
local c=e:GetHandler()
116+
local reset_ct=Duel.GetCurrentPhase()<=PHASE_STANDBY and 2 or 1
117+
c:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,reset_ct)
118+
--Keep track of cards placed on your opponent's fiel after this card's Special Summon
119+
local e1=Effect.CreateEffect(c)
120+
e1:SetType(EFFECT_TYPE_FIELD+EFFECT_TYPE_CONTINUOUS)
121+
e1:SetProperty(EFFECT_FLAG_CANNOT_DISABLE)
122+
e1:SetCode(EVENT_MOVE)
123+
e1:SetRange(LOCATION_MZONE)
124+
e1:SetOperation(s.trackop)
125+
e1:SetReset(RESET_EVENT|RESETS_STANDARD)
126+
c:RegisterEffect(e1)
115127
end
116-
function s.chkop(e,tp,eg,ep,ev,re,r,rp)
117-
local g=eg:Filter(s.chkfilter,nil,1-tp)
118-
for tc in g:Iter() do
119-
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD&~RESET_TOFIELD,0,1)
120-
end
128+
function s.trackop(e,tp,eg,ep,ev,re,r,rp)
129+
local g=eg:Filter(Card.IsControler,nil,1-tp)
130+
local reset_ct=Duel.GetCurrentPhase()<=PHASE_STANDBY and 2 or 1
131+
for tc in g:Iter() do
132+
tc:RegisterFlagEffect(id,RESET_EVENT|RESETS_STANDARD|RESET_PHASE|PHASE_STANDBY,0,reset_ct)
133+
end
121134
end
122135
function s.rmfilter(c,turn)
123-
return c:IsAbleToRemove() and c:HasFlagEffect(id,1)
136+
return c:IsAbleToRemove() and c:HasFlagEffect(id)
124137
end
125138
function s.rmtg(e,tp,eg,ep,ev,re,r,rp,chk)
126-
if chk==0 then return Duel.IsExistingMatchingCard(s.rmfilter,tp,0,LOCATION_ONFIELD,1,nil) end
127-
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD,nil)
128-
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,0,0)
139+
if chk==0 then return true end
140+
local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
141+
Duel.SetOperationInfo(0,CATEGORY_REMOVE,g,#g,tp,0)
129142
end
130143
function s.rmop(e,tp,eg,ep,ev,re,r,rp)
131-
local g=Duel.GetMatchingGroup(s.rmfilter,tp,0,LOCATION_ONFIELD,nil)
132-
if #g>0 then
133-
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
134-
end
135-
end
136-
function s.battledamageop(e,tp,eg,ep,ev,re,r,rp)
137-
Duel.ChangeBattleDamage(ep,0)
138-
e:SetLabel(ev)
139-
end
140-
function s.damrectg(e,tp,eg,ep,ev,re,r,rp,chk)
141-
local dam=e:GetLabelObject():GetLabel()
142-
if chk==0 then return dam>0 end
143-
Duel.SetTargetPlayer(1-tp)
144-
Duel.SetTargetParam(dam)
145-
Duel.SetOperationInfo(0,CATEGORY_DAMAGE,nil,0,1-tp,dam)
146-
Duel.SetOperationInfo(0,CATEGORY_RECOVER,nil,0,tp,dam)
147-
end
148-
function s.damrecop(e,tp,eg,ep,ev,re,r,rp)
149-
local p,d=Duel.GetChainInfo(0,CHAININFO_TARGET_PLAYER,CHAININFO_TARGET_PARAM)
150-
if Duel.Damage(p,d,REASON_EFFECT) then
151-
Duel.Recover(tp,d,REASON_EFFECT)
144+
local g=Duel.GetMatchingGroup(s.rmfilter,tp,LOCATION_ONFIELD,LOCATION_ONFIELD,e:GetHandler())
145+
if #g>0 then
146+
Duel.Remove(g,POS_FACEUP,REASON_EFFECT)
152147
end
153-
e:GetLabelObject():SetLabel(0)
154-
end
155-
function s.spcost(e,tp,eg,ep,ev,re,r,rp,chk)
156-
local c=e:GetHandler()
157-
if chk==0 then return c:GetFlagEffect(id)==0 end
158-
c:RegisterFlagEffect(id,0,0,1)
159148
end
160149
function s.spcon(e,tp,eg,ep,ev,re,r,rp)
161-
local c=e:GetHandler()
162-
return c:IsReason(REASON_DESTROY) and e:GetHandler():GetOverlayCount()==0
150+
local c=e:GetHandler()
151+
return c:IsReason(REASON_DESTROY) and c:GetOverlayCount()==0
163152
end
164153
function s.sptg(e,tp,eg,ep,ev,re,r,rp,chk)
165-
local c=e:GetHandler()
166-
if chk==0 then return c:IsRelateToEffect(e) and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
167-
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
168-
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,e:GetHandler(),1,0,0)
154+
local c=e:GetHandler()
155+
if chk==0 then return not c:HasFlagEffect(id+1)
156+
and Duel.GetLocationCount(tp,LOCATION_MZONE)>0
157+
and c:IsCanBeSpecialSummoned(e,0,tp,false,false) end
158+
c:RegisterFlagEffect(id+1,(RESET_EVENT|RESETS_STANDARD|RESET_MSCHANGE)&~(RESET_TOFIELD|RESET_TOGRAVE|RESET_LEAVE|RESET_TURN_SET),EFFECT_FLAG_CLIENT_HINT,1,0,aux.Stringid(id,3))
159+
Duel.SetOperationInfo(0,CATEGORY_SPECIAL_SUMMON,c,1,tp,0)
169160
end
170161
function s.spop(e,tp,eg,ep,ev,re,r,rp)
171-
local c=e:GetHandler()
172-
if c:IsRelateToEffect(e) then
173-
Duel.SpecialSummon(c,1,tp,tp,false,false,POS_FACEUP)
174-
end
162+
local c=e:GetHandler()
163+
if c:IsRelateToEffect(e) and Duel.SpecialSummon(c,0,tp,tp,false,false,POS_FACEUP)>0 then
164+
local atk=Duel.GetFieldGroupCount(0,LOCATION_REMOVED,LOCATION_REMOVED)*1000
165+
--This card's ATK becomes the number of banished cards x 1000
166+
local e1=Effect.CreateEffect(c)
167+
e1:SetType(EFFECT_TYPE_SINGLE)
168+
e1:SetCode(EFFECT_SET_ATTACK)
169+
e1:SetValue(atk)
170+
e1:SetReset(RESET_EVENT|RESETS_STANDARD_DISABLE)
171+
c:RegisterEffect(e1)
172+
end
175173
end

0 commit comments

Comments
 (0)