mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2024-09-09 09:51:34 -07:00
5f0597e944
Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
36 lines
655 B
NASM
36 lines
655 B
NASM
BattleCommand_Nightmare:
|
|
; Can't hit an absent opponent.
|
|
|
|
call CheckHiddenOpponent
|
|
jr nz, .failed
|
|
|
|
; Can't hit a substitute.
|
|
|
|
call CheckSubstituteOpp
|
|
jr nz, .failed
|
|
|
|
; Only works on a sleeping opponent.
|
|
|
|
ld a, BATTLE_VARS_STATUS_OPP
|
|
call GetBattleVarAddr
|
|
and SLP_MASK
|
|
jr z, .failed
|
|
|
|
; Bail if the opponent is already having a nightmare.
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
|
call GetBattleVarAddr
|
|
bit SUBSTATUS_NIGHTMARE, [hl]
|
|
jr nz, .failed
|
|
|
|
; Otherwise give the opponent a nightmare.
|
|
|
|
set SUBSTATUS_NIGHTMARE, [hl]
|
|
call AnimateCurrentMove
|
|
ld hl, StartedNightmareText
|
|
jp StdBattleTextbox
|
|
|
|
.failed
|
|
call AnimateFailedMove
|
|
jp PrintButItFailed
|