AI will score against predicted switchin if predicting switch #6037
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If the AI is predicting the player will switch using AI_FLAG_PREDICT_SWITCH introduced in #6028, this PR allows the AI to run its scoring functions against the predicted incoming mon rather than against the target that the AI thinks is about to switch out. This lets us take advantage of the prediction code to have much more sophisticated emergent behaviour, like using a Fighting-type move on a predicted switch to a Steel-type while the player's currently active mon is a Gengar.
The last missing piece of this puzzle is to track the player's knowledge of the AI, through a sort of reverse AI_FLAG_OMNISCIENT. As is, things like crazy "use Focus Punch against a Gengar with a predicted TTar switchin" won't happen because the AI knows its own mon has Focus Punch, and thus won't see the player's TTar as a good switchin candidate. It'd be ideal for the AI to just use the player's knowledge in its predictions. That's future work though lol
I think there's also merit to tracking both potential battlers in parallel, specifically for Pursuit; as in, "score Pursuit damage against the mon that's switching out, score literally everything else against the mon that's switching in", but I think that case may require significant additional handling so I'm not sure it's in scope for this PR. I don't think this will be too bad either way though!
Issue(s) that this PR fixes
Closes #5227
Discord contact info
@Pawkkie