Haze Boosting AI Followup (#6966)

This commit is contained in:
Pawkkie 2025-06-11 12:30:22 -04:00 committed by GitHub
parent c9a49e696e
commit 3db12a0ae6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 20 additions and 2 deletions

View File

@ -55,6 +55,7 @@
// AI move scoring
#define STATUS_MOVE_FOCUS_PUNCH_CHANCE 50 // Chance the AI will use a status move if the player's best move is Focus Punch
#define BOOST_INTO_HAZE_CHANCE 0 // Chance the AI will use a stat boosting move if the player has used Haze
// AI damage calc considerations
#define RISKY_AI_CRIT_STAGE_THRESHOLD 2 // Stat stages at which Risky will assume it gets a crit

View File

@ -199,6 +199,7 @@ enum RandomTag
RNG_AI_PREDICT_SWITCH,
RNG_AI_PREDICT_MOVE,
RNG_AI_STATUS_FOCUS_PUNCH,
RNG_AI_BOOST_INTO_HAZE,
RNG_HEALER,
RNG_DEXNAV_ENCOUNTER_LEVEL,
};

View File

@ -4124,9 +4124,10 @@ static enum AIScore IncreaseStatUpScoreInternal(u32 battlerAtk, u32 battlerDef,
return NO_INCREASE;
// Don't increase stats if opposing battler has used Haze effect
if (HasBattlerSideUsedMoveWithEffect(battlerDef, EFFECT_HAZE)
if (!RandomPercentage(RNG_AI_BOOST_INTO_HAZE, BOOST_INTO_HAZE_CHANCE) &&
(HasBattlerSideUsedMoveWithEffect(battlerDef, EFFECT_HAZE)
|| HasBattlerSideUsedMoveWithAdditionalEffect(battlerDef, MOVE_EFFECT_CLEAR_SMOG)
|| HasBattlerSideUsedMoveWithAdditionalEffect(battlerDef, MOVE_EFFECT_HAZE))
|| HasBattlerSideUsedMoveWithAdditionalEffect(battlerDef, MOVE_EFFECT_HAZE)))
return NO_INCREASE;
// Don't increase if AI is at +1 and opponent has Haze effect

View File

@ -865,3 +865,18 @@ AI_SINGLE_BATTLE_TEST("AI will not set up Weather if it wont have any affect")
TURN { MOVE(player, MOVE_SCRATCH); EXPECT_MOVE(opponent, MOVE_RAIN_DANCE); }
}
}
AI_SINGLE_BATTLE_TEST("AI won't use stat boosting moves if the player has used Haze")
{
PASSES_RANDOMLY(BOOST_INTO_HAZE_CHANCE, 100, RNG_AI_BOOST_INTO_HAZE);
GIVEN {
ASSUME(GetMoveEffect(MOVE_HAZE) == EFFECT_HAZE);
ASSUME(GetMoveEffect(MOVE_DRAGON_DANCE) == EFFECT_DRAGON_DANCE);
AI_FLAGS(AI_FLAG_CHECK_BAD_MOVE | AI_FLAG_CHECK_VIABILITY | AI_FLAG_TRY_TO_FAINT);
PLAYER(SPECIES_WOBBUFFET) { Moves(MOVE_SCRATCH, MOVE_HAZE); }
OPPONENT(SPECIES_WOBBUFFET) { Moves(MOVE_SCRATCH, MOVE_DRAGON_DANCE); }
} WHEN {
TURN { MOVE(player, MOVE_HAZE); EXPECT_MOVE(opponent, MOVE_DRAGON_DANCE); }
TURN { MOVE(player, MOVE_HAZE); EXPECT_MOVE(opponent, MOVE_DRAGON_DANCE); }
}
}