Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/battle/move_effects/haze.asm
1271 views
1
HazeEffect_:
2
ld a, $7
3
; store 7 on every stat mod
4
ld hl, wPlayerMonAttackMod
5
call ResetStatMods
6
ld hl, wEnemyMonAttackMod
7
call ResetStatMods
8
; copy unmodified stats to battle stats
9
ld hl, wPlayerMonUnmodifiedAttack
10
ld de, wBattleMonAttack
11
call ResetStats
12
ld hl, wEnemyMonUnmodifiedAttack
13
ld de, wEnemyMonAttack
14
call ResetStats
15
; cure non-volatile status, but only for the target
16
ld hl, wEnemyMonStatus
17
ld de, wEnemySelectedMove
18
ldh a, [hWhoseTurn]
19
and a
20
jr z, .cureStatuses
21
ld hl, wBattleMonStatus
22
dec de ; wPlayerSelectedMove
23
24
.cureStatuses
25
ld a, [hl]
26
ld [hl], $0
27
and (1 << FRZ) | SLP_MASK
28
jr z, .cureVolatileStatuses
29
; prevent the Pokemon from executing a move if it was asleep or frozen
30
ld a, $ff
31
ld [de], a
32
33
.cureVolatileStatuses
34
xor a
35
ld [wPlayerDisabledMove], a
36
ld [wEnemyDisabledMove], a
37
ld hl, wPlayerDisabledMoveNumber
38
ld [hli], a
39
ld [hl], a
40
ld hl, wPlayerBattleStatus1
41
call CureVolatileStatuses
42
ld hl, wEnemyBattleStatus1
43
call CureVolatileStatuses
44
ld hl, PlayCurrentMoveAnimation
45
call CallBankF
46
ld hl, StatusChangesEliminatedText
47
jp PrintText
48
49
CureVolatileStatuses:
50
res CONFUSED, [hl]
51
inc hl ; BATTSTATUS2
52
ld a, [hl]
53
; clear USING_X_ACCURACY, PROTECTED_BY_MIST, GETTING_PUMPED, and SEEDED statuses
54
and ~((1 << USING_X_ACCURACY) | (1 << PROTECTED_BY_MIST) | (1 << GETTING_PUMPED) | (1 << SEEDED))
55
ld [hli], a ; BATTSTATUS3
56
ld a, [hl]
57
and %11110000 | (1 << TRANSFORMED) ; clear Bad Poison, Reflect and Light Screen statuses
58
ld [hl], a
59
ret
60
61
ResetStatMods:
62
ld b, $8
63
.loop
64
ld [hli], a
65
dec b
66
jr nz, .loop
67
ret
68
69
ResetStats:
70
ld b, $8
71
.loop
72
ld a, [hli]
73
ld [de], a
74
inc de
75
dec b
76
jr nz, .loop
77
ret
78
79
StatusChangesEliminatedText:
80
text_far _StatusChangesEliminatedText
81
text_end
82
83