More consistent formatting

This commit is contained in:
Rangi 2019-03-03 19:55:28 -05:00
parent 9e9f43bce7
commit 6393ecb7e5
2 changed files with 36 additions and 11 deletions

View File

@ -247,30 +247,37 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
([Video](https://twitter.com/crystal_rby/status/874626362287562752)) ([Video](https://twitter.com/crystal_rby/status/874626362287562752))
**Fix:** Edit the end of [hram.asm](/hram.asm) to create a new temporary variable: **Fix:**
First, edit [hram.asm](/hram.asm):
```diff ```diff
hClockResetTrigger:: db ; ffeb hClockResetTrigger:: db ; ffeb
+hIsConfusionDamage:: db ; ffec +hIsConfusionDamage:: db ; ffec
``` ```
Then edit `HitSelfInConfusion` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm): Then edit four routines in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```diff ```diff
HitSelfInConfusion:
...
call TruncateHL_BC
ld d, 40
pop af pop af
ld e, a ld e, a
+ ld a, 1 + ld a, TRUE
+ ldh [hIsConfusionDamage], a + ldh [hIsConfusionDamage], a
ret ret
``` ```
Then, in the same file, edit `BattleCommand_DamageCalc`:
```diff ```diff
BattleCommand_DamageCalc:
; damagecalc
...
.skip_zero_damage_check .skip_zero_damage_check
+ xor a ; Not confusion damage + xor a ; Not confusion damage
+ ldh [hIsConfusionDamage], a + ldh [hIsConfusionDamage], a
+ ; fallthrough
+ +
+ConfusionDamageCalc: +ConfusionDamageCalc:
; Minimum defense value is 1. ; Minimum defense value is 1.
@ -279,28 +286,44 @@ Then, in the same file, edit `BattleCommand_DamageCalc`:
jr nz, .not_dividing_by_zero jr nz, .not_dividing_by_zero
ld c, 1 ld c, 1
.not_dividing_by_zero .not_dividing_by_zero
```
```diff ...
; Item boosts ; Item boosts
+
+; Item boosts don't apply to confusion damage
+ ldh a, [hIsConfusionDamage] + ldh a, [hIsConfusionDamage]
+ and a + and a
+ jr nz, .DoneItem ; Item boosts don't apply to confusion damage + jr nz, .DoneItem
+
call GetUserItem call GetUserItem
...
``` ```
Finally, replace the calls in `CheckEnemyTurn` and `HitConfusion`, still in the same file:
```diff ```diff
CheckEnemyTurn:
...
ld hl, HurtItselfText ld hl, HurtItselfText
call StdBattleTextBox call StdBattleTextBox
call HitSelfInConfusion call HitSelfInConfusion
- call BattleCommand_DamageCalc - call BattleCommand_DamageCalc
+ call ConfusionDamageCalc + call ConfusionDamageCalc
call BattleCommand_LowerSub call BattleCommand_LowerSub
...
``` ```
```diff ```diff
HitConfusion:
ld hl, HurtItselfText
call StdBattleTextBox
xor a
ld [wCriticalHit], a
call HitSelfInConfusion call HitSelfInConfusion
- call BattleCommand_DamageCalc - call BattleCommand_DamageCalc
+ call ConfusionDamageCalc + call ConfusionDamageCalc

View File

@ -504,9 +504,11 @@ CheckEnemyTurn:
ld hl, HurtItselfText ld hl, HurtItselfText
call StdBattleTextBox call StdBattleTextBox
call HitSelfInConfusion call HitSelfInConfusion
call BattleCommand_DamageCalc call BattleCommand_DamageCalc
call BattleCommand_LowerSub call BattleCommand_LowerSub
xor a xor a
ld [wNumHits], a ld [wNumHits], a