summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-09-08 22:42:07 -0400
committeryenatch <yenatch@gmail.com>2013-09-08 22:42:07 -0400
commit05db4b4cb6ec2247c321a5ad7d842db9233fda2f (patch)
treeec3ce171b534b37bdce7176f79ec91cf37b91e9b
parentb4d37c675fea5ed3b156e1701b6b89154f974de8 (diff)
comment nightmare move effect asm
-rw-r--r--battle/effect_commands.asm31
1 files changed, 23 insertions, 8 deletions
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm
index 27e3c9363..3c997eb86 100644
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9432,23 +9432,38 @@ BattleCommand51: ; 37517
BattleCommand52: ; 37536
; nightmare
+; Can't hit an absent opponent.
+
call CheckHiddenOpponent
- jr nz, .asm_3755d ; 37539 $22
+ jr nz, .failed
+
+; Can't hit a substitute.
+
call CheckSubstituteOpp
- jr nz, .asm_3755d ; 3753e $1d
+ jr nz, .failed
+
+; Only works on a sleeping opponent.
+
ld a, BATTLE_VARS_STATUS_OPP
call GetBattleVarPair
- and $7
- jr z, .asm_3755d ; 37547 $14
+ and SLP
+ jr z, .failed
+
+; Bail if the opponent is already having a nightmare.
+
ld a, BATTLE_VARS_SUBSTATUS1_OPP
call GetBattleVarPair
- bit 0, [hl]
- jr nz, .asm_3755d ; 37550 $b
- set 0, [hl]
+ bit SUBSTATUS_NIGHTMARE, [hl]
+ jr nz, .failed
+
+; Otherwise give the opponent a nightmare.
+
+ set SUBSTATUS_NIGHTMARE, [hl]
call Function0x37e01
ld hl, StartedNightmareText
jp StdBattleTextBox
-.asm_3755d
+
+.failed
call Function0x37e77
jp PrintButItFailed
; 37563