blob: 788e3de416e32c46cb7df8cd7d7b722fdc9ec05c (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 | BattleCommand_Nightmare: ; 37536
; 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
	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
; 37563
 |