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

Removes redundancy in AI_TryToFaint and tweaks to AI_CompareDamagingM… #3371

Closed
wants to merge 1 commit into from

Conversation

AlexOn1ine
Copy link
Collaborator

Description

AI_TryToFaint changes:

  • Especially with Improve how AI chooses damaging moves #3199, some of the score increases aren't needed anymore
  • Replaced AI_STRIKES_FIRST with GetWhichBattlerFaster to ignore the move. If the move is considered the AI might think it's naturally faster when it isn't. The function checks for priority later.
  • Rearranged a couple of things to allow the AI to go for a prio move if it sees the target can faint it.

Some minor tweaks to AI_CompareDamagingMoves

  • Only decrease the score instead of increases and decreases.
  • In the AI_WhichMoveBetter section decrease the score only if 1 is returned.

Removed:

  • EFFECT_FLAIL
  • EFFECT_FACADE
  • EFFECT_SMELLINGSALT
  • EFFECT_WAKE_UP_SLAP

All 4 are handled by damage calcs. If they get a damage boost the score increases will be handled appropriately.

And I also removed this small section:

    // check high crit
    if (gBattleMoves[move].highCritRatio && effectiveness >= AI_EFFECTIVENESS_x2 && AI_RandLessThan(128))
        score++;

Open to suggestions but I don't think the score should be increased randomly even though it is only on super effective.

Images

Cut was made a 70BP Steel type move and kept the 95% Accuracy. Compared to Smart Strike it each of them get a score decrease:
pokeemerald-34
Both moves kill Typhlosion but a prio move will be chosen:
pokeemerald-32
EQ and Drill Run have a kill with the same number of hits but EQ is more accurate:
pokeemerald-31
Marill knows target can faint it so it prefers Aqua Jet
pokeemerald-25

Issue(s) that this PR fixes

Fixes #3217

@DizzyEggg
Copy link
Collaborator

Could you check now with #3361 merged? Also, if you decide to change something, maybe you could also write a test? 👀

@AlexOn1ine AlexOn1ine marked this pull request as draft October 4, 2023 21:47
@DizzyEggg
Copy link
Collaborator

What's the status of this @AlexOn1ine ?

@AlexOn1ine
Copy link
Collaborator Author

What's the status of this @AlexOn1ine ?

Can be closed. A lot of it is already done by you and PR #3382.

@AlexOn1ine AlexOn1ine closed this Oct 30, 2023
@AlexOn1ine
Copy link
Collaborator Author

AlexOn1ine commented Oct 30, 2023

EFFECT_FACADE
EFFECT_SMELLINGSALT
EFFECT_WAKE_UP_SLAP

Imo those and a couple more can be removed from scoring because they should be handled by damage calcs but it's probably better done in a new PR with proper tests.

@AlexOn1ine AlexOn1ine deleted the ai_scores branch April 19, 2024 12: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.

2 participants