summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2017-12-19 19:04:56 -0500
committerRemy Oukaour <remy.oukaour@gmail.com>2017-12-19 19:04:56 -0500
commit2fa1e97aebdb23445355a74ca7f49787508f4f0d (patch)
tree5fa7df94dbb49884ba2ce53e1d3f510527c91419
parent17058aaec275675dd128bdcb65055c2710400b97 (diff)
Document two more bugs
-rw-r--r--battle/effect_commands.asm1
-rw-r--r--docs/bugs_and_glitches.md80
-rw-r--r--engine/item_effects.asm4
3 files changed, 83 insertions, 2 deletions
diff --git a/battle/effect_commands.asm b/battle/effect_commands.asm
index b49cb2e3d..57e4c574f 100644
--- a/battle/effect_commands.asm
+++ b/battle/effect_commands.asm
@@ -9765,6 +9765,7 @@ BattleCommand_ThunderAccuracy: ; 37d94
CheckHiddenOpponent: ; 37daa
+; BUG: This routine should account for Lock-On and Mind Reader.
ld a, BATTLE_VARS_SUBSTATUS3_OPP
call GetBattleVar
and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index a3fbc769a..688a4d455 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -256,7 +256,18 @@ This is a bug with `CheckPlayerHasUsableMoves` in [battle/core.asm](/battle/core
This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider Web, Transform, and stat-lowering effects of moves like String Shot or Bubble during the semi-invulnerable turn of Fly or Dig.
-*To do:* Identify specific code causing this bug and fix it.
+This is a bug with `CheckHiddenOpponent` in [battle/effect_commands.asm](/battle/effect_commands.asm):
+
+```asm
+CheckHiddenOpponent: ; 37daa
+; BUG: This routine should account for Lock-On and Mind Reader.
+ ld a, BATTLE_VARS_SUBSTATUS3_OPP
+ call GetBattleVar
+ and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
+ ret
+```
+
+*To do:* Fix this bug.
## Beat Up can desynchronize link battles
@@ -1007,7 +1018,72 @@ endr
This bug can affect Mew or Pokémon other than Ditto that used Transform via Mirror Move or Sketch.
-*To do:* Identify specific code causing this bug and fix it.
+This is a bug with `PokeBall` in [items/item_effects.asm](/items/item_effects.asm):
+
+```asm
+ ld hl, EnemySubStatus5
+ ld a, [hl]
+ push af
+ set SUBSTATUS_TRANSFORMED, [hl]
+
+; This code is buggy. Any wild Pokémon that has Transformed will be
+; caught as a Ditto, even if it was something else like Mew.
+; To fix, do not set [TempEnemyMonSpecies] to DITTO.
+ bit SUBSTATUS_TRANSFORMED, a
+ jr nz, .ditto
+ jr .not_ditto
+
+.ditto
+ ld a, DITTO
+ ld [TempEnemyMonSpecies], a
+ jr .load_data
+
+.not_ditto
+ set SUBSTATUS_TRANSFORMED, [hl]
+ ld hl, wEnemyBackupDVs
+ ld a, [EnemyMonDVs]
+ ld [hli], a
+ ld a, [EnemyMonDVs + 1]
+ ld [hl], a
+
+.load_data
+ ld a, [TempEnemyMonSpecies]
+ ld [CurPartySpecies], a
+ ld a, [EnemyMonLevel]
+ ld [CurPartyLevel], a
+ callba LoadEnemyMon
+
+ pop af
+ ld [EnemySubStatus5], a
+```
+
+**Fix:**
+
+```asm
+ ld hl, EnemySubStatus5
+ ld a, [hl]
+ push af
+ set SUBSTATUS_TRANSFORMED, [hl]
+
+ bit SUBSTATUS_TRANSFORMED, a
+ jr nz, .load_data
+
+ ld hl, wEnemyBackupDVs
+ ld a, [EnemyMonDVs]
+ ld [hli], a
+ ld a, [EnemyMonDVs + 1]
+ ld [hl], a
+
+.load_data
+ ld a, [TempEnemyMonSpecies]
+ ld [CurPartySpecies], a
+ ld a, [EnemyMonLevel]
+ ld [CurPartyLevel], a
+ callba LoadEnemyMon
+
+ pop af
+ ld [EnemySubStatus5], a
+```
## Using a Park Ball in normal battles has a corrupt animation
diff --git a/engine/item_effects.asm b/engine/item_effects.asm
index d1b5e7161..e881f6338 100644
--- a/engine/item_effects.asm
+++ b/engine/item_effects.asm
@@ -452,6 +452,10 @@ ParkBall: ; e8a2
ld a, [hl]
push af
set SUBSTATUS_TRANSFORMED, [hl]
+
+; This code is buggy. Any wild Pokémon that has Transformed will be
+; caught as a Ditto, even if it was something else like Mew.
+; To fix, do not set [TempEnemyMonSpecies] to DITTO.
bit SUBSTATUS_TRANSFORMED, a
jr nz, .ditto
jr .not_ditto