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

Fix Baton Pass for when Ace mon is the last alive #3067

Merged
merged 2 commits into from
Jun 21, 2023

Conversation

AlexOn1ine
Copy link
Collaborator

Description

When the AI used Baton Pass with The Ace mon flag it switched into an invalid(bugged) mon.
This fix checks if only one mon is alive to avoid calling the function GetBestMonBatonPass.

Also removes the checks for last used moves because checking if the acemon is the last mon alive should be enough.

Images

volt_switch
parting_shot
baton_pass

Issue(s) that this PR fixes

Fixes #3066

Discord contact info

rainonline

src/battle_ai_switch_items.c Outdated Show resolved Hide resolved
@@ -990,8 +990,7 @@ u8 GetMostSuitableMonToSwitchInto(void)
return bestMonId;

// If ace mon is the last available Pokemon and U-Turn/Volt Switch was used - switch to the mon.
if (aceMonId != PARTY_SIZE
&& (gBattleMoves[gLastUsedMove].effect == EFFECT_HIT_ESCAPE || gBattleMoves[gLastUsedMove].effect == EFFECT_PARTING_SHOT))
if (aceMonId != PARTY_SIZE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part that I think is truly fixing the bug.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, this is the actual fix. I am honestly not sure why I added the check above yesterday.

remove not needed check
@AsparagusEduardo AsparagusEduardo merged commit 43821d6 into rh-hideout:master Jun 21, 2023
@AlexOn1ine AlexOn1ine deleted the baton_pass_ace_mon branch July 5, 2023 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NPC Baton Pass bug with the Ace Pokemon Flag
3 participants