Fix AI using normal moves on ground mons with Galvanize

This commit is contained in:
DizzyEggg 2020-07-15 12:31:50 +02:00
parent 62dc94e9c8
commit c10be546bc

View file

@ -933,7 +933,7 @@ s32 AI_CalcPartyMonDamage(u16 move, u8 battlerAtk, u8 battlerDef, struct Pokemon
u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef)
{
u16 typeEffectiveness;
u16 typeEffectiveness, moveType;
SaveBattlerData(battlerAtk);
SaveBattlerData(battlerDef);
@ -941,7 +941,10 @@ u16 AI_GetTypeEffectiveness(u16 move, u8 battlerAtk, u8 battlerDef)
SetBattlerData(battlerAtk);
SetBattlerData(battlerDef);
typeEffectiveness = CalcTypeEffectivenessMultiplier(move, gBattleMoves[move].type, battlerAtk, battlerDef, FALSE);
gBattleStruct->dynamicMoveType = 0;
SetTypeBeforeUsingMove(move, battlerAtk);
GET_MOVE_TYPE(move, moveType);
typeEffectiveness = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, FALSE);
RestoreBattlerData(battlerAtk);
RestoreBattlerData(battlerDef);
@ -1706,12 +1709,9 @@ static void Cmd_check_ability(void)
static void Cmd_get_highest_type_effectiveness(void)
{
s32 i;
u8 *dynamicMoveType;
gBattleStruct->dynamicMoveType = 0;
gMoveResultFlags = 0;
AI_THINKING_STRUCT->funcResult = 0;
for (i = 0; i < MAX_MON_MOVES; i++)
{
gCurrentMove = gBattleMons[sBattler_AI].moves[i];
@ -1755,10 +1755,8 @@ static void Cmd_if_type_effectiveness(void)
u8 damageVar;
u32 effectivenessMultiplier;
gBattleStruct->dynamicMoveType = 0;
gMoveResultFlags = 0;
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;
effectivenessMultiplier = AI_GetTypeEffectiveness(gCurrentMove, sBattler_AI, gBattlerTarget);
switch (effectivenessMultiplier)
{