shithub: pokecrystal

Download patch

ref: 4dbf0d44e0ecd5575f251a649faba549f790b631
parent: a18cab495dc3fdee85b89faf4b42ca48fd428c1e
author: yenatch <[email protected]>
date: Wed Jan 1 03:09:15 EST 2014

comment and relabel more battle functions

--- a/battle/core.asm
+++ b/battle/core.asm
@@ -28,11 +28,10 @@
 	ld a, [InLinkBattle]
 	and a
 	jr z, .asm_3c031
+
 	ld a, [$ffcb]
 	cp $2
-.data_3c02f
-	db $28
-	db $1b
+	jr z, .asm_3c04c
 
 .asm_3c031
 	ld a, [IsInBattle]
@@ -40,14 +39,16 @@
 	jr z, .asm_3c047
 	xor a
 	ld [$c718], a
-	call Function3d834
-	call Function3d867
-	call Function3dc18
+	call NewEnemyMonStatus
+	call ResetEnemyStatLevels
+	call BreakAttraction
 	call Function3d4e1
 
 .asm_3c047
-	ld c, $28
+	ld c, 40
 	call DelayFrames
+
+.asm_3c04c
 	call Function309d
 	call Function3d873
 	ld a, d
@@ -87,15 +88,15 @@
 	call Function309d
 	call Function3d57a
 	call Function3da0d
-	call Function3dab1
+	call ResetPlayerStatLevels
 	call Function3f26d
-	call Function3dbde
-	call Function3dc18
+	call NewBattleMonStatus
+	call BreakAttraction
 	call Function3db5f
 	call EmptyBattleTextBox
 	call Function309d
 	call SetPlayerTurn
-	call Function3dc23
+	call SpikesDamage
 	ld a, [InLinkBattle]
 	and a
 	jr z, .asm_3c0df
@@ -104,12 +105,12 @@
 	jr nz, .asm_3c0df
 	xor a
 	ld [$c718], a
-	call Function3d834
-	call Function3d867
-	call Function3dc18
+	call NewEnemyMonStatus
+	call ResetEnemyStatLevels
+	call BreakAttraction
 	call Function3d4e1
 	call SetEnemyTurn
-	call Function3dc23
+	call SpikesDamage
 
 .asm_3c0df
 	jp Function3c12f
@@ -470,7 +471,7 @@
 .asm_3c34c
 	callab Function3846c
 	call SetEnemyTurn
-	call Function3dc23
+	call SpikesDamage
 	jp Function3c3f3
 
 .asm_3c35b
@@ -668,7 +669,7 @@
 	cp $74
 	jr z, .asm_3c4c9
 	xor a
-	ld [$c679], a
+	ld [PlayerProtectCount], a
 	jr .asm_3c4c9
 
 .asm_3c4b5
@@ -678,7 +679,7 @@
 .asm_3c4ba
 	xor a
 	ld [PlayerFuryCutterCount], a
-	ld [$c679], a
+	ld [PlayerProtectCount], a
 	ld [$c72b], a
 	ld hl, PlayerSubStatus4
 	res 6, [hl]
@@ -691,7 +692,7 @@
 .asm_3c4ce
 	xor a
 	ld [PlayerFuryCutterCount], a
-	ld [$c679], a
+	ld [PlayerProtectCount], a
 	ld [$c72b], a
 	ld hl, PlayerSubStatus4
 	res 6, [hl]
@@ -2144,7 +2145,7 @@
 	call ClearBox
 	call Function3d2b3
 	ld a, $1
-	call Function3cf78
+	call EnemyPartyMonEntrance
 	jr .asm_3cdfc
 
 .asm_3cde6
@@ -2151,7 +2152,7 @@
 	ld a, [CurPartyMon]
 	push af
 	ld a, $1
-	call Function3cf78
+	call EnemyPartyMonEntrance
 	call ClearSprites
 	call Function309d
 	pop af
@@ -2183,8 +2184,8 @@
 	ld hl, EnemyDamageTaken
 	ld [hli], a
 	ld [hl], a
-	call Function3d834
-	call Function3dc18
+	call NewEnemyMonStatus
+	call BreakAttraction
 	ld a, [IsInBattle]
 	dec a
 	jr z, .asm_3ce2f
@@ -2382,18 +2383,18 @@
 	ld a, [hli]
 	or [hl]
 	ld a, $0
-	jr nz, Function3cf78
+	jr nz, EnemyPartyMonEntrance
 	inc a
 	ret
 ; 3cf78
 
-Function3cf78: ; 3cf78
+EnemyPartyMonEntrance: ; 3cf78
 	push af
 	xor a
 	ld [$c718], a
-	call Function3d834
-	call Function3d867
-	call Function3dc18
+	call NewEnemyMonStatus
+	call ResetEnemyStatLevels
+	call BreakAttraction
 	pop af
 	and a
 	jr nz, .asm_3cf8f
@@ -2406,7 +2407,7 @@
 .asm_3cf92
 	call Function3d57a
 	call SetEnemyTurn
-	call Function3dc23
+	call SpikesDamage
 	xor a
 	ld [EnemyMoveAnimation], a
 	ld [$d0ec], a
@@ -2834,7 +2835,7 @@
 	call EmptyBattleTextBox
 	call Function1d6e
 	call Function3d2f7
-	call Function3d362
+	call ForcePickPartyMonInBattle
 	ld a, [InLinkBattle]
 	and a
 	jr z, .asm_3d241
@@ -2873,7 +2874,7 @@
 	ld [CurBattleMon], a
 	call Function3d581
 	call Function3da0d
-	call Function3dab1
+	call ResetPlayerStatLevels
 	call ClearPalettes
 	call DelayFrame
 	call Function3eda6
@@ -2881,13 +2882,13 @@
 	call ClearSGB
 	call Function32f9
 	call Function3f26d
-	call Function3dbde
-	call Function3dc18
+	call NewBattleMonStatus
+	call BreakAttraction
 	call Function3db5f
 	call EmptyBattleTextBox
 	call Function309d
 	call SetPlayerTurn
-	call Function3dc23
+	call SpikesDamage
 	ld a, $1
 	and a
 	ld c, a
@@ -2901,15 +2902,15 @@
 	ld [CurBattleMon], a
 	call Function3d581
 	call Function3da0d
-	call Function3dab1
+	call ResetPlayerStatLevels
 	call Function3f26d
-	call Function3dbde
-	call Function3dc18
+	call NewBattleMonStatus
+	call BreakAttraction
 	call Function3db5f
 	call EmptyBattleTextBox
 	call Function309d
 	call SetPlayerTurn
-	jp Function3dc23
+	jp SpikesDamage
 ; 3d2e0
 
 
@@ -2965,9 +2966,9 @@
 	ret
 ; 3d33c
 
-Function3d33c: ; 3d33c
+PickPartyMonInBattle: ; 3d33c
 .asm_3d33c
-	ld a, $2
+	ld a, $2 ; Which PKMN?
 	ld [PartyMenuActionText], a
 	call Function3d313
 	call Function3d329
@@ -2978,52 +2979,58 @@
 	ret
 ; 3d34f
 
-Function3d34f: ; 3d34f
+SwitchMonAlreadyOut: ; 3d34f
 	ld hl, CurBattleMon
 	ld a, [CurPartyMon]
 	cp [hl]
-	jr nz, .asm_3d360
+	jr nz, .notout
+
 	ld hl, BattleText_0x80c0d
 	call StdBattleTextBox
 	scf
 	ret
 
-.asm_3d360
+.notout
 	xor a
 	ret
 ; 3d362
 
-Function3d362: ; 3d362
-.asm_3d362
-	call Function3d33c
+ForcePickPartyMonInBattle: ; 3d362
+; Can't back out.
+
+.pick
+	call PickPartyMonInBattle
 	ret nc
 	call Function3d2e0
 	ret c
+
 	ld de, SFX_WRONG
 	call PlaySFX
 	call WaitSFX
-	jr .asm_3d362
+	jr .pick
 ; 3d375
 
 
-
-Function3d375: ; 3d375
-.asm_3d375
-	call Function3d33c
+PickSwitchMonInBattle: ; 3d375
+.pick
+	call PickPartyMonInBattle
 	ret c
-	call Function3d34f
-	jr c, .asm_3d375
+	call SwitchMonAlreadyOut
+	jr c, .pick
 	xor a
 	ret
 ; 3d380
 
-Function3d380: ; 3d380
-.asm_3d380
-	call Function3d362
+ForcePickSwitchMonInBattle: ; 3d380
+; Can't back out.
+
+.pick
+	call ForcePickPartyMonInBattle
 	call Function3d2e0
 	ret c
-	call Function3d34f
-	jr c, .asm_3d380
+	call SwitchMonAlreadyOut
+	jr c, .pick
+
 	xor a
 	ret
 ; 3d38e
@@ -3244,10 +3251,10 @@
 	ld b, a
 	call Function3d6ca
 	call Function3d7a0
-	call Function3d834
-	call Function3d867
+	call NewEnemyMonStatus
+	call ResetEnemyStatLevels
 	call Function3d7c7
-	call Function3dc18
+	call BreakAttraction
 	call Function3d57a
 	ret
 ; 3d4e1
@@ -3628,7 +3635,7 @@
 	dec a
 	jr nz, .asm_3d79a
 	call Function3d2f7
-	call Function3d375
+	call PickSwitchMonInBattle
 	jr c, .asm_3d791
 	ld a, [CurBattleMon]
 	ld [$c71a], a
@@ -3725,7 +3732,7 @@
 	ret
 ; 3d834
 
-Function3d834: ; 3d834
+NewEnemyMonStatus: ; 3d834
 	xor a
 	ld [LastEnemyCounterMove], a
 	ld [LastPlayerCounterMove], a
@@ -3750,14 +3757,14 @@
 	ret
 ; 3d867
 
-Function3d867: ; 3d867
-	ld a, $7
-	ld b, $8
-	ld hl, EnemyAtkLevel
-.asm_3d86e
+ResetEnemyStatLevels: ; 3d867
+	ld a, 7
+	ld b, 8
+	ld hl, EnemyStatLevels
+.loop
 	ld [hli], a
 	dec b
-	jr nz, .asm_3d86e
+	jr nz, .loop
 	ret
 ; 3d873
 
@@ -4076,14 +4083,14 @@
 	jp GetPartyLocation
 ; 3dab1
 
-Function3dab1: ; 3dab1
-	ld a, $7
-	ld b, $8
-	ld hl, PlayerAtkLevel
-.asm_3dab8
+ResetPlayerStatLevels: ; 3dab1
+	ld a, 7
+	ld b, 8
+	ld hl, PlayerStatLevels
+.loop
 	ld [hli], a
 	dec b
-	jr nz, .asm_3dab8
+	jr nz, .loop
 	ret
 ; 3dabd
 
@@ -4150,9 +4157,9 @@
 	ld [CurBattleMon], a
 	call Function3d581
 	call Function3da0d
-	call Function3dab1
-	call Function3dbde
-	call Function3dc18
+	call ResetPlayerStatLevels
+	call NewBattleMonStatus
+	call BreakAttraction
 	call Function3db5f
 	call EmptyBattleTextBox
 	call Function309d
@@ -4220,7 +4227,7 @@
 	ret
 ; 3dbde
 
-Function3dbde: ; 3dbde
+NewBattleMonStatus: ; 3dbde
 	xor a
 	ld [LastEnemyCounterMove], a
 	ld [LastPlayerCounterMove], a
@@ -4238,7 +4245,7 @@
 	ld [hl], a
 	ld [PlayerDisableCount], a
 	ld [PlayerFuryCutterCount], a
-	ld [$c679], a
+	ld [PlayerProtectCount], a
 	ld [$c72b], a
 	ld [DisabledMove], a
 	ld [$c6fe], a
@@ -4246,50 +4253,56 @@
 	ld [$c730], a
 	ld [PlayerTurnsTaken], a
 	ld hl, EnemySubStatus5
-	res 7, [hl]
+	res SUBSTATUS_CANT_RUN, [hl]
 	ret
 ; 3dc18
 
-Function3dc18: ; 3dc18
+BreakAttraction: ; 3dc18
 	ld hl, PlayerSubStatus1
-	res 7, [hl]
+	res SUBSTATUS_IN_LOVE, [hl]
 	ld hl, EnemySubStatus1
-	res 7, [hl]
+	res SUBSTATUS_IN_LOVE, [hl]
 	ret
 ; 3dc23
 
-Function3dc23: ; 3dc23
+SpikesDamage: ; 3dc23
 	ld hl, PlayerScreens
 	ld de, BattleMonType1
 	ld bc, Function3df48
 	ld a, [hBattleTurn]
 	and a
-	jr z, .asm_3dc3a
+	jr z, .ok
 	ld hl, EnemyScreens
 	ld de, EnemyMonType1
 	ld bc, Function3e036
+.ok
 
-.asm_3dc3a
-	bit 0, [hl]
+	bit SCREENS_SPIKES, [hl]
 	ret z
+
+; Flying-types aren't affected by Spikes.
 	ld a, [de]
-	cp $2
+	cp FLYING
 	ret z
 	inc de
 	ld a, [de]
-	cp $2
+	cp FLYING
 	ret z
+
 	push bc
-	ld hl, BattleText_0x80bae
+
+	ld hl, BattleText_0x80bae ; "hurt by SPIKES!"
 	call StdBattleTextBox
+
 	call GetEighthMaxHP
 	call Function3cc39
+
 	pop hl
-	call Function3dc5a
+	call .hl
+
 	jp WaitBGMap
-; 3dc5a
 
-Function3dc5a: ; 3dc5a
+.hl
 	jp [hl]
 ; 3dc5b
 
@@ -5375,7 +5388,7 @@
 	jr nz, .asm_3e3cf
 
 .asm_3e3ca
-	call Function3e40b
+	call BattleMonEntrance
 	and a
 	ret
 
@@ -5396,7 +5409,7 @@
 	ld a, [$ffcb]
 	cp $1
 	jr z, .asm_3e3f7
-	call Function3e40b
+	call BattleMonEntrance
 	call Function3e3ff
 	and a
 	ret
@@ -5403,7 +5416,7 @@
 
 .asm_3e3f7
 	call Function3e3ff
-	call Function3e40b
+	call BattleMonEntrance
 	and a
 	ret
 ; 3e3ff
@@ -5411,48 +5424,54 @@
 Function3e3ff: ; 3e3ff
 	callab Function3846c
 	call SetEnemyTurn
-	jp Function3dc23
+	jp SpikesDamage
 ; 3e40b
 
-Function3e40b: ; 3e40b
+BattleMonEntrance: ; 3e40b
 	call Function3f2f4
-	ld c, $32
+
+	ld c, 50
 	call DelayFrames
+
 	ld hl, PlayerSubStatus4
-	res 6, [hl]
+	res SUBSTATUS_RAGE, [hl]
+
 	call SetEnemyTurn
 	call Function3dc5b
 	jr c, .asm_3e423
 	call Function3dce6
-
 .asm_3e423
-	ld hl, $c535
-	ld bc, $050b
+
+	hlcoord 9, 7
+	lb bc, 5, 11
 	call ClearBox
+
 	ld a, [CurBattleMon]
 	ld [CurPartyMon], a
 	call Function3d581
 	call Function3da0d
-	call Function3dab1
+	call ResetPlayerStatLevels
 	call Function3f26d
-	call Function3dbde
-	call Function3dc18
+	call NewBattleMonStatus
+	call BreakAttraction
 	call Function3db5f
 	call EmptyBattleTextBox
 	call Function309d
 	call SetPlayerTurn
-	call Function3dc23
+	call SpikesDamage
 	ld a, $2
 	ld [$cfa9], a
 	ret
 ; 3e459
 
-Function3e459: ; 3e459
-	ld c, $32
+PassedBattleMonEntrance: ; 3e459
+	ld c, 50
 	call DelayFrames
-	ld hl, $c535
-	ld bc, $050b
+
+	hlcoord 9, 7
+	lb bc, 5, 11
 	call ClearBox
+
 	ld a, [CurPartyMon]
 	ld [CurBattleMon], a
 	call Function3d581
@@ -5464,7 +5483,7 @@
 	call EmptyBattleTextBox
 	call Function309d
 	call SetPlayerTurn
-	jp Function3dc23
+	jp SpikesDamage
 ; 3e489
 
 
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -2715,6 +2715,7 @@
 
 
 BattleCommand0a: ; 34eee
+; lowersub
 
 	ld a, BATTLE_VARS_SUBSTATUS4
 	call GetBattleVar
@@ -2755,7 +2756,7 @@
 	ld [FXAnimIDHi], a
 	inc a
 	ld [$c689], a
-	ld a, $a4
+	ld a, SUBSTITUTE
 	jp Function37e44
 
 .asm_34f36
@@ -2908,6 +2909,8 @@
 
 
 BattleCommand0c: ; 35004
+; raisesub
+
 	ld a, BATTLE_VARS_SUBSTATUS4
 	call GetBattleVar
 	bit SUBSTATUS_SUBSTITUTE, a
@@ -2921,7 +2924,7 @@
 	ld [FXAnimIDHi], a
 	ld a, $2
 	ld [$c689], a
-	ld a, $a4
+	ld a, SUBSTITUTE
 	jp Function37e44
 ; 35023
 
@@ -4621,7 +4624,7 @@
 	ld de, EnemyMoveStruct
 	call GetMoveData
 .asm_3591a
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, GotAnEncoreText
 	jp StdBattleTextBox
@@ -4641,7 +4644,7 @@
 	jp nz, Function359cd
 	call CheckSubstituteOpp
 	jp nz, Function359cd
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, $c63f
 	ld de, EnemyMonMaxHPLo
 	call .asm_3597d
@@ -4774,7 +4777,7 @@
 	pop hl
 	cp CURSE_T
 	jr z, .asm_35a50 ; 35a0b $43
-	call Function37e01
+	call AnimateCurrentMove
 
 	call SwitchTurn
 .asm_35a13
@@ -4828,13 +4831,13 @@
 	ld a, BATTLE_VARS_SUBSTATUS5_OPP
 	call _GetBattleVar
 	set SUBSTATUS_LOCK_ON, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, TookAimText
 	jp StdBattleTextBox
 
 .asm_35a6e
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintDidntAffect
 ; 35a74
 
@@ -4846,7 +4849,7 @@
 	ld a, [InLinkBattle]
 	and a
 	jr z, .asm_35a83 ; 35a7b $6
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintNothingHappened
 .asm_35a83
 	call CheckSubstituteOpp
@@ -4931,13 +4934,13 @@
 	ld [hl], a
 .asm_35b04
 	call GetMoveName
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, SketchedText
 	jp StdBattleTextBox
 
 .asm_35b10
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintDidntAffect
 ; 35b16
 
@@ -4948,7 +4951,7 @@
 ; If the opponent isn't frozen, raise Attack one stage.
 ; If the opponent is frozen, thaw them and raise Accuracy two stages.
 
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld a, BATTLE_VARS_STATUS_OPP
 	call _GetBattleVar
@@ -5036,7 +5039,7 @@
 	call UpdateMoveData
 	jp ResetTurn
 .asm_35ba3
-	call Function37e77
+	call AnimateFailedMove
 	jp TryPrintButItFailed
 
 .asm_35ba9
@@ -5123,7 +5126,7 @@
 	ld a, BATTLE_VARS_SUBSTATUS5
 	call _GetBattleVar
 	set 6, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, DestinyBondEffectText
 	jp StdBattleTextBox
 ; 35c0f
@@ -5205,7 +5208,7 @@
 	ld [hl], e
 .asm_35c82
 	push de
-	call Function37e01
+	call AnimateCurrentMove
 	pop de
 	ld a, d
 	ld [$d265], a
@@ -5285,7 +5288,7 @@
 	add hl, bc
 	dec d
 	jr nz, .asm_35ce9
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, BellChimedText
 	call StdBattleTextBox
@@ -5560,7 +5563,7 @@
 	call CheckSubstituteOpp
 	jr nz, .asm_35ec6
 
-	call Function37e01
+	call AnimateCurrentMove
 	ld b, $7
 	ld a, [$cfc0]
 	and a
@@ -5588,7 +5591,7 @@
 
 .asm_35ec6
 	push hl
-	call Function37e77
+	call AnimateFailedMove
 	pop hl
 	jp StdBattleTextBox
 ; 35ece
@@ -5735,7 +5738,7 @@
 
 .asm_35fb8
 	push hl
-	call Function37e77
+	call AnimateFailedMove
 	pop hl
 	jp StdBattleTextBox
 ; 35fc0
@@ -5742,7 +5745,7 @@
 
 
 Function35fc0: ; 35fc0
-	call Function37e01
+	call AnimateCurrentMove
 	call Function35ff5
 	jp RefreshBattleHuds
 ; 35fc9
@@ -7036,7 +7039,7 @@
 	ld [bc], a
 	ld a, $1
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	jp EndMoveEffect
 ; 3671a
 
@@ -7147,7 +7150,7 @@
 	jr nc, .asm_367df ; 367b7 $26
 
 .asm_367b9
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 
 .asm_367bf
@@ -7255,7 +7258,7 @@
 	call UpdateEnemyMonInParty
 	ld a, $1
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld c, $14
 	call DelayFrames
 	ld hl, $c4a1
@@ -7291,7 +7294,7 @@
 	ld hl, DraggedOutText
 	call StdBattleTextBox
 
-	ld hl, Function3dc23
+	ld hl, SpikesDamage
 	jp CallBattleCore
 
 .asm_368ca
@@ -7349,7 +7352,7 @@
 	call UpdateBattleMonInParty
 	ld a, $1
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld c, $14
 	call DelayFrames
 	ld hl, $c535
@@ -7388,7 +7391,7 @@
 	ld hl, DraggedOutText
 	call StdBattleTextBox
 
-	ld hl, Function3dc23
+	ld hl, SpikesDamage
 	jp CallBattleCore
 
 .asm_36969
@@ -7402,7 +7405,7 @@
 	call Function36804
 	ld a, $1
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld c, $14
 	call DelayFrames
 	pop af
@@ -7944,11 +7947,11 @@
 	bit 1, [hl]
 	jr nz, .asm_36c92 ; 36c85 $b
 	set 1, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, MistText
 	jp StdBattleTextBox
 .asm_36c92
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 36c98
 
@@ -7961,11 +7964,11 @@
 	bit 2, [hl]
 	jr nz, .asm_36cac ; 36c9f $b
 	set 2, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, GettingPumpedText
 	jp StdBattleTextBox
 .asm_36cac
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 36cb2
 
@@ -8067,7 +8070,7 @@
 	ld a, [hl]
 	ld [$d265], a
 	call GetItemName
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, ProtectedByText
 	jp StdBattleTextBox
 
@@ -8076,7 +8079,7 @@
 	call _GetBattleVar
 	bit 7, [hl]
 	jr z, .asm_36d65
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, AlreadyConfusedText
 	jp StdBattleTextBox
 
@@ -8114,7 +8117,7 @@
 	jr z, .asm_36d99
 	cp EFFECT_SWAGGER
 	jr z, .asm_36d99
-	call Function37e01
+	call AnimateCurrentMove
 
 .asm_36d99
 	ld de, $0103
@@ -8164,7 +8167,7 @@
 	ld a, [hl]
 	ld [$d265], a
 	call GetItemName
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, ProtectedByText
 	jp StdBattleTextBox
 .asm_36def
@@ -8195,7 +8198,7 @@
 	jr nz, .asm_36e52 ; 36e1f $31
 	ld c, $1e
 	call DelayFrames
-	call Function37e01
+	call AnimateCurrentMove
 	ld a, $1
 	ld [$ffd4], a
 	ld a, BATTLE_VARS_STATUS_OPP
@@ -8209,13 +8212,13 @@
 	ld hl, Function3dde9
 	jp CallBattleCore
 .asm_36e49
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, AlreadyParalyzedText
 	jp StdBattleTextBox
 .asm_36e52
 	jp PrintDidntAffect2
 .asm_36e55
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintDoesntAffect
 ; 36e5b
 
@@ -8445,7 +8448,7 @@
 	add hl, bc
 	ld [hl], $5
 	call GetMoveName
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, LearnedMoveText
 	jp StdBattleTextBox
 .asm_36f9a
@@ -8478,14 +8481,14 @@
 	bit 7, [hl]
 	jr nz, .asm_36fd8 ; 36fc5 $11
 	set 7, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, WasSeededText
 	jp StdBattleTextBox
 .asm_36fd2
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintDoesntAffect
 .asm_36fd8
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, EvadedText
 	jp StdBattleTextBox
 ; 36fe1
@@ -8492,7 +8495,7 @@
 
 
 BattleCommand36: ; 36fe1
-	call Function37e01
+	call AnimateCurrentMove
 	callba Function1060e5
 	jp PrintNothingHappened
 ; 36fed
@@ -8548,7 +8551,7 @@
 	swap c
 	add c
 	ld [de], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, DisabledMove
 	ld a, [hBattleTurn]
 	and a
@@ -8656,7 +8659,7 @@
 	inc hl
 	jr .asm_370bd ; 370d1 $ea
 .asm_370d3
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 .asm_370d9
 	call BattleRandom
@@ -8684,7 +8687,7 @@
 	ld [de], a
 	ld [$d265], a
 	callba GetTypeName
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, TransformedTypeText
 	jp StdBattleTextBox
 ; 3710e
@@ -8710,7 +8713,7 @@
 	pop af
 	ld [hBattleTurn], a
 
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, EliminatedStatsText
 	jp StdBattleTextBox
@@ -8788,7 +8791,7 @@
 	ld hl, GetMaxHP
 	call CallBattleCore
 .asm_371a9
-	call Function37e01
+	call AnimateCurrentMove
 	call SwitchTurn
 	ld hl, Function3ccef
 	call CallBattleCore
@@ -8799,7 +8802,7 @@
 	jp StdBattleTextBox
 
 .asm_371c4
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, HPIsFullText
 	jp StdBattleTextBox
 ; 371cd
@@ -8833,7 +8836,7 @@
 	ld a, BATTLE_VARS_SUBSTATUS5
 	call _GetBattleVar
 	set 3, [hl]
-	call Function372e7
+	call ResetActorDisable
 	ld hl, BattleMonSpecies
 	ld de, EnemyMonSpecies
 	ld a, [hBattleTurn]
@@ -8960,7 +8963,7 @@
 
 
 Function372d2: ; 372d2
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 372d8
 
@@ -8979,7 +8982,7 @@
 ; 372e7
 
 
-Function372e7: ; 372e7
+ResetActorDisable: ; 372e7
 	ld a, [hBattleTurn]
 	and a
 	jr z, .player
@@ -9035,11 +9038,11 @@
 	ld hl, ReflectEffectText
 
 .asm_37331
-	call Function37e01
+	call AnimateCurrentMove
 	jp StdBattleTextBox
 
 .asm_37337
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 3733d
 
@@ -9075,7 +9078,7 @@
 
 
 Function37354: ; 37354
-	call Function37e77
+	call AnimateFailedMove
 	; fallthrough
 ; 37357
 
@@ -9094,7 +9097,7 @@
 
 
 PrintDidntAffect2: ; 37366
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, DidntAffect1Text ; 'it didn't affect'
 	ld de, DidntAffect2Text ; 'it didn't affect'
 	jp Function35157
@@ -9216,12 +9219,12 @@
 ; Otherwise trap the opponent.
 
 	set SUBSTATUS_CANT_RUN, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, CantEscapeNowText
 	jp StdBattleTextBox
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37536
 
@@ -9361,7 +9364,7 @@
 	jr nz, .asm_377f2
 
 	set 7, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 
 ; 'fell in love!'
 	ld hl, FellInLoveText
@@ -9474,10 +9477,10 @@
 .asm_37889
 	ld a, [$d265]
 	and a
-	jp z, Function37e77
+	jp z, AnimateFailedMove
 	ld a, [AttackMissed]
 	and a
-	jp nz, Function37e77
+	jp nz, AnimateFailedMove
 	push bc
 	call BattleRandom
 	ld b, a
@@ -9503,7 +9506,7 @@
 	pop bc
 	ld a, $3
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	call SwitchTurn
 	ld hl, AICheckPlayerMaxHP
 	ld a, [hBattleTurn]
@@ -9529,7 +9532,7 @@
 	call SwitchTurn
 	call Function37ed5
 	jr nc, .asm_37904 ; 378f9 $9
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, RefusedGiftText
 	call StdBattleTextBox
 .asm_37904
@@ -9589,11 +9592,11 @@
 	set 2, [hl]
 	ld a, $5
 	ld [de], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, CoveredByVeilText
 	jp StdBattleTextBox
 .asm_3795c
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37962
 
@@ -9678,74 +9681,81 @@
 	and a
 	jp nz, .Enemy
 
-	call Function37ae9
-	jp z, Function37aab
 
+; Need something to switch to
+	call CheckAnyOtherAlivePartyMons
+	jp z, FailedBatonPass
+
 	call UpdateBattleMonInParty
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld c, 50
 	call DelayFrames
 
+; Transition into switchmon menu
 	call Function1d6e
 	callba Function3d2f7
-	callba Function3d380
+
+	callba ForcePickSwitchMonInBattle
+
+; Return to battle scene
 	call ClearPalettes
 	callba Function3ed9f
 	call Function1c17
 	call ClearSprites
-
 	hlcoord 1, 0
 	lb bc, 4, 10
 	call ClearBox
-
 	ld b, 1
 	call GetSGBLayout
 	call Function32f9
 	call Function37a67
 
+; Mobile link battles handle entrances differently
 	callba Function3d2e0
 	jp c, EndMoveEffect
 
-	ld hl, Function3e459
+	ld hl, PassedBattleMonEntrance
 	call CallBattleCore
-	call Function37ab1
+
+	call ResetBatonPassStatus
 	ret
 
+
 .Enemy
+
+; Wildmons don't have anything to switch to
 	ld a, [IsInBattle]
 	dec a
-	jp z, Function37aab
+	jp z, FailedBatonPass
 
-	call Function37af6
-	jp z, Function37aab
+	call CheckAnyOtherAliveEnemyMons
+	jp z, FailedBatonPass
 
 	call UpdateEnemyMonInParty
-	call Function37e01
+	call AnimateCurrentMove
 	call Function37a82
 
+; Mobile link battles handle entrances differently
 	callba Function3d2e0
 	jp c, EndMoveEffect
 
+; Passed enemy PartyMon entrance
 	xor a
 	ld [$c718], a
-
 	ld hl, Function3d517
 	call CallBattleCore
-
 	ld hl, Function3d57a
 	call CallBattleCore
-
 	ld a, 1
 	ld [$d265], a
-
 	ld hl, Function3ecab
 	call CallBattleCore
 
-	ld hl, Function3dc23
+	ld hl, SpikesDamage
 	call CallBattleCore
 
-	jr Function37ab1
+	jr ResetBatonPassStatus
 ; 37a67
 
 
@@ -9758,20 +9768,17 @@
 	ld [$d0ec], a
 
 	call Function1d6e
-
 	ld hl, Function3e8e4
 	call CallBattleCore
-
 	call Function1c17
 
 	xor a
 	ld [$d0ec], a
-
 	ret
 ; 37a82
 
 
-Function37a82; 37a82
+Function37a82: ; 37a82
 	ld a, [InLinkBattle]
 	and a
 	ret z
@@ -9779,54 +9786,65 @@
 	call Function1d6e
 	ld hl, Function3e8e4
 	call CallBattleCore
+
 	ld a, [OTPartyCount]
-	add $4
+	add 4
 	ld b, a
 	ld a, [$d430]
-	cp $4
+	cp 4
 	jr c, .asm_37aa0
-
 	cp b
 	jr c, .asm_37aa8
 
 .asm_37aa0
 	ld a, [CurOTMon]
-	add $4
+	add 4
 	ld [$d430], a
 .asm_37aa8
-	jp $1c17
+	jp Function1c17
 ; 37aab
 
 
-Function37aab: ; 37aab
-	call Function37e77
+FailedBatonPass: ; 37aab
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37ab1
 
 
-Function37ab1: ; 37ab1
+ResetBatonPassStatus: ; 37ab1
+; Reset status changes that aren't passed by Baton Pass.
+
+; Nightmare isn't passed.
 	ld a, BATTLE_VARS_STATUS
 	call GetBattleVar
-	and 7
-	jr nz, .asm_37ac1
+	and SLP
+	jr nz, .ok
+
 	ld a, BATTLE_VARS_SUBSTATUS1
 	call _GetBattleVar
-	res 0, [hl]
+	res SUBSTATUS_NIGHTMARE, [hl]
+.ok
 
-.asm_37ac1
-	call Function372e7
+; Disable isn't passed.
+	call ResetActorDisable
+
+; Attraction isn't passed.
 	ld hl, PlayerSubStatus1
-	res 7, [hl]
+	res SUBSTATUS_IN_LOVE, [hl]
 	ld hl, EnemySubStatus1
-	res 7, [hl]
+	res SUBSTATUS_IN_LOVE, [hl]
 	ld hl, PlayerSubStatus5
+
 	ld a, BATTLE_VARS_SUBSTATUS5
 	call _GetBattleVar
 	res 3, [hl]
 	res 4, [hl]
+
+; New mon hasn't used a move yet.
 	ld a, BATTLE_VARS_LAST_MOVE
 	call _GetBattleVar
 	ld [hl], 0
+
 	xor a
 	ld [$c730], a
 	ld [$c731], a
@@ -9834,17 +9852,17 @@
 ; 37ae9
 
 
-Function37ae9: ; 37ae9
+CheckAnyOtherAlivePartyMons: ; 37ae9
 	ld hl, PartyMon1CurHP
 	ld a, [PartyCount]
 	ld d, a
 	ld a, [CurBattleMon]
 	ld e, a
-	jr Function37b01
+	jr CheckAnyOtherAliveMons
 ; 37af6
 
 
-Function37af6: ; 37af6
+CheckAnyOtherAliveEnemyMons: ; 37af6
 	ld hl, OTPartyMon1CurHP
 	ld a, [OTPartyCount]
 	ld d, a
@@ -9854,17 +9872,21 @@
 	; fallthrough
 ; 37b01
 
-Function37b01: ; 37b01
+CheckAnyOtherAliveMons: ; 37b01
+; Check for nonzero HP starting from partymon
+; HP at hl for d partymons, besides current mon e.
+
+; Return nz if any are alive.
+
 	xor a
 	ld b, a
 	ld c, a
-.asm_37b04
+.loop
 	ld a, c
 	cp d
-	jr z, .asm_37b1a
-
+	jr z, .done
 	cp e
-	jr z, .asm_37b11
+	jr z, .next
 
 	ld a, [hli]
 	or b
@@ -9872,15 +9894,16 @@
 	ld a, [hld]
 	or b
 	ld b, a
-.asm_37b11
+
+.next
 	push bc
-	ld bc, $30
+	ld bc, PartyMon2 - PartyMon1
 	add hl, bc
 	pop bc
 	inc c
-	jr .asm_37b04
+	jr .loop
 
-.asm_37b1a
+.done
 	ld a, b
 	and a
 	ret
@@ -10021,7 +10044,7 @@
 	ld a, BANK(GetMaxHP)
 	rst FarCall
 
-	call Function37e01
+	call AnimateCurrentMove
 	call SwitchTurn
 
 	callab Function3ccef
@@ -10034,7 +10057,7 @@
 	jp StdBattleTextBox
 
 .Full
-	call Function37e77
+	call AnimateFailedMove
 
 ; 'hp is full!'
 	ld hl, HPIsFullText
@@ -10065,7 +10088,7 @@
 	ld [Weather], a
 	ld a, 5
 	ld [WeatherCount], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, DownpourText
 	jp StdBattleTextBox
 ; 37c07
@@ -10077,7 +10100,7 @@
 	ld [Weather], a
 	ld a, 5
 	ld [WeatherCount], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, SunGotBrightText
 	jp StdBattleTextBox
 ; 37c1a
@@ -10096,7 +10119,7 @@
 	jr nc, .asm_37c4f
 
 	push bc
-	call Function37e01
+	call AnimateCurrentMove
 	pop bc
 	callab Function3cc3f
 	call UpdateUserInParty
@@ -10112,7 +10135,7 @@
 	ld hl, BellyDrumText
 	jp StdBattleTextBox
 .asm_37c4f
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37c55
 
@@ -10139,7 +10162,7 @@
 	dec b
 	jr nz, .asm_37c67 ; 37c6d $f8
 	pop hl
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 .asm_37c76
 	pop hl
@@ -10158,7 +10181,7 @@
 .asm_37c89
 	call Function365fd
 .asm_37c8c
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, CopiedStatsText
 	jp StdBattleTextBox
 ; 37c95
@@ -10328,7 +10351,7 @@
 .asm_37d87
 	pop bc
 	call ResetDamage
-	call Function37e77
+	call AnimateFailedMove
 	call PrintButItFailed
 	jp EndMoveEffect
 ; 37d94
@@ -10427,7 +10450,7 @@
 ; 37e01
 
 
-Function37e01: ; 37e01
+AnimateCurrentMove: ; 37e01
 	push hl
 	push de
 	push bc
@@ -10533,7 +10556,7 @@
 ; 37e77
 
 
-Function37e77: ; 37e77
+AnimateFailedMove: ; 37e77
 	call BattleCommand0a
 	call BattleCommandaa
 	jp BattleCommand0c
--- a/battle/effects/curse.asm
+++ b/battle/effects/curse.asm
@@ -41,7 +41,7 @@
 
 	ld a, $1
 	ld [$c689], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld a, $2
 	call Function36532
 	call SwitchTurn
@@ -71,7 +71,7 @@
 	jr nz, .failed
 
 	set 1, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, GetHalfMaxHP
 	call CallBattleCore
 	ld hl, Function3cc3f
@@ -81,7 +81,7 @@
 	jp StdBattleTextBox
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 
 
@@ -91,7 +91,7 @@
 
 	ld b, $8 ; ABILITY
 	call GetStatName
-	call Function37e77
+	call AnimateFailedMove
 	ld hl, WontRiseAnymoreText
 	jp StdBattleTextBox
 ; 37618
--- a/battle/effects/endure.asm
+++ b/battle/effects/endure.asm
@@ -10,7 +10,7 @@
 	call _GetBattleVar
 	set SUBSTATUS_ENDURE, [hl]
 
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, BracedItselfText
 	jp StdBattleTextBox
--- a/battle/effects/foresight.asm
+++ b/battle/effects/foresight.asm
@@ -14,7 +14,7 @@
 	jr nz, .failed
 
 	set SUBSTATUS_IDENTIFIED, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, IdentifiedText
 	jp StdBattleTextBox
 
--- a/battle/effects/mirror_move.asm
+++ b/battle/effects/mirror_move.asm
@@ -15,7 +15,7 @@
 	jr nz, .use
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 
 	ld hl, MirrorMoveFailedText
 	call StdBattleTextBox
--- a/battle/effects/nightmare.asm
+++ b/battle/effects/nightmare.asm
@@ -28,12 +28,12 @@
 ; Otherwise give the opponent a nightmare.
 
 	set SUBSTATUS_NIGHTMARE, [hl]
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, StartedNightmareText
 	jp StdBattleTextBox
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37563
 
--- a/battle/effects/perish_song.asm
+++ b/battle/effects/perish_song.asm
@@ -30,12 +30,12 @@
 	ld [EnemyPerishCount], a
 
 .done
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, StartPerishText
 	jp StdBattleTextBox
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 376f8
 
--- a/battle/effects/protect.asm
+++ b/battle/effects/protect.asm
@@ -7,7 +7,7 @@
 	call _GetBattleVar
 	set SUBSTATUS_PROTECT, [hl]
 
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, ProtectedItselfText
 	jp StdBattleTextBox
@@ -73,7 +73,7 @@
 .failed
 	xor a
 	ld [de], a
-	call Function37e77
+	call AnimateFailedMove
 	call PrintButItFailed
 	scf
 	ret
--- a/battle/effects/sandstorm.asm
+++ b/battle/effects/sandstorm.asm
@@ -9,12 +9,12 @@
 	ld [Weather], a
 	ld a, 5
 	ld [WeatherCount], a
-	call Function37e01
+	call AnimateCurrentMove
 	ld hl, SandstormBrewedText
 	jp StdBattleTextBox
 
 .failed
-	call Function37e77
+	call AnimateFailedMove
 	jp PrintButItFailed
 ; 37718
 
--- a/battle/effects/spikes.asm
+++ b/battle/effects/spikes.asm
@@ -17,7 +17,7 @@
 
 	set SCREENS_SPIKES, [hl]
 
-	call Function37e01
+	call AnimateCurrentMove
 
 	ld hl, SpikesText
 	jp StdBattleTextBox
--- a/main.asm
+++ b/main.asm
@@ -36789,7 +36789,7 @@
 	xor a
 	call ByteFill
 
-	callab Function3d867
+	callab ResetEnemyStatLevels
 
 	call Function1fbf
 
@@ -37438,8 +37438,8 @@
 .asm_384a3
 	ld a, $1
 	ld [$d264], a
-	callab Function3d834
-	callab Function3d867
+	callab NewEnemyMonStatus
+	callab ResetEnemyStatLevels
 	ld hl, PlayerSubStatus1
 	res 7, [hl]
 	callba Function3d4e1