-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Switch AI refactor + considers free switches #5379
Switch AI refactor + considers free switches #5379
Conversation
This reverts commit 446f738.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a neat solution
I can't find this on GH for some reason, and if you deleted it cuz you answered your own question, no worries! But my email has
And I don't know the answer to this question. This was just the best approach I could find for determining which mon moved first, if you're aware of an alternative I'm all ears :) |
I deleted it because I realized that in this case it is a good solution 😅 |
Okay awesome, I did not mean to call you out on that I just wasn't confident about it myself lmao |
Now back from honeymoon, moved the new parameters to AiLogicData as requested and ready for re-review :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conflicts but generally a lot of good clean up.
Done making changes this should be good to go :) |
Description
This started as a solution to #5220, and expanded in scope once I realized that the best place to handle this was in
GetBestMonIntegrated
, which has been in need of a refactor as different pieces of it have evolved to be handled in different ways (ie. Trapping was handled smarter / cleaner than the rest of the function because I'd spent like an extra year working on the project).The refactor largely moves a lot of conditionals into a few new helper functions, and bases many decisions on the new
CanSwitchinWin1v1
rather than having large stacking conditions with various pieces being considered or missing.DoesSwitchinMoveFirst
is a similar helper function that just increases readability. The second one in particular was already kicked around as a follow-up to the Trapper PR and I thought this was a good time to do it.Lastly the totally new content that address #5220, the Smart Mon Choices flag will now consider switches as "free switches" or not using
IsFreeSwitch
. This means it's no longer tied to just mid-battle vs post-KO switching, and can detect whether the AI has a free switch from an effect like a slow U-Turn or an Eject Button and switch offensively in these scenarios rather than defensively.Overall the PR should allow the AI to be more aggressive with switching when it makes sense to do so, and this function should be much easier to work with going forward.
EDIT: There are also tests for the new free switches, and several related tests were cleaned up a bit to ensure consistency for the AI's scenario.
Issue(s) that this PR fixes
#5220
Discord contact info
@Pawkkie