diff options
author | Idain <luiscarlosholguinperez@outlook.com> | 2022-01-24 21:48:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-24 20:48:21 -0500 |
commit | e9494770894c0504a21e1e130ef51f1d97accaf8 (patch) | |
tree | 6bedec8fd85af6e5896be6c2aa607a0f8aed6ffc | |
parent | 1dc88cb5854a15337997c6236aed01021a9d46f7 (diff) |
Document Return/Frustration bug and its fix (#872)
Co-authored-by: Rangi <35663410+Rangi42@users.noreply.github.com>
-rw-r--r-- | docs/bugs_and_glitches.md | 48 | ||||
-rw-r--r-- | engine/battle/move_effects/frustration.asm | 5 |
2 files changed, 50 insertions, 3 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index bf3a89068..369c5c6be 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -34,6 +34,7 @@ Fixes in the [multi-player battle engine](#multi-player-battle-engine) category - [Beat Up may fail to raise Substitute](#beat-up-may-fail-to-raise-substitute) - [Beat Up may trigger King's Rock even if it failed](#beat-up-may-trigger-kings-rock-even-if-it-failed) - [Present damage is incorrect in link battles](#present-damage-is-incorrect-in-link-battles) + - [Return and Frustration deal no damage when the user's happiness is low or high, respectively](#return-and-frustration-deal-no-damage-when-the-users-happiness-is-low-or-high-respectively) - [Dragon Scale, not Dragon Fang, boosts Dragon-type moves](#dragon-scale-not-dragon-fang-boosts-dragon-type-moves) - [Switching out or switching against a Pokémon with max HP below 4 freezes the game](#switching-out-or-switching-against-a-pokémon-with-max-HP-below-4-freezes-the-game) - [Moves that do damage and increase your stats do not increase stats after a KO](#moves-that-do-damage-and-increase-your-stats-do-not-increase-stats-after-a-ko) @@ -700,6 +701,53 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing ``` +## Return and Frustration deal no damage when the user's happiness is low or high, respectively + +This happens because the user's happiness (or 255 − happiness for Frustration) is multiplied by 10 and divided by 25, which rounds down to zero when the happiness is 0–2 (or 253–255 for Frustration). + +**Fix:** + +Edit [engine/battle/move_effects/return.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/return.asm): + +```diff + BattleCommand_HappinessPower: + ... + call Multiply + ld a, 25 + ldh [hDivisor], a + ld b, 4 + call Divide + ldh a, [hQuotient + 3] ++ and a ++ jr nz, .done ++ inc a ++.done + ld d, a + pop bc + ret +``` + +And edit [engine/battle/move_effects/frustration.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/frustration.asm): + +```diff + BattleCommand_FrustrationPower: + ... + call Multiply + ld a, 25 + ldh [hDivisor], a + ld b, 4 + call Divide + ldh a, [hQuotient + 3] ++ and a ++ jr nz, .done ++ inc a ++.done + ld d, a + pop bc + ret +``` + + ### Dragon Scale, not Dragon Fang, boosts Dragon-type moves **Fix:** Edit `ItemAttributes` in [data/items/attributes.asm](https://github.com/pret/pokecrystal/blob/master/data/items/attributes.asm): diff --git a/engine/battle/move_effects/frustration.asm b/engine/battle/move_effects/frustration.asm index b07942c76..b8f5529a2 100644 --- a/engine/battle/move_effects/frustration.asm +++ b/engine/battle/move_effects/frustration.asm @@ -1,13 +1,12 @@ BattleCommand_FrustrationPower: ; frustrationpower - push bc ld hl, wBattleMonHappiness ldh a, [hBattleTurn] and a - jr z, .got_happiness + jr z, .ok ld hl, wEnemyMonHappiness -.got_happiness +.ok ld a, $ff sub [hl] ldh [hMultiplicand + 2], a |