Clean up bugs commented in the source code (#912)
Co-authored-by: Rangi <remy.oukaour+rangi42@gmail.com>
This commit is contained in:
@@ -1401,13 +1401,9 @@ BattleCheckTypeMatchup:
|
||||
and a
|
||||
jr z, CheckTypeMatchup
|
||||
ld hl, wBattleMonType1
|
||||
; fallthrough
|
||||
CheckTypeMatchup:
|
||||
; There is an incorrect assumption about this function made in the AI related code: when
|
||||
; the AI calls CheckTypeMatchup (not BattleCheckTypeMatchup), it assumes that placing the
|
||||
; offensive type in a will make this function do the right thing. Since a is overwritten,
|
||||
; this assumption is incorrect. A simple fix would be to load the move type for the
|
||||
; current move into a in BattleCheckTypeMatchup, before falling through, which is
|
||||
; consistent with how the rest of the code assumes this code works like.
|
||||
; BUG: AI makes a false assumption about CheckTypeMatchup (see docs/bugs_and_glitches.md)
|
||||
push hl
|
||||
push de
|
||||
push bc
|
||||
@@ -1865,9 +1861,7 @@ BattleCommand_EffectChance:
|
||||
jr z, .got_move_chance
|
||||
ld hl, wEnemyMoveStruct + 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
|
||||
; BUG: Moves with a 100% secondary effect chance will not trigger it in 1/256 uses (see docs/bugs_and_glitches.md)
|
||||
call BattleRandom
|
||||
cp [hl]
|
||||
pop hl
|
||||
@@ -2089,6 +2083,7 @@ BattleCommand_FailureText:
|
||||
inc hl
|
||||
ld a, [hl]
|
||||
|
||||
; BUG: Beat Up may fail to raise Substitute (see docs/bugs_and_glitches.md)
|
||||
cp EFFECT_MULTI_HIT
|
||||
jr z, .multihit
|
||||
cp EFFECT_DOUBLE_HIT
|
||||
@@ -2510,6 +2505,7 @@ DittoMetalPowder:
|
||||
pop bc
|
||||
ret nz
|
||||
|
||||
; BUG: Metal Powder can increase damage taken with boosted (Special) Defense (see docs/bugs_and_glitches.md)
|
||||
ld a, c
|
||||
srl a
|
||||
add c
|
||||
@@ -2646,6 +2642,7 @@ TruncateHL_BC:
|
||||
inc l
|
||||
|
||||
.finish
|
||||
; BUG: Reflect and Light Screen can make (Special) Defense wrap around above 1024 (see docs/bugs_and_glitches.md)
|
||||
ld a, [wLinkMode]
|
||||
cp LINK_COLOSSEUM
|
||||
jr z, .done
|
||||
@@ -2772,6 +2769,7 @@ SpeciesItemBoost:
|
||||
ret nz
|
||||
|
||||
; Double the stat
|
||||
; BUG: Thick Club and Light Ball can make (Special) Attack wrap around above 1024 (see docs/bugs_and_glitches.md)
|
||||
sla l
|
||||
rl h
|
||||
ret
|
||||
@@ -2901,8 +2899,7 @@ HitSelfInConfusion:
|
||||
|
||||
BattleCommand_DamageCalc:
|
||||
; Return a damage value for move power d, player level e, enemy defense c and player attack b.
|
||||
|
||||
; Return 1 if successful, else 0.
|
||||
; BUG: Confusion damage is affected by type-boosting items and Explosion/Self-Destruct doubling (see docs/bugs_and_glitches.md)
|
||||
|
||||
ld a, BATTLE_VARS_MOVE_EFFECT
|
||||
call GetBattleVar
|
||||
@@ -5263,6 +5260,7 @@ BattleCommand_EndLoop:
|
||||
jr .double_hit
|
||||
|
||||
.only_one_beatup
|
||||
; BUG: Beat Up works incorrectly with only one Pokémon in the party (see docs/bugs_and_glitches.md)
|
||||
ld a, BATTLE_VARS_SUBSTATUS3
|
||||
call GetBattleVarAddr
|
||||
res SUBSTATUS_IN_LOOP, [hl]
|
||||
@@ -6546,7 +6544,7 @@ INCLUDE "engine/battle/move_effects/future_sight.asm"
|
||||
INCLUDE "engine/battle/move_effects/thunder.asm"
|
||||
|
||||
CheckHiddenOpponent:
|
||||
; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly.
|
||||
; BUG: Lock-On and Mind Reader don't always bypass Fly and Dig (see docs/bugs_and_glitches.md)
|
||||
ld a, BATTLE_VARS_SUBSTATUS3_OPP
|
||||
call GetBattleVar
|
||||
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
|
||||
|
Reference in New Issue
Block a user