shithub: pokecrystal

Download patch

ref: d4025863cf56466b79827bace6d6b3e48ffd05e9
parent: 2958188fc6d1ea8d9a5c2d4f0d5a4e3d6ca8faaa
author: mid-kid <[email protected]>
date: Wed Apr 4 19:27:40 EDT 2018

Rename some battle commands

`hittarget` was misleading, as it doesn't actually "hit" the target, it
only plays the animation. As such, I've renamed it to `moveanim`.

`checkfaint` has nothing to do with checking if the user or target has
fainted, instead, it applies wCurDamage onto the target's HP, hitting
the substitute if applicable. I've renamed the command to `applydamage`
and all of its subfunctions accordingly.

--- a/data/battle/effect_command_pointers.asm
+++ b/data/battle/effect_command_pointers.asm
@@ -14,10 +14,10 @@
 	dw BattleCommand_DamageVariation ; 34cfd
 	dw BattleCommand_CheckHit ; 34d32
 	dw BattleCommand_LowerSub ; 34eee
-	dw BattleCommand_HitTargetNoSub ; 34f60
+	dw BattleCommand_MoveAnimNoSub ; 34f60
 	dw BattleCommand_RaiseSub ; 35004
 	dw BattleCommand_FailureText ; 35023
-	dw BattleCommand_CheckFaint ; 3505e
+	dw BattleCommand_ApplyDamage ; 3505e
 	dw BattleCommand_CriticalText ; 35175
 	dw BattleCommand_SuperEffectiveText ; 351ad
 	dw BattleCommand_CheckDestinyBond ; 351c0
@@ -174,7 +174,7 @@
 	dw BattleCommand_BeatUpFailText ; 355b5
 	dw BattleCommand_ClearMissDamage ; 355d5 - a9
 	dw BattleCommand_MoveDelay ; 37e80
-	dw BattleCommand_HitTarget ; 34f57
+	dw BattleCommand_MoveAnim ; 34f57
 	dw BattleCommand_TriStatusChance ; 3658f
 	dw BattleCommand_SuperEffectiveLoopText ; 351a5
 	dw BattleCommand_StartLoop ; 35197
--- a/data/moves/effects.asm
+++ b/data/moves/effects.asm
@@ -10,9 +10,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -40,9 +40,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -60,9 +60,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	draintarget
@@ -82,9 +82,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -103,9 +103,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -124,9 +124,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -145,9 +145,9 @@
 	damagevariation
 	checkhit
 	selfdestruct
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -165,9 +165,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	eatdream
@@ -544,9 +544,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -566,9 +566,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -589,9 +589,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -611,9 +611,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -633,9 +633,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -655,9 +655,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -677,9 +677,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -699,9 +699,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -721,9 +721,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -743,9 +743,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -763,9 +763,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	payday
@@ -796,9 +796,9 @@
 	unleashenergy
 	resettypematchup
 	checkhit
-	hittarget
+	moveanim
 	bidefailtext
-	checkfaint
+	applydamage
 	checkdestinybond
 	buildopponentrage
 	kingsrock
@@ -817,9 +817,9 @@
 	stab
 	damagevariation
 	clearmissdamage
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -848,9 +848,9 @@
 	stab
 	damagevariation
 	clearmissdamage
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	cleartext
 	supereffectivelooptext
@@ -875,9 +875,9 @@
 	stab
 	damagevariation
 	clearmissdamage
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	cleartext
 	supereffectivelooptext
@@ -900,9 +900,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -916,9 +916,9 @@
 	doturn
 	stab
 	ohko
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -935,9 +935,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	recoil
@@ -980,9 +980,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1022,9 +1022,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1066,9 +1066,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1094,9 +1094,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	rechargenextturn
@@ -1115,10 +1115,10 @@
 	checkhit
 	ragedamage
 	damagevariation
-	hittarget
+	moveanim
 	failuretext
 	rage
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1176,9 +1176,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1198,10 +1198,10 @@
 	stab
 	damagevariation
 	checkhit
-	hittargetnosub
+	moveanimnosub
 	raisesub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1220,9 +1220,9 @@
 	stab
 	damagevariation
 	clearmissdamage
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1239,9 +1239,9 @@
 	constantdamage
 	checkhit
 	resettypematchup
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	checkdestinybond
 	buildopponentrage
 	kingsrock
@@ -1254,9 +1254,9 @@
 	constantdamage
 	stab
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	supereffectivetext
 	checkdestinybond
 	buildopponentrage
@@ -1268,9 +1268,9 @@
 	usedmovetext
 	doturn
 	counter
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	checkdestinybond
 	buildopponentrage
 	kingsrock
@@ -1304,9 +1304,9 @@
 	checkhit
 	effectchance
 	snore
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1378,9 +1378,9 @@
 	damagevariation
 	falseswipe
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1409,9 +1409,9 @@
 	stab
 	damagevariation
 	clearmissdamage
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	cleartext
 	supereffectivelooptext
@@ -1434,9 +1434,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	thief
@@ -1470,9 +1470,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	defrost
@@ -1543,9 +1543,9 @@
 	checkhit
 	rolloutpower
 	damagevariation
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1582,9 +1582,9 @@
 	checkhit
 	furycutter
 	damagevariation
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1611,9 +1611,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1634,7 +1634,7 @@
 	damagevariation
 	clearmissdamage
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1653,9 +1653,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1681,9 +1681,9 @@
 	damagevariation
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	defrost
@@ -1704,9 +1704,9 @@
 	damagevariation
 	checkhit
 	doubleundergrounddamage
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1732,9 +1732,9 @@
 	damagevariation
 	pursuit
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1752,9 +1752,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	clearhazards
@@ -1794,9 +1794,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1824,7 +1824,7 @@
 	doturn
 	checkhit
 	fakeout
-	hittarget
+	moveanim
 	failuretext
 	endmove
 
@@ -1847,9 +1847,9 @@
 	usedmovetext
 	doturn
 	mirrorcoat
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	checkdestinybond
 	buildopponentrage
 	kingsrock
@@ -1867,9 +1867,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1892,9 +1892,9 @@
 	doubleflyingdamage
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1914,9 +1914,9 @@
 	doubleundergrounddamage
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1933,9 +1933,9 @@
 	futuresight
 	damagevariation ; skip here if last turn
 	checkhit
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	checkdestinybond
 	buildopponentrage
 	endmove
@@ -1951,9 +1951,9 @@
 	damagevariation
 	doubleflyingdamage
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1972,9 +1972,9 @@
 	doubleminimizedamage
 	checkhit
 	effectchance
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -1995,9 +1995,9 @@
 	stab
 	damagevariation
 	checkhit
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -2017,9 +2017,9 @@
 	effectchance
 	stab
 	damagevariation
-	hittarget
+	moveanim
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	supereffectivetext
 	checkdestinybond
@@ -2047,9 +2047,9 @@
 	damagecalc
 	damagevariation
 	clearmissdamage
-	hittargetnosub
+	moveanimnosub
 	failuretext
-	checkfaint
+	applydamage
 	criticaltext
 	cleartext
 	supereffectivetext
--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -556,8 +556,8 @@
 	and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
 	call z, PlayFXAnimID
 
-	ld c, $1
-	call EnemyHurtItself
+	ld c, TRUE
+	call DoEnemyDamage
 	call BattleCommand_RaiseSub
 	call CantMove
 	jp EndTurn
@@ -676,8 +676,8 @@
 	call CallBattleCore
 	ld a, $1
 	ld [hBGMapMode], a
-	ld c, $1
-	call PlayerHurtItself
+	ld c, TRUE
+	call DoPlayerDamage
 	jp BattleCommand_RaiseSub
 
 ; 343db
@@ -2081,16 +2081,16 @@
 ; 34f57
 
 
-BattleCommand_HitTarget: ; 34f57
-; hittarget
+BattleCommand_MoveAnim: ; 34f57
+; moveanim
 	call BattleCommand_LowerSub
-	call BattleCommand_HitTargetNoSub
+	call BattleCommand_MoveAnimNoSub
 	jp BattleCommand_RaiseSub
 
 ; 34f60
 
 
-BattleCommand_HitTargetNoSub: ; 34f60
+BattleCommand_MoveAnimNoSub: ; 34f60
 	ld a, [wAttackMissed]
 	and a
 	jp nz, BattleCommand_MoveDelay
@@ -2274,44 +2274,47 @@
 ; 3505e
 
 
-BattleCommand_CheckFaint: ; 3505e
-; checkfaint
+BattleCommand_ApplyDamage: ; 3505e
+; applydamage
 
 	ld a, BATTLE_VARS_SUBSTATUS1_OPP
 	call GetBattleVar
 	bit SUBSTATUS_ENDURE, a
-	jr z, .not_enduring
+	jr z, .focus_band
+
 	call BattleCommand_FalseSwipe
-	ld b, $0
-	jr nc, .okay
-	ld b, $1
-	jr .okay
+	ld b, 0
+	jr nc, .damage
+	ld b, 1
+	jr .damage
 
-.not_enduring
+.focus_band
 	call GetOpponentItem
 	ld a, b
 	cp HELD_FOCUS_BAND
-	ld b, $0
-	jr nz, .okay
+	ld b, 0
+	jr nz, .damage
+
 	call BattleRandom
 	cp c
-	jr nc, .okay
+	jr nc, .damage
 	call BattleCommand_FalseSwipe
-	ld b, $0
-	jr nc, .okay
-	ld b, $2
-.okay
+	ld b, 0
+	jr nc, .damage
+	ld b, 2
+
+.damage
 	push bc
-	call .check_sub
-	ld c, $0
+	call .update_damage_taken
+	ld c, FALSE
 	ld a, [hBattleTurn]
 	and a
 	jr nz, .damage_player
-	call EnemyHurtItself
+	call DoEnemyDamage
 	jr .done_damage
 
 .damage_player
-	call PlayerHurtItself
+	call DoPlayerDamage
 
 .done_damage
 	pop bc
@@ -2318,21 +2321,21 @@
 	ld a, b
 	and a
 	ret z
+
 	dec a
-	jr nz, .not_enduring2
+	jr nz, .focus_band_text
 	ld hl, EnduredText
 	jp StdBattleTextBox
 
-.not_enduring2
+.focus_band_text
 	call GetOpponentItem
 	ld a, [hl]
 	ld [wNamedObjectIndexBuffer], a
 	call GetItemName
-
 	ld hl, HungOnText
 	jp StdBattleTextBox
 
-.check_sub
+.update_damage_taken
 	ld a, BATTLE_VARS_SUBSTATUS4_OPP
 	call GetBattleVar
 	bit SUBSTATUS_SUBSTITUTE, a
@@ -2341,10 +2344,10 @@
 	ld de, wPlayerDamageTaken + 1
 	ld a, [hBattleTurn]
 	and a
-	jr nz, .damage_taken
+	jr nz, .got_damage_taken
 	ld de, wEnemyDamageTaken + 1
 
-.damage_taken
+.got_damage_taken
 	ld a, [wCurDamage + 1]
 	ld b, a
 	ld a, [de]
@@ -2418,11 +2421,11 @@
 	ld a, $1
 	ld [wKickCounter], a
 	call LoadMoveAnim
-	ld c, $1
+	ld c, TRUE
 	ld a, [hBattleTurn]
 	and a
-	jp nz, EnemyHurtItself
-	jp PlayerHurtItself
+	jp nz, DoEnemyDamage
+	jp DoPlayerDamage
 
 FailText_CheckOpponentProtect: ; 35157
 	ld a, BATTLE_VARS_SUBSTATUS1_OPP
@@ -3620,15 +3623,13 @@
 
 	ld c, 3
 	call DelayFrames
-
 	callfar PlayBattleAnim
-
 	ret
 
 ; 35d1c
 
 
-EnemyHurtItself: ; 35d1c
+DoEnemyDamage: ; 35d1c
 	ld hl, wCurDamage
 	ld a, [hli]
 	ld b, a
@@ -3638,13 +3639,14 @@
 
 	ld a, c
 	and a
-	jr nz, .mimic_sub_check
-
+	jr nz, .ignore_substitute
 	ld a, [wEnemySubStatus4]
 	bit SUBSTATUS_SUBSTITUTE, a
-	jp nz, SelfInflictDamageToSubstitute
+	jp nz, DoSubstituteDamage
 
-.mimic_sub_check
+.ignore_substitute
+	; Substract wCurDamage from wEnemyMonHP.
+	;  store original HP in little endian wBuffer3/4
 	ld a, [hld]
 	ld b, a
 	ld a, [wEnemyMonHP + 1]
@@ -3657,19 +3659,18 @@
 	ld [wBuffer4], a
 	sbc b
 	ld [wEnemyMonHP], a
-	jr nc, .mimic_faint
+	jr nc, .no_underflow
 
 	ld a, [wBuffer4]
 	ld [hli], a
 	ld a, [wBuffer3]
 	ld [hl], a
-
 	xor a
 	ld hl, wEnemyMonHP
 	ld [hli], a
 	ld [hl], a
 
-.mimic_faint
+.no_underflow
 	ld hl, wEnemyMonMaxHP
 	ld a, [hli]
 	ld [wBuffer2], a
@@ -3680,6 +3681,7 @@
 	ld [wBuffer6], a
 	ld a, [hl]
 	ld [wBuffer5], a
+
 	hlcoord 2, 2
 	xor a
 	ld [wWhichHPBar], a
@@ -3690,7 +3692,7 @@
 ; 35d7e
 
 
-PlayerHurtItself: ; 35d7e
+DoPlayerDamage: ; 35d7e
 	ld hl, wCurDamage
 	ld a, [hli]
 	ld b, a
@@ -3700,12 +3702,15 @@
 
 	ld a, c
 	and a
-	jr nz, .mimic_sub_check
-
+	jr nz, .ignore_substitute
 	ld a, [wPlayerSubStatus4]
 	bit SUBSTATUS_SUBSTITUTE, a
-	jp nz, SelfInflictDamageToSubstitute
-.mimic_sub_check
+	jp nz, DoSubstituteDamage
+
+.ignore_substitute
+	; Substract wCurDamage from wBattleMonHP.
+	;  store original HP in little endian wBuffer3/4
+	;  store new HP in little endian wBuffer5/6
 	ld a, [hld]
 	ld b, a
 	ld a, [wBattleMonHP + 1]
@@ -3719,7 +3724,7 @@
 	sbc b
 	ld [wBattleMonHP], a
 	ld [wBuffer6], a
-	jr nc, .mimic_faint
+	jr nc, .no_underflow
 
 	ld a, [wBuffer4]
 	ld [hli], a
@@ -3726,7 +3731,6 @@
 	ld a, [wBuffer3]
 	ld [hl], a
 	xor a
-
 	ld hl, wBattleMonHP
 	ld [hli], a
 	ld [hl], a
@@ -3734,14 +3738,15 @@
 	ld [hli], a
 	ld [hl], a
 
-.mimic_faint
+.no_underflow
 	ld hl, wBattleMonMaxHP
 	ld a, [hli]
 	ld [wBuffer2], a
 	ld a, [hl]
 	ld [wBuffer1], a
+
 	hlcoord 10, 9
-	ld a, $1
+	ld a, 1
 	ld [wWhichHPBar], a
 	predef AnimateHPBar
 .did_no_damage
@@ -3750,8 +3755,7 @@
 ; 35de0
 
 
-SelfInflictDamageToSubstitute: ; 35de0
-
+DoSubstituteDamage: ; 35de0
 	ld hl, SubTookDamageText
 	call StdBattleTextBox
 
--- a/engine/battle/move_effects/false_swipe.asm
+++ b/engine/battle/move_effects/false_swipe.asm
@@ -1,6 +1,8 @@
 BattleCommand_FalseSwipe: ; 35c94
 ; falseswipe
 
+; Makes sure wCurDamage < MonHP
+
 	ld hl, wEnemyMonHP
 	ld a, [hBattleTurn]
 	and a
@@ -15,6 +17,7 @@
 	pop de
 	pop hl
 	jr c, .done
+
 	ld a, [hli]
 	ld [de], a
 	inc de
@@ -21,6 +24,7 @@
 	ld a, [hl]
 	dec a
 	ld [de], a
+
 	inc a
 	jr nz, .okay
 	dec de
@@ -28,11 +32,13 @@
 	dec a
 	ld [de], a
 .okay
+
 	ld a, [wCriticalHit]
 	cp 2
 	jr nz, .carry
 	xor a
 	ld [wCriticalHit], a
+
 .carry
 	scf
 	ret
--- a/macros/scripts/battle_commands.asm
+++ b/macros/scripts/battle_commands.asm
@@ -15,10 +15,10 @@
 	command damagevariation         ; 08
 	command checkhit                ; 09
 	command lowersub                ; 0a
-	command hittargetnosub          ; 0b
+	command moveanimnosub           ; 0b
 	command raisesub                ; 0c
 	command failuretext             ; 0d
-	command checkfaint              ; 0e
+	command applydamage             ; 0e
 	command criticaltext            ; 0f
 	command supereffectivetext      ; 10
 	command checkdestinybond        ; 11
@@ -175,7 +175,7 @@
 	command beatupfailtext          ; a8
 	command clearmissdamage         ; a9
 	command movedelay               ; aa
-	command hittarget               ; ab
+	command moveanim                ; ab
 	command tristatuschance         ; ac
 	command supereffectivelooptext  ; ad
 	command startloop               ; ae