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

Add AI_FLAG_PREDICT_SWITCH #6028

Merged
merged 17 commits into from
Jan 16, 2025
Merged

Conversation

Pawkkie
Copy link
Collaborator

@Pawkkie Pawkkie commented Jan 15, 2025

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

@Pawkkie Pawkkie added new-feature Adds a feature category: battle-ai Pertains to Battle Engine Upgrade's AI labels Jan 15, 2025
@Pawkkie Pawkkie marked this pull request as draft January 15, 2025 05:40
@Pawkkie Pawkkie marked this pull request as ready for review January 15, 2025 21:12
@Pawkkie
Copy link
Collaborator Author

Pawkkie commented Jan 15, 2025

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.

@DizzyEggg
Copy link
Collaborator

DizzyEggg commented Jan 16, 2025

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.
Edit: Alex was fine with it on Discord, so let's merge this

@DizzyEggg DizzyEggg merged commit 465d30f into rh-hideout:upcoming Jan 16, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: battle-ai Pertains to Battle Engine Upgrade's AI new-feature Adds a feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants