pokecrystal-board/battle/effects/nightmare.asm

39 lines
679 B
NASM
Raw Normal View History

BattleCommand_Nightmare: ; 37536
2013-12-01 11:19:57 -08:00
; 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
2013-12-01 11:19:57 -08:00
and SLP
jr z, .failed
; Bail if the opponent is already having a nightmare.
ld a, BATTLE_VARS_SUBSTATUS1_OPP
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]
call AnimateCurrentMove
2013-12-01 11:19:57 -08:00
ld hl, StartedNightmareText
jp StdBattleTextBox
.failed
call AnimateFailedMove
2013-12-01 11:19:57 -08:00
jp PrintButItFailed
; 37563