AI handles dynamic move types

This will make the AI account for the type of moves like Weather Ball, Hidden Power and Revelation Dance when considering abilities that make the useless. E.g. Water-type Hidden Power vs. Storm Drain.
This commit is contained in:
BuffelSaft 2021-10-06 21:53:30 +13:00
parent a48dec2e31
commit 38b816ccdd

View file

@ -520,6 +520,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
u32 i;
u16 predictedMove = gLastMoves[battlerDef]; // TODO better move prediction
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
if (IsTargetingPartner(battlerAtk, battlerDef))
return score;
@ -2473,6 +2476,9 @@ static s16 AI_DoubleBattle(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
bool32 partnerHasBadAbility = (GetAbilityRating(atkPartnerAbility) < 0);
u16 predictedMove = gLastMoves[battlerDef]; //for now
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
// check what effect partner is using
if (AI_DATA->partnerMove != 0)
{
@ -4752,6 +4758,9 @@ static s16 AI_HPAware(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
u16 effect = gBattleMoves[move].effect;
u8 moveType = gBattleMoves[move].type;
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
if (IsTargetingPartner(battlerAtk, battlerDef))
{
if ((effect == EFFECT_HEAL_PULSE || effect == EFFECT_HIT_ENEMY_HEAL_ALLY)