diff options
Diffstat (limited to 'docs/bugs_and_glitches.md')
-rw-r--r-- | docs/bugs_and_glitches.md | 112 |
1 files changed, 95 insertions, 17 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md index 0212ed6fc..95c5e032f 100644 --- a/docs/bugs_and_glitches.md +++ b/docs/bugs_and_glitches.md @@ -15,6 +15,8 @@ These are known bugs and glitches in the original Pokémon Crystal game: code th - [A Pokémon that fainted from Pursuit will have its old status condition when revived](#a-pokémon-that-fainted-from-pursuit-will-have-its-old-status-condition-when-revived) - [Lock-On and Mind Reader don't always bypass Fly and Dig](#lock-on-and-mind-reader-dont-always-bypass-fly-and-dig) - [Beat Up can desynchronize link battles](#beat-up-can-desynchronize-link-battles) +- [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) - ["Smart" AI encourages Mean Look if its own Pokémon is badly poisoned](#smart-ai-encourages-mean-look-if-its-own-pokémon-is-badly-poisoned) - [AI makes a false assumption about `CheckTypeMatchup`](#ai-makes-a-false-assumption-about-checktypematchup) @@ -339,6 +341,82 @@ This is a bug with `BattleCommand_BeatUp` in [engine/battle/move_effects/beat_up **Fix:** Change `cp [hl]` to `cp c`. +## Beat Up may fail to raise substitute + +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* +(Only the fixes denoted with "breaking" will actually break compatibility, the others just affect what's shown on the screen with the patched game) + +This is a bug in `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that prevents the rest of the move's effect from being executed if the player or enemy only has one mon in their party while using Beat Up. + +It prevents the substitute from being raised and the King's Rock from working. + +```asm +.only_one_beatup + ld a, BATTLE_VARS_SUBSTATUS3 + call GetBattleVarAddr + res SUBSTATUS_IN_LOOP, [hl] + call BattleCommand_BeatUpFailText + jp EndMoveEffect +``` + +**Fix (breaking):** Replace the last two lines with `ret`. +**Fix (cosmetics):** Call `BattleCommand_RaiseSub` before the `jp`. + +There's a similar oversight in `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm) that will prevent the substitute from being raised if Beat Up is protected against. + +```asm + cp EFFECT_MULTI_HIT + jr z, .multihit + cp EFFECT_DOUBLE_HIT + jr z, .multihit + cp EFFECT_POISON_MULTI_HIT + jr z, .multihit + jp EndMoveEffect + +.multihit + call BattleCommand_RaiseSub + jp EndMoveEffect +``` + +**Fix:** Check for `EFFECT_BEAT_UP` as well. + + +## Beat Up may trigger King's Rock even if it failed + +*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* + +This is a bug in how `wAttackMissed` is never set by BeatUp, even when none of the 'mon have been able to attack (due to being fainted or having a status effect), the King's Rock may activate. + +This bug can be fixed in a plethora of ways, but the most straight-forward would be in `BattleCommand_BeatUpFailText` in [engine/battle/move_effects/beat_up.asm](/engine/battle/move_effects/beat_up.asm), as that's always ran before the king's rock effect. + +```asm +BattleCommand_BeatUpFailText: ; 355b5 +; beatupfailtext + + ld a, [wBeatUpHitAtLeastOnce] + and a + ret nz + + jp PrintButItFailed +``` + +**Fix:** + +```asm +BattleCommand_BeatUpFailText: ; 355b5 +; beatupfailtext + + ld a, [wBeatUpHitAtLeastOnce] + and a + ret nz + + inc a + ld [wAttackMissed], a + + jp PrintButItFailed +``` + + ## Present damage is incorrect in link battles *Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.* @@ -490,7 +568,7 @@ This is a bug with `LongAnim_UpdateVariables` in [engine/battle/anim_hp_bar.asm] ([Video](https://www.youtube.com/watch?v=9KyNVIZxJvI)) -This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engine/anim_hp_bar.asm): +This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/battle/anim_hp_bar.asm](/engine/battle/anim_hp_bar.asm): ```asm ld b, 0 @@ -519,7 +597,7 @@ This is a bug with `ShortHPBar_CalcPixelFrame` in [engine/anim_hp_bar.asm](/engi This can bring Pokémon straight from level 1 to 100 by gaining just a few experience points. -This is a bug with `CalcExpAtLevel` in [engine/experience.asm](/engine/experience.asm): +This is a bug with `CalcExpAtLevel` in [engine/pokemon/experience.asm](/engine/pokemon/experience.asm): ```asm CalcExpAtLevel: ; 50e47 @@ -589,7 +667,7 @@ Text_StringBuffer2ExpPoints:: ## BRN/PSN/PAR do not affect catch rate -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ; This routine is buggy. It was intended that SLP and FRZ provide a higher @@ -713,7 +791,7 @@ This is a bug with `ItemAttributes` in [data/items/attributes.asm](/data/items/a ## Daisy's grooming doesn't always increase happiness -This is a bug with `HaircutOrGrooming` in [engine/events/specials_2.asm](/engine/events/specials_2.asm): +This is a bug with `HaircutOrGrooming` in [engine/events/haircut.asm](/engine/events/haircut.asm): ```asm ; Bug: Subtracting $ff from $ff fails to set c. @@ -923,7 +1001,7 @@ This is a bug with `_HallOfFamePC.DisplayMonAndStrings` in [engine/events/hallof ([Video](https://www.youtube.com/watch?v=ojq3xqfRF6I)) -This is a bug with `Slots_PayoutAnim` in [engine/slot_machine.asm](/engine/slot_machine.asm): +This is a bug with `Slots_PayoutAnim` in [engine/games/slot_machine.asm](/engine/games/slot_machine.asm): ```asm .okay @@ -973,7 +1051,7 @@ This is a bug with `PlayBattleMusic` in [engine/battle/start_battle.asm](/engine ## No bump noise if standing on tile `$3E` -This is a bug with `DoPlayerMovement.CheckWarp` in [engine/player_movement.asm](/engine/player_movement.asm): +This is a bug with `DoPlayerMovement.CheckWarp` in [engine/overworld/player_movement.asm](/engine/overworld/player_movement.asm): ```asm ; Bug: Since no case is made for STANDING here, it will check @@ -1108,7 +1186,7 @@ In [home/map.asm](/home/map.asm): This bug is why the Lapras in [maps/UnionCaveB2F.asm](/maps/UnionCaveB2F.asm), which uses `SPRITEMOVEDATA_SWIM_WANDER`, is not restricted by its `1, 1` movement radius. -In [engine/npc_movement.asm](/engine/npc_movement.asm): +In [engine/overworld/npc_movement.asm](/engine/overworld/npc_movement.asm): ```asm ld hl, OBJECT_FLAGS1 @@ -1126,7 +1204,7 @@ In [engine/npc_movement.asm](/engine/npc_movement.asm): This bug can allow you to talk to Eusine in Celadon City and encounter Ho-Oh with only traded legendary beasts. -In [engine/search.asm](/engine/search.asm): +In [engine/pokemon/search.asm](/engine/pokemon/search.asm): ```asm ; check OT @@ -1157,7 +1235,7 @@ endr This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch. -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ld hl, wEnemySubStatus5 @@ -1229,7 +1307,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ([Video](https://www.youtube.com/watch?v=v1ErZdLCIyU)) -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm .room_in_party @@ -1254,7 +1332,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ## `HELD_CATCH_CHANCE` has no effect -This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_effects.asm): +This is a bug with `PokeBallEffect` in [engine/items/item_effects.asm](/engine/items/item_effects.asm): ```asm ; BUG: farcall overwrites a, and GetItemHeldEffect takes b anyway. @@ -1281,7 +1359,7 @@ This is a bug with `PokeBallEffect` in [engine/item_effects.asm](/engine/item_ef ## Only the first three `EvosAttacks` evolution entries can have Stone compatibility reported correctly -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm): +This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): ```asm .DetermineCompatibility: ; 50268 @@ -1304,7 +1382,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i ## `EVOLVE_STAT` can break Stone compatibility reporting -This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/party_menu.asm](/engine/party_menu.asm): +This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` in [engine/pokemon/party_menu.asm](/engine/pokemon/party_menu.asm): ```asm .loop2 @@ -1337,7 +1415,7 @@ This is a bug with `PlacePartyMonEvoStoneCompatibility.DetermineCompatibility` i ## `ScriptCall` can overflow `wScriptStack` and crash -In [engine/scripting.asm](/engine/scripting.asm): +In [engine/overworld/scripting.asm](/engine/overworld/scripting.asm): ```asm ScriptCall: @@ -1377,7 +1455,7 @@ ScriptCall: ## `LoadSpriteGFX` does not limit the capacity of `UsedSprites` -In [engine/overworld.asm](/engine/overworld.asm): +In [engine/overworld/overworld.asm](/engine/overworld/overworld.asm): ```asm LoadSpriteGFX: ; 14306 @@ -1414,7 +1492,7 @@ LoadSpriteGFX: ; 14306 ## `ChooseWildEncounter` doesn't really validate the wild Pokémon species -In [engine/wildmons.asm](/engine/wildmons.asm): +In [engine/overworld/wildmons.asm](/engine/overworld/wildmons.asm): ```asm ChooseWildEncounter: ; 2a14f @@ -1452,7 +1530,7 @@ ValidateTempWildMonSpecies: ; 2a4a0 ## `TryObjectEvent` arbitrary code execution -In [engine/events.asm](/engine/events.asm): +In [engine/overworld/events.asm](/engine/overworld/events.asm): ```asm ; Bug: If IsInArray returns nc, data at bc will be executed as code. |