pokered/engine/battle/moveEffects/haze_effect.asm

82 lines
1.7 KiB
NASM
Raw Normal View History

2016-06-12 00:24:04 +00:00
HazeEffect_:
ld a, $7
2015-06-11 22:41:33 +00:00
; store 7 on every stat mod
ld hl, wPlayerMonAttackMod
call ResetStatMods
ld hl, wEnemyMonAttackMod
call ResetStatMods
2015-06-11 22:41:33 +00:00
; copy unmodified stats to battle stats
ld hl, wPlayerMonUnmodifiedAttack
ld de, wBattleMonAttack
call ResetStats
ld hl, wEnemyMonUnmodifiedAttack
ld de, wEnemyMonAttack
call ResetStats
ld hl, wEnemyMonStatus
ld de, wEnemySelectedMove
ld a, [H_WHOSETURN]
and a
jr z, .cureStatuses
ld hl, wBattleMonStatus
dec de ; wPlayerSelectedMove
.cureStatuses
ld a, [hl]
ld [hl], $0
and SLP | (1 << FRZ)
jr z, .cureVolatileStatuses
2015-06-11 22:41:33 +00:00
; prevent the Pokemon from executing a move if it was asleep or frozen
ld a, $ff
ld [de], a
.cureVolatileStatuses
xor a
2015-08-31 02:38:41 +00:00
ld [wPlayerDisabledMove], a
ld [wEnemyDisabledMove], a
ld hl, wPlayerDisabledMoveNumber
ld [hli], a
ld [hl], a
2015-08-31 02:38:41 +00:00
ld hl, wPlayerBattleStatus1
call CureVolatileStatuses
2015-08-31 02:38:41 +00:00
ld hl, wEnemyBattleStatus1
call CureVolatileStatuses
ld hl, PlayCurrentMoveAnimation
call CallBankF
ld hl, StatusChangesEliminatedText
jp PrintText
2016-06-12 00:24:04 +00:00
CureVolatileStatuses:
; only cures statuses of the Pokemon not using Haze
res Confused, [hl]
inc hl ; BATTSTATUS2
ld a, [hl]
; clear UsingXAccuracy, ProtectedByMist, GettingPumped, and Seeded statuses
2015-06-11 22:41:33 +00:00
and $ff ^((1 << UsingXAccuracy) | (1 << ProtectedByMist) | (1 << GettingPumped) | (1 << Seeded))
ld [hli], a ; BATTSTATUS3
ld a, [hl]
and %11110000 | (1 << Transformed) ; clear Bad Poison, Reflect and Light Screen statuses
ld [hl], a
ret
2016-06-12 00:24:04 +00:00
ResetStatMods:
ld b, $8
.loop
2015-06-11 22:41:33 +00:00
ld [hli], a
dec b
jr nz, .loop
ret
2016-06-12 00:24:04 +00:00
ResetStats:
ld b, $8
.loop
ld a, [hli]
ld [de], a
inc de
dec b
jr nz, .loop
ret
2016-06-12 00:24:04 +00:00
StatusChangesEliminatedText:
TX_FAR _StatusChangesEliminatedText
db "@"