mirror of
https://github.com/pret/pokecrystal.git
synced 2025-03-02 12:26:07 +00:00
Fix "100% secondary effect" fix, add compatibility
The original fix was bugged (example: erroneous `pop hl` if `.failed` was jumped to). Replaced with a less invasive fix, keeping all side effects from the original function; it's less intuitive, but more performant - and the tricky bit has been commented. Also the new fix is more friendly to the compatibility patch I also added, by request of ShinyDragonHunter.
This commit is contained in:
parent
e671636bba
commit
add58fb00d
@ -175,24 +175,38 @@ This bug existed for all battles in Gold and Silver, and was only fixed for sing
|
|||||||
```diff
|
```diff
|
||||||
- ; BUG: 1/256 chance to fail even for a 100% effect chance,
|
- ; BUG: 1/256 chance to fail even for a 100% effect chance,
|
||||||
- ; since carry is not set if BattleRandom == [hl] == 255
|
- ; since carry is not set if BattleRandom == [hl] == 255
|
||||||
|
- call BattleRandom
|
||||||
+ ld a, [hl]
|
+ ld a, [hl]
|
||||||
+ cp 100 percent
|
+ sub 100 percent
|
||||||
+ jr z, .ok
|
+ ; If chance was 100%, RNG won't be called (carry not set)
|
||||||
call BattleRandom
|
+ ; Thus chance will be subtracted from 0, guaranteeing a carry
|
||||||
|
+ call c, BattleRandom
|
||||||
cp [hl]
|
cp [hl]
|
||||||
- pop hl
|
pop hl
|
||||||
- ret c
|
ret c
|
||||||
+ jr c, .ok
|
|
||||||
|
|
||||||
.failed
|
.failed
|
||||||
ld a, 1
|
ld a, 1
|
||||||
ld [wEffectFailed], a
|
ld [wEffectFailed], a
|
||||||
and a
|
and a
|
||||||
+.ok
|
|
||||||
+ pop hl
|
|
||||||
ret
|
ret
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you wish to keep compatibility with standard Pokémon Crystal, you can disable the fix during link battles by also applying the following edit in the same place:
|
||||||
|
|
||||||
|
```diff
|
||||||
|
+ ld a, [wLinkMode]
|
||||||
|
+ cp LINK_COLOSSEUM
|
||||||
|
+ scf ; Force RNG to be called
|
||||||
|
+ jr z, .nofix ; Don't apply fix in link battles, for compatibility
|
||||||
|
ld a, [hl]
|
||||||
|
sub 100 percent
|
||||||
|
; If chance was 100%, RNG won't be called (carry not set)
|
||||||
|
; Thus chance will be subtracted from 0, guaranteeing a carry
|
||||||
|
+ .nofix
|
||||||
|
call c, BattleRandom
|
||||||
|
```
|
||||||
|
|
||||||
## 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.*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user