Document a bugfix: 1/256 failure rate for 100% effect chance

This commit is contained in:
Rangi 2019-01-05 20:29:45 -05:00
parent 3650232398
commit 5207615cdc
2 changed files with 32 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Fixes are written in the `diff` format. If you've used Git before, this should l
- [Thick Club and Light Ball can make (Special) Attack wrap around above 1024](#thick-club-and-light-ball-can-make-special-attack-wrap-around-above-1024) - [Thick Club and Light Ball can make (Special) Attack wrap around above 1024](#thick-club-and-light-ball-can-make-special-attack-wrap-around-above-1024)
- [Metal Powder can increase damage taken with boosted (Special) Defense](#metal-powder-can-increase-damage-taken-with-boosted-special-defense) - [Metal Powder can increase damage taken with boosted (Special) Defense](#metal-powder-can-increase-damage-taken-with-boosted-special-defense)
- [Reflect and Light Screen can make (Special) Defense wrap around above 1024](#reflect-and-light-screen-can-make-special-defense-wrap-around-above-1024) - [Reflect and Light Screen can make (Special) Defense wrap around above 1024](#reflect-and-light-screen-can-make-special-defense-wrap-around-above-1024)
- [Moves with a 100% secondary effect chance will not trigger it in 1/256 uses](#moves-with-a-100-secondary-effect-chance-will-not-trigger-it-in-1256-uses)
- [Belly Drum sharply boosts Attack even with under 50% HP](#belly-drum-sharply-boosts-attack-even-with-under-50-hp) - [Belly Drum sharply boosts Attack even with under 50% HP](#belly-drum-sharply-boosts-attack-even-with-under-50-hp)
- [Confusion damage is affected by type-boosting items and Explosion/Self-Destruct doubling](#confusion-damage-is-affected-by-type-boosting-items-and-explosionself-destruct-doubling) - [Confusion damage is affected by type-boosting items and Explosion/Self-Destruct doubling](#confusion-damage-is-affected-by-type-boosting-items-and-explosionself-destruct-doubling)
- [Moves that lower Defense can do so after breaking a Substitute](#moves-that-lower-defense-can-do-so-after-breaking-a-substitute) - [Moves that lower Defense can do so after breaking a Substitute](#moves-that-lower-defense-can-do-so-after-breaking-a-substitute)
@ -161,6 +162,35 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
(This fix also affects Thick Club, Light Ball, and Metal Powder, as described above, but their specific fixes in the above bugs allow more accurate damage calculations.) (This fix also affects Thick Club, Light Ball, and Metal Powder, as described above, but their specific fixes in the above bugs allow more accurate damage calculations.)
## Moves with a 100% secondary effect chance will not trigger it in 1/256 uses
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
([Video](https://www.youtube.com/watch?v=mHkyO5T5wZU&t=206))
**Fix:** Edit `BattleCommand_EffectChance` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```diff
- ; BUG: 1/256 chance to fail even for a 100% effect chance,
- ; since carry is not set if BattleRandom == [hl] == 255
+ ld a, [hl]
+ cp 100 percent
+ jr z, .ok
call BattleRandom
cp [hl]
- pop hl
- ret c
+ jr c, .ok
.failed
ld a, 1
ld [wEffectFailed], a
and a
+.ok
+ pop hl
ret
```
## Belly Drum sharply boosts Attack even with under 50% HP ## Belly Drum sharply boosts Attack even with under 50% HP
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*

View File

@ -1877,6 +1877,8 @@ BattleCommand_EffectChance:
ld hl, wEnemyMoveStruct + MOVE_CHANCE ld hl, wEnemyMoveStruct + MOVE_CHANCE
.got_move_chance .got_move_chance
; BUG: 1/256 chance to fail even for a 100% effect chance,
; since carry is not set if BattleRandom == [hl] == 255
call BattleRandom call BattleRandom
cp [hl] cp [hl]
pop hl pop hl