AI logic for Charge

This commit is contained in:
Eduardo Quezada D'Ottone 2022-07-20 14:44:57 -04:00
parent e14afd8957
commit b8ea412e61
2 changed files with 6 additions and 1 deletions

View File

@ -985,8 +985,10 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
score -= 20;
else if (!HasMoveWithType(battlerAtk, TYPE_ELECTRIC))
score -= 10;
#if B_CHARGE_SPDEF_RAISE >= GEN_5
else if (!BattlerStatCanRise(battlerAtk, AI_DATA->abilities[battlerAtk], STAT_SPDEF))
score -= 5;
#endif
break;
case EFFECT_QUIVER_DANCE:
case EFFECT_GEOMANCY:
@ -4051,8 +4053,9 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
case EFFECT_CHARGE:
if (HasDamagingMoveOfType(battlerAtk, TYPE_ELECTRIC))
score += 2;
#if B_CHARGE_SPDEF_RAISE >= GEN_5
IncreaseStatUpScore(battlerAtk, battlerDef, STAT_SPDEF, &score);
#endif
break;
case EFFECT_TAUNT:
if (IS_MOVE_STATUS(predictedMove))

View File

@ -2063,7 +2063,9 @@ bool32 IsStatRaisingEffect(u16 effect)
case EFFECT_EVASION_UP_2:
case EFFECT_MINIMIZE:
case EFFECT_DEFENSE_CURL:
#if B_CHARGE_SPDEF_RAISE >= GEN_5
case EFFECT_CHARGE:
#endif
case EFFECT_CALM_MIND:
case EFFECT_COSMIC_POWER:
case EFFECT_DRAGON_DANCE: