ref: a2f63043d49ee892f6c97b52bb7fe47ece71c6d6
parent: b58f82e12f42c98693cef1c35c1aa4cd8aeaaa22
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Fri Jul 27 13:53:26 EDT 2018
Separate Beat Up bugs
--- a/docs/bugs_and_glitches.md
+++ b/docs/bugs_and_glitches.md
@@ -22,7 +22,8 @@
- [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 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)
- [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)
@@ -276,35 +277,16 @@
**Fix:** Edit `CheckHiddenOpponent` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
```diff
- CheckHiddenOpponent:
+-CheckHiddenOpponent:
-; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly.
- ld a, BATTLE_VARS_SUBSTATUS3_OPP
- call GetBattleVar
- and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
++ xor a
ret
```
-**Alternate fix:**
-To be more efficient, completely remove `CheckHiddenOpponent`:
-
-```diff
--CheckHiddenOpponent:
--; BUG: This routine is completely redundant and introduces a bug, since BattleCommand_CheckHit does these checks properly.
-- ld a, BATTLE_VARS_SUBSTATUS3_OPP
-- call GetBattleVar
-- and 1 << SUBSTATUS_FLYING | 1 << SUBSTATUS_UNDERGROUND
-- ret
-```
-
-And remove all eight calls to it in various files:
-
-```diff
-- call CheckHiddenOpponent
-- jr nz, .fail
-```
-
-
## Beat Up can desynchronize link battles
*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
@@ -341,11 +323,11 @@
```
-## Beat Up may fail to raise substitute
+## Beat Up works incorrectly with only one Pokémon in the party
-*Fixing this bug will break compatibility with standard Pokémon Crystal for link battles.*
+*Fixing this bug may break compatibility with standard Pokémon Crystal for link battles.*
-This bug prevents the rest of the move's effect from being executed if the player or enemy only has one Pokémon in their party while using Beat Up. It prevents Substitute from being raised and King's Rock from working.
+This bug prevents the rest of Beat Up's effect from being executed if the player or enemy only has one Pokémon in their party while using it. It prevents Substitute from being raised and King's Rock from working.
**Fix:** Edit `BattleCommand_EndLoop` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm):
@@ -371,7 +353,12 @@
jp EndMoveEffect
```
-For the cosmetic fix, also edit `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm).
+
+## Beat Up may fail to raise Substitute
+
+This bug prevents Substitute from being raised if Beat Up was blocked by Protect or Detect.
+
+**Fix:** Edit `BattleCommand_FailureText` in [engine/battle/effect_commands.asm](/engine/battle/effect_commands.asm).
```diff
cp EFFECT_MULTI_HIT