Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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) #1069

Open
SnowyMouse opened this issue Aug 13, 2023 · 1 comment
Labels

Comments

@SnowyMouse
Copy link

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:

; Lock-On still always works.
ld a, [wPlayerSubStatus5]
bit SUBSTATUS_LOCK_ON, a
jr nz, .DidntMiss
; Attacking moves that also lower accuracy are unaffected.
ld a, BATTLE_VARS_MOVE_EFFECT
call GetBattleVar
cp EFFECT_ACCURACY_DOWN_HIT
jr z, .DidntMiss
call BattleRandom
cp 25 percent + 1 ; 25% chance AI fails
jr c, .Failed

And here is where BattleCommand_CheckHit removes the Lock-On status:

.LockOn:
; Return nz if we are locked-on and aren't trying to use Earthquake,
; Fissure or Magnitude on a monster that is flying.
ld a, BATTLE_VARS_SUBSTATUS5_OPP
call GetBattleVarAddr
bit SUBSTATUS_LOCK_ON, [hl]
res SUBSTATUS_LOCK_ON, [hl]
ret z

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.

@SnowyMouse SnowyMouse changed the title Bug: Mind Reader and Lock-On don't prevent the AI from failing status moves that they have a 25% chance to fail Bug: Mind Reader and Lock-On don't prevent the AI from failing status moves that have a 25% chance to fail Aug 13, 2023
@SnowyMouse SnowyMouse changed the title Bug: Mind Reader and Lock-On don't prevent the AI from failing status moves that have a 25% chance to fail 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) Aug 13, 2023
@mid-kid
Copy link
Member

mid-kid commented Aug 14, 2023

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants