shithub: pokecrystal

Download patch

ref: 2e147d1128b024e970e81b1cb1e188fdd1fe6712
parent: f5cd6341fffddc4d244ea60df4b2c23e70d6041e
author: mid-kid <esteve.varela@gmail.com>
date: Thu Aug 16 12:11:28 EDT 2018

GetDamageStatsCritical -> CheckDamageStatsCritical

Clarified its usage, as the comments surrounding it were factually
wrong.

--- a/engine/battle/effect_commands.asm
+++ b/engine/battle/effect_commands.asm
@@ -2594,7 +2594,7 @@
 
 .physicalcrit
 	ld hl, wBattleMonAttack
-	call GetDamageStatsCritical
+	call CheckDamageStatsCritical
 	jr c, .thickclub
 
 	ld hl, wEnemyDefense
@@ -2618,7 +2618,7 @@
 
 .specialcrit
 	ld hl, wBattleMonSpclAtk
-	call GetDamageStatsCritical
+	call CheckDamageStatsCritical
 	jr c, .lightball
 
 	ld hl, wEnemySpDef
@@ -2692,8 +2692,10 @@
 	ld b, l
 	ret
 
-GetDamageStatsCritical:
-; Return carry if non-critical.
+CheckDamageStatsCritical:
+; Return carry if boosted stats should be used in damage calculations.
+; Unboosted stats should be used if the attack is a critical hit,
+;  and the stage of the opponent's defense is higher than the user's attack.
 
 	ld a, [wCriticalHit]
 	and a
@@ -2700,12 +2702,6 @@
 	scf
 	ret z
 
-	; fallthrough
-
-GetDamageStats:
-; Return the attacker's offensive stat and the defender's defensive
-; stat based on whether the attacking type is physical or special.
-
 	push hl
 	push bc
 	ld a, [hBattleTurn]
@@ -2840,7 +2836,7 @@
 
 .physicalcrit
 	ld hl, wEnemyMonAttack
-	call GetDamageStatsCritical
+	call CheckDamageStatsCritical
 	jr c, .thickclub
 
 	ld hl, wPlayerDefense
@@ -2864,7 +2860,7 @@
 
 .specialcrit
 	ld hl, wEnemyMonSpclAtk
-	call GetDamageStatsCritical
+	call CheckDamageStatsCritical
 	jr c, .lightball
 	ld hl, wPlayerSpDef
 	ld a, [hli]