2018-06-24 07:09:41 -07:00
|
|
|
BattleCommand_Nightmare:
|
2013-12-01 11:19:57 -08:00
|
|
|
; 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
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2022-06-17 19:25:56 -07:00
|
|
|
and SLP_MASK
|
2013-12-01 11:19:57 -08:00
|
|
|
jr z, .failed
|
|
|
|
|
|
|
|
; Bail if the opponent is already having a nightmare.
|
|
|
|
|
|
|
|
ld a, BATTLE_VARS_SUBSTATUS1_OPP
|
2014-06-14 00:34:57 -07:00
|
|
|
call GetBattleVarAddr
|
2013-12-01 11:19:57 -08:00
|
|
|
bit SUBSTATUS_NIGHTMARE, [hl]
|
|
|
|
jr nz, .failed
|
|
|
|
|
|
|
|
; Otherwise give the opponent a nightmare.
|
|
|
|
|
|
|
|
set SUBSTATUS_NIGHTMARE, [hl]
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateCurrentMove
|
2013-12-01 11:19:57 -08:00
|
|
|
ld hl, StartedNightmareText
|
2019-04-08 05:15:10 -07:00
|
|
|
jp StdBattleTextbox
|
2013-12-01 11:19:57 -08:00
|
|
|
|
|
|
|
.failed
|
2014-01-01 05:09:15 -08:00
|
|
|
call AnimateFailedMove
|
2013-12-01 11:19:57 -08:00
|
|
|
jp PrintButItFailed
|