summaryrefslogtreecommitdiff
path: root/battle/effects
diff options
context:
space:
mode:
Diffstat (limited to 'battle/effects')
-rwxr-xr-xbattle/effects/attract.asm79
-rw-r--r--battle/effects/curse.asm26
-rw-r--r--battle/effects/endure.asm2
-rw-r--r--battle/effects/foresight.asm4
-rw-r--r--battle/effects/metronome.asm14
-rw-r--r--battle/effects/mirror_move.asm14
-rw-r--r--battle/effects/nightmare.asm2
-rw-r--r--battle/effects/perish_song.asm2
-rwxr-xr-xbattle/effects/present.asm93
-rw-r--r--battle/effects/protect.asm4
-rw-r--r--battle/effects/rollout.asm4
-rw-r--r--battle/effects/sandstorm.asm2
-rw-r--r--battle/effects/spikes.asm4
-rw-r--r--battle/effects/thief.asm2
14 files changed, 212 insertions, 40 deletions
diff --git a/battle/effects/attract.asm b/battle/effects/attract.asm
new file mode 100755
index 000000000..f1bc590eb
--- /dev/null
+++ b/battle/effects/attract.asm
@@ -0,0 +1,79 @@
+BattleCommand_Attract: ; 377ce
+; attract
+ ld a, [AttackMissed]
+ and a
+ jr nz, .failed
+ call CheckOppositeGender
+ jr c, .failed
+ call CheckHiddenOpponent
+ jr nz, .failed
+ ld a, BATTLE_VARS_SUBSTATUS1_OPP
+ call GetBattleVarAddr
+ bit SUBSTATUS_IN_LOVE, [hl]
+ jr nz, .failed
+
+ set SUBSTATUS_IN_LOVE, [hl]
+ call AnimateCurrentMove
+
+; 'fell in love!'
+ ld hl, FellInLoveText
+ jp StdBattleTextBox
+
+.failed
+ jp FailAttract
+; 377f5
+
+
+CheckOppositeGender: ; 377f5
+ ld a, MON_SPECIES
+ call BattlePartyAttr
+ ld a, [hl]
+ ld [CurPartySpecies], a
+
+ ld a, [CurBattleMon]
+ ld [CurPartyMon], a
+ xor a
+ ld [MonType], a
+
+ callba GetGender
+ jr c, .genderless_samegender
+
+ ld b, 1
+ jr nz, .got_gender
+ dec b
+
+.got_gender
+ push bc
+ ld a, [TempEnemyMonSpecies]
+ ld [CurPartySpecies], a
+ ld hl, EnemyMonDVs
+ ld a, [EnemySubStatus5]
+ bit SUBSTATUS_TRANSFORMED, a
+ jr z, .not_transformed
+ ld hl, wEnemyBackupDVs
+.not_transformed
+ ld a, [hli]
+ ld [TempMonDVs], a
+ ld a, [hl]
+ ld [TempMonDVs + 1], a
+ ld a, 3
+ ld [MonType], a
+ callba GetGender
+ pop bc
+ jr c, .genderless_samegender
+
+ ld a, 1
+ jr nz, .got_enemy_gender
+ dec a
+
+.got_enemy_gender
+ xor b
+ jr z, .genderless_samegender
+
+ and a
+ ret
+
+.genderless_samegender
+ scf
+ ret
+; 3784b
diff --git a/battle/effects/curse.asm b/battle/effects/curse.asm
index 06706aba1..dceb3b8d5 100644
--- a/battle/effects/curse.asm
+++ b/battle/effects/curse.asm
@@ -1,4 +1,4 @@
-BattleCommand54: ; 37588
+BattleCommand_Curse: ; 37588
; curse
ld de, BattleMonType1
@@ -26,13 +26,13 @@ BattleCommand54: ; 37588
; Attack
ld a, [bc]
- cp 13 ; max
+ cp MAX_STAT_LEVEL
jr c, .raise
; Defense
inc bc
ld a, [bc]
- cp 13 ; max
+ cp MAX_STAT_LEVEL
jr nc, .cantraise
.raise
@@ -40,19 +40,19 @@ BattleCommand54: ; 37588
; Raise Attack and Defense, and lower Speed.
ld a, $1
- ld [wc689], a
+ ld [wKickCounter], a
call AnimateCurrentMove
- ld a, $2
- call Function36532
+ ld a, SPEED
+ call LowerStat
call BattleCommand_SwitchTurn
- call BattleCommand8d
+ call BattleCommand_StatDownMessage
call ResetMiss
call BattleCommand_SwitchTurn
- call BattleCommand70
- call BattleCommand8c
+ call BattleCommand_AttackUp
+ call BattleCommand_StatUpMessage
call ResetMiss
- call BattleCommand71
- jp BattleCommand8c
+ call BattleCommand_DefenseUp
+ jp BattleCommand_StatUpMessage
.ghost
@@ -74,7 +74,7 @@ BattleCommand54: ; 37588
call AnimateCurrentMove
ld hl, GetHalfMaxHP
call CallBattleCore
- ld hl, Function3cc3f
+ ld hl, SubtractHPFromUser
call CallBattleCore
call UpdateUserInParty
ld hl, PutACurseText
@@ -89,7 +89,7 @@ BattleCommand54: ; 37588
; Can't raise either stat.
- ld b, $8 ; ABILITY
+ ld b, ABILITY + 1
call GetStatName
call AnimateFailedMove
ld hl, WontRiseAnymoreText
diff --git a/battle/effects/endure.asm b/battle/effects/endure.asm
index 026fde417..ed4329ff5 100644
--- a/battle/effects/endure.asm
+++ b/battle/effects/endure.asm
@@ -1,4 +1,4 @@
-BattleCommand5a: ; 3766f
+BattleCommand_Endure: ; 3766f
; endure
; Endure shares code with Protect. See protect.asm.
diff --git a/battle/effects/foresight.asm b/battle/effects/foresight.asm
index 775fbd78d..6f4f97cd2 100644
--- a/battle/effects/foresight.asm
+++ b/battle/effects/foresight.asm
@@ -1,4 +1,4 @@
-BattleCommand57: ; 376a0
+BattleCommand_Foresight: ; 376a0
; foresight
ld a, [AttackMissed]
@@ -19,5 +19,5 @@ BattleCommand57: ; 376a0
jp StdBattleTextBox
.failed
- jp Function37354
+ jp FailForesight
; 376c2
diff --git a/battle/effects/metronome.asm b/battle/effects/metronome.asm
index 6815377d0..ddc1bf62e 100644
--- a/battle/effects/metronome.asm
+++ b/battle/effects/metronome.asm
@@ -1,18 +1,18 @@
-BattleCommand34: ; 37418
+BattleCommand_Metronome: ; 37418
; metronome
- call Function372d8
- call Function34548
+ call ClearLastMove
+ call CheckUserIsCharging
jr nz, .asm_3742b
- ld a, [wc689]
+ ld a, [wKickCounter]
push af
- call BattleCommand0a
+ call BattleCommand_LowerSub
pop af
- ld [wc689], a
+ ld [wKickCounter], a
.asm_3742b
- call Function37e36
+ call LoadMoveAnim
.GetMove
call BattleRandom
diff --git a/battle/effects/mirror_move.asm b/battle/effects/mirror_move.asm
index 32a1998bb..c4f208d77 100644
--- a/battle/effects/mirror_move.asm
+++ b/battle/effects/mirror_move.asm
@@ -1,7 +1,7 @@
-BattleCommand1b: ; 373c9
+BattleCommand_MirrorMove: ; 373c9
; mirrormove
- call Function372d8
+ call ClearLastMove
ld a, BATTLE_VARS_MOVE
call GetBattleVarAddr
@@ -37,16 +37,16 @@ BattleCommand1b: ; 373c9
call GetMoveData
call GetMoveName
call CopyName1
- call Function34548
+ call CheckUserIsCharging
jr nz, .done
- ld a, [wc689]
+ ld a, [wKickCounter]
push af
- call BattleCommand0a
+ call BattleCommand_LowerSub
pop af
- ld [wc689], a
+ ld [wKickCounter], a
.done
- call BattleCommandaa
+ call BattleCommand_MoveDelay
jp ResetTurn
; 37418
diff --git a/battle/effects/nightmare.asm b/battle/effects/nightmare.asm
index da39affc1..788e3de41 100644
--- a/battle/effects/nightmare.asm
+++ b/battle/effects/nightmare.asm
@@ -1,4 +1,4 @@
-BattleCommand52: ; 37536
+BattleCommand_Nightmare: ; 37536
; nightmare
; Can't hit an absent opponent.
diff --git a/battle/effects/perish_song.asm b/battle/effects/perish_song.asm
index 95391f3bd..ac491ef6b 100644
--- a/battle/effects/perish_song.asm
+++ b/battle/effects/perish_song.asm
@@ -1,4 +1,4 @@
-BattleCommand58: ; 376c2
+BattleCommand_PerishSong: ; 376c2
; perishsong
diff --git a/battle/effects/present.asm b/battle/effects/present.asm
new file mode 100755
index 000000000..a1594e379
--- /dev/null
+++ b/battle/effects/present.asm
@@ -0,0 +1,93 @@
+BattleCommand_Present: ; 37874
+; present
+
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
+ jr z, .colosseum_skippush
+ push bc
+ push de
+.colosseum_skippush
+
+ call BattleCommand_Stab
+
+ ld a, [wLinkMode]
+ cp LINK_COLOSSEUM
+ jr z, .colosseum_skippop
+ pop de
+ pop bc
+.colosseum_skippop
+
+ ld a, [wTypeMatchup]
+ and a
+ jp z, AnimateFailedMove
+ ld a, [AttackMissed]
+ and a
+ jp nz, AnimateFailedMove
+
+ push bc
+ call BattleRandom
+ ld b, a
+ ld hl, .PresentPower
+ ld c, 0
+.next
+ ld a, [hli]
+ cp $ff
+ jr z, .heal_effect ; 378a4 $11
+ cp b
+ jr nc, .got_power ; 378a7 $4
+ inc c
+ inc hl
+ jr .next ; 378ab $f4
+
+.got_power
+ ld a, c
+ ld [wPresentPower], a
+ call AnimateCurrentMoveEitherSide
+ ld d, [hl]
+ pop bc
+ ret
+
+.heal_effect
+ pop bc
+ ld a, $3
+ ld [wPresentPower], a
+ call AnimateCurrentMove
+ call BattleCommand_SwitchTurn
+ ld hl, AICheckPlayerMaxHP
+ ld a, [hBattleTurn]
+ and a
+ jr z, .got_hp_fn_pointer ; 378c9 $3
+ ld hl, AICheckEnemyMaxHP
+.got_hp_fn_pointer
+ ld a, BANK(AICheckPlayerMaxHP)
+ rst FarCall
+ jr c, .already_fully_healed ; 378d1 $20
+
+ ld hl, GetQuarterMaxHP
+ call CallBattleCore
+ call BattleCommand_SwitchTurn
+ ld hl, RestoreHP
+ call CallBattleCore
+ call BattleCommand_SwitchTurn
+ ld hl, RegainedHealthText
+ call StdBattleTextBox
+ call BattleCommand_SwitchTurn
+ call UpdateOpponentInParty
+ jr .do_animation ; 378f1 $11
+
+.already_fully_healed
+ call BattleCommand_SwitchTurn
+ call _CheckBattleScene
+ jr nc, .do_animation ; 378f9 $9
+ call AnimateFailedMove
+ ld hl, RefusedGiftText
+ call StdBattleTextBox
+.do_animation
+ jp EndMoveEffect
+
+.PresentPower
+ db 40 percent, 40
+ db 70 percent + 1, 80
+ db 80 percent, 120
+ db $ff
+; 3790e
diff --git a/battle/effects/protect.asm b/battle/effects/protect.asm
index eaf011ffe..568ac00f8 100644
--- a/battle/effects/protect.asm
+++ b/battle/effects/protect.asm
@@ -1,4 +1,4 @@
-BattleCommand55: ; 37618
+BattleCommand_Protect: ; 37618
; protect
call ProtectChance
ret c
@@ -23,7 +23,7 @@ ProtectChance: ; 3762c
ld de, EnemyProtectCount
.asm_37637
- call Function36abf
+ call CheckOpponentWentFirst
jr nz, .failed
; Can't have a substitute.
diff --git a/battle/effects/rollout.asm b/battle/effects/rollout.asm
index 3826734b4..fe4c9189b 100644
--- a/battle/effects/rollout.asm
+++ b/battle/effects/rollout.asm
@@ -1,7 +1,7 @@
MAX_ROLLOUT_COUNT EQU 5
-BattleCommand5b: ; 37718
+BattleCommand_CheckCurl: ; 37718
; checkcurl
ld de, PlayerRolloutCount
@@ -25,7 +25,7 @@ BattleCommand5b: ; 37718
; 37734
-BattleCommand5c: ; 37734
+BattleCommand_RolloutPower: ; 37734
; rolloutpower
ld a, BATTLE_VARS_STATUS
diff --git a/battle/effects/sandstorm.asm b/battle/effects/sandstorm.asm
index a33db7f8c..27b8e8e2c 100644
--- a/battle/effects/sandstorm.asm
+++ b/battle/effects/sandstorm.asm
@@ -1,4 +1,4 @@
-BattleCommand59: ; 376f8
+BattleCommand_StartSandstorm: ; 376f8
; startsandstorm
ld a, [Weather]
diff --git a/battle/effects/spikes.asm b/battle/effects/spikes.asm
index 68894b1c1..3d15e4cfd 100644
--- a/battle/effects/spikes.asm
+++ b/battle/effects/spikes.asm
@@ -1,4 +1,4 @@
-BattleCommand56: ; 37683
+BattleCommand_Spikes: ; 37683
; spikes
ld hl, EnemyScreens
@@ -23,5 +23,5 @@ BattleCommand56: ; 37683
jp StdBattleTextBox
.failed
- jp Function37354
+ jp FailSpikes
; 376a0
diff --git a/battle/effects/thief.asm b/battle/effects/thief.asm
index 730fcd66c..f344edef9 100644
--- a/battle/effects/thief.asm
+++ b/battle/effects/thief.asm
@@ -1,4 +1,4 @@
-BattleCommand50: ; 37492
+BattleCommand_Thief: ; 37492
; thief
ld a, [hBattleTurn]