-
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
Add AI_FLAG_PREDICT_SWITCH #6028
Conversation
This reverts commit d586627.
Ready for review! :D Note that this refactors some Focus Punch handling, might be worth considering changes to in particular. The major reason is by making it usable, it can blow out any hits to KO / can target be fainted calcs, and I'm not sure how best to handle these. For now I've made the minimum amount of changes necessary to get existing tests to pass. |
Looks good from my side. I'll wait for @AlexOn1ine to also look through it and if all goes well, we'll get it merged. |
Description
Kind of a capstone to an enormous amount of work over the last year or so, finally starting to work on AI prediction behaviour. The end goal is to eventually have the AI able to predict all of switches, switchins, and moves; this PR does the first part of that, and probably also the second part if it's not too bad.
The AI doesn't cheat to predict, it determines whether it would switch or not in the player's situation, and determines whether it expects the player to switch or not accordingly. Whether the AI acts on this prediction has a 50% failure rate to simulate the AI sometimes predicting, though I might open that up to a define for more user control.
Some of the control flow is counterintuitively done at the end of functions to ensure the player can't use the AI's thinking time to know what they're doing.
Thanks to Team Aqua's Hideout for helping me brainstorm what move scores should be affected!
Note that this refactors some Focus Punch handling, might be worth considering changes to. The major reason is by making it usable, it can blow out any hits to KO / can target be fainted calcs, and I'm not sure how best to handle these. For now I've made the minimum amount of changes necessary to get existing tests to pass.
Issue(s) that this PR fixes
Closes #5219
People who collaborated with me in this PR
Team Aqua's Hideout for brainstorming what moves scores should be affected, particularly @kithr1
Feature(s) this PR doesn't handle
#5227 is going to be a follow-up PR, this is complex enough imo
#5229 is likely going to be its own PR with its own AI_FLAG_PREDICT_MOVE to keep the PRs more manageable
Discord contact info
@Pawkkie