Improving the checks for the AI to avoid Encore; adding RISK_ENCORE_CHANCE config. (#7929)
This commit is contained in:
parent
a5f0686261
commit
5090432ff1
@ -4066,6 +4066,19 @@ static s32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move, stru
|
||||
if (gAiThinkingStruct->aiFlags[battlerAtk] & AI_FLAG_PREFER_STATUS_MOVES && IsBattleMoveStatus(move) && effectiveness != UQ_4_12(0.0))
|
||||
ADJUST_SCORE(10);
|
||||
|
||||
// don't get baited into encore
|
||||
if (gBattleMoveEffects[moveEffect].encourageEncore
|
||||
&& HasBattlerSideMoveWithEffect(battlerDef, EFFECT_ENCORE)
|
||||
&& (B_MENTAL_HERB < GEN_5 || aiData->holdEffects[battlerAtk] != HOLD_EFFECT_MENTAL_HERB))
|
||||
{
|
||||
if (!AI_IsAbilityOnSide(battlerAtk, ABILITY_AROMA_VEIL)
|
||||
|| IsMoldBreakerTypeAbility(battlerDef, aiData->abilities[battlerDef])
|
||||
|| aiData->abilities[battlerDef] == ABILITY_MYCELIUM_MIGHT
|
||||
|| IsMoldBreakerTypeAbility(BATTLE_PARTNER(battlerDef), aiData->abilities[BATTLE_PARTNER(battlerDef)])
|
||||
|| aiData->abilities[BATTLE_PARTNER(battlerDef)] == ABILITY_MYCELIUM_MIGHT)
|
||||
return score;
|
||||
}
|
||||
|
||||
// check thawing moves
|
||||
if (gBattleMons[battlerAtk].status1 & STATUS1_ICY_ANY && MoveThawsUser(move))
|
||||
ADJUST_SCORE(10);
|
||||
|
||||
@ -2005,10 +2005,6 @@ bool32 ShouldRaiseAnyStat(u32 battlerAtk, u32 battlerDef)
|
||||
if (AI_IsAbilityOnSide(battlerDef, ABILITY_OPPORTUNIST))
|
||||
return FALSE;
|
||||
|
||||
// Don't increase stats if opposing battler has Encore
|
||||
if (HasBattlerSideMoveWithEffect(battlerDef, EFFECT_ENCORE))
|
||||
return FALSE;
|
||||
|
||||
// Don't increase stats if opposing battler has used Haze effect or AI effect
|
||||
if (!RandomPercentage(RNG_AI_BOOST_INTO_HAZE, BOOST_INTO_HAZE_CHANCE)
|
||||
&& HasBattlerSideUsedMoveWithEffect(battlerDef, EFFECT_HAZE))
|
||||
@ -2186,10 +2182,6 @@ u32 IncreaseStatDownScore(u32 battlerAtk, u32 battlerDef, u32 stat)
|
||||
if (GetBattlerSecondaryDamage(battlerDef) >= gBattleMons[battlerDef].hp)
|
||||
return NO_INCREASE;
|
||||
|
||||
// Don't decrease stat if opposing battler has Encore
|
||||
if (HasBattlerSideMoveWithEffect(battlerDef, EFFECT_ENCORE))
|
||||
return NO_INCREASE;
|
||||
|
||||
if (DoesAbilityRaiseStatsWhenLowered(gAiLogicData->abilities[battlerDef]))
|
||||
return NO_INCREASE;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user