diff options
Diffstat (limited to 'battle/effects/nightmare.asm')
-rw-r--r-- | battle/effects/nightmare.asm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/battle/effects/nightmare.asm b/battle/effects/nightmare.asm new file mode 100644 index 000000000..6cd1f0a64 --- /dev/null +++ b/battle/effects/nightmare.asm @@ -0,0 +1,39 @@ +BattleCommand52: ; 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 _GetBattleVar + and SLP + jr z, .failed + +; Bail if the opponent is already having a nightmare. + + ld a, BATTLE_VARS_SUBSTATUS1_OPP + call _GetBattleVar + bit SUBSTATUS_NIGHTMARE, [hl] + jr nz, .failed + +; Otherwise give the opponent a nightmare. + + set SUBSTATUS_NIGHTMARE, [hl] + call Function0x37e01 + ld hl, StartedNightmareText + jp StdBattleTextBox + +.failed + call Function0x37e77 + jp PrintButItFailed +; 37563 + |