summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2020-02-28 11:17:58 -0500
committerRangi <remy.oukaour+rangi42@gmail.com>2020-02-28 11:17:58 -0500
commit0cce00cb73849dc761bb36b302305c55ff2d54e4 (patch)
tree5e2ef61f4002ca8bbb2d8427c9b7678f017dc6fb
parent447da806153d2c56d15a8775ab43511202b269bc (diff)
Document a bug where Teleport cannot fail for wild Pokémon
-rw-r--r--docs/bugs_and_glitches.md20
-rw-r--r--engine/battle/move_effects/teleport.asm6
2 files changed, 22 insertions, 4 deletions
diff --git a/docs/bugs_and_glitches.md b/docs/bugs_and_glitches.md
index 8fdcf1ffb..abb1e524f 100644
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -30,6 +30,7 @@ Some fixes are mentioned as breaking compatibility with link battles. This can b
- [A Disabled but PP Up–enhanced move may not trigger Struggle](#a-disabled-but-pp-upenhanced-move-may-not-trigger-struggle)
- [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)
+- [Wild Pokémon can always Teleport regardless of level difference](#wild-pokémon-can-always-teleport-regardless-of-level-difference)
- [Beat Up can desynchronize link battles](#beat-up-can-desynchronize-link-battles)
- [Beat Up works incorrectly with only one Pokémon in the party](#beat-up-works-incorrectly-with-only-one-pokémon-in-the-party)
- [Beat Up may fail to raise Substitute](#beat-up-may-fail-to-raise-substitute)
@@ -693,6 +694,25 @@ This bug affects Attract, Curse, Foresight, Mean Look, Mimic, Nightmare, Spider
```
+## Wild Pokémon can always Teleport regardless of level difference
+
+**Fix:** Edit `BattleCommand_Teleport` in [engine/battle/move_effects/teleport.asm](https://github.com/pret/pokecrystal/blob/master/engine/battle/move_effects/teleport.asm):
+
+```diff
+ .loop_enemy
+ call BattleRandom
+ cp c
+ jr nc, .loop_enemy
+ srl b
+ srl b
+ cp b
+- ; This should be jr c, .failed
+- ; As written, it makes enemy use of Teleport always succeed if able
+- jr nc, .run_away
++ jr c, .failed
+```
+
+
## Beat Up can desynchronize link battles
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
diff --git a/engine/battle/move_effects/teleport.asm b/engine/battle/move_effects/teleport.asm
index 1a6aeed41..ba470798a 100644
--- a/engine/battle/move_effects/teleport.asm
+++ b/engine/battle/move_effects/teleport.asm
@@ -66,10 +66,8 @@ BattleCommand_Teleport:
srl b
srl b
cp b
- ; This does the wrong thing. What was
- ; probably intended was jr c, .failed
- ; The way this is made makes enemy use
- ; of Teleport always succeed if able
+ ; This should be jr c, .failed
+ ; As written, it makes enemy use of Teleport always succeed if able
jr nc, .run_away
.run_away
call UpdateBattleMonInParty