pokecrystal
pokecrystal copied to clipboard
Bug: Mind Reader and Lock-On don't prevent the AI from failing status moves that have a 25% chance to fail (when used by AI)
Moves that cause a non-volatile status condition as well as moves that lower stats have a 25% chance to fail when used by the AI, but they are also supposed to not do this if the target has the Lock-On status.
However, this appears to be a bit of an oversight, as it is not possible for the target to actually have the Lock-On status, since the status gets consumed by the checkhit
command.
For example, here's the part of the BattleCommand_StatDown subroutine that checks if Lock-On is in effect, and if not, it rolls for the 25% chance to miss: https://github.com/pret/pokecrystal/blob/768b3bdec15ac9f79e43f88695514494c93f2f99/engine/battle/effect_commands.asm#L4365-L4378
And here is where BattleCommand_CheckHit removes the Lock-On status: https://github.com/pret/pokecrystal/blob/768b3bdec15ac9f79e43f88695514494c93f2f99/engine/battle/effect_commands.asm#L1659-L1666
A rather infamous example of this is when fighting Chuck's Poliwrath. His strategy is to use Mind Reader combined with inaccurate moves like DynamicPunch and Hypnosis. However, if he uses Mind Reader, Hypnosis will still have a 25% chance to fail.
I think you're right, that seems like a bug, but since lock on is supposed to reset after the turn it takes effect, the logic makes sense.
Maybe it should be handled in engine/battle/core.asm:HandleBetweenTurnEffects
, instead, to preserve the flag for the entire turn, though you'd have to check if the attack actually hit...