pokecrystal/engine/battle/move_effects/nightmare.asm

38 lines
663 B
NASM
Raw Normal View History

2018-06-24 14:09:41 +00:00
BattleCommand_Nightmare:
2013-12-01 19:19:57 +00: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 19:19:57 +00: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 19:19:57 +00:00
bit SUBSTATUS_NIGHTMARE, [hl]
jr nz, .failed
; Otherwise give the opponent a nightmare.
set SUBSTATUS_NIGHTMARE, [hl]
call AnimateCurrentMove
2013-12-01 19:19:57 +00:00
ld hl, StartedNightmareText
2019-04-08 12:15:10 +00:00
jp StdBattleTextbox
2013-12-01 19:19:57 +00:00
.failed
call AnimateFailedMove
2013-12-01 19:19:57 +00:00
jp PrintButItFailed