diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 547ec060f..f83fa8522 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -108,7 +108,6 @@ bool32 HasHealingEffect(u32 battler); bool32 IsTrappingMoveEffect(u16 effect); bool32 HasTrappingMoveEffect(u8 battler); bool32 ShouldFakeOut(u8 battlerAtk, u8 battlerDef, u16 move); -bool32 IsThawingMove(u16 move); bool32 HasThawingMove(u8 battlerId); bool32 IsStatRaisingEffect(u16 effect); bool32 IsStatLoweringEffect(u16 effect); diff --git a/include/battle_util.h b/include/battle_util.h index b26ea0939..cae5f7338 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -135,6 +135,7 @@ struct Pokemon *GetBattlerPartyData(u8 battlerId); bool32 CanFling(u8 battlerId); bool32 IsTelekinesisBannedSpecies(u16 species); bool32 IsHealBlockPreventingMove(u32 battler, u32 move); +bool32 IsThawingMove(u8 battlerId, u16 move); // ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 7f76e35f9..55080a756 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -108,7 +108,7 @@ void BattleAI_SetupItems(void) if ((gBattleTypeFlags & BATTLE_TYPE_TRAINER) && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_SAFARI | BATTLE_TYPE_BATTLE_TOWER | BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_SECRET_BASE | BATTLE_TYPE_FRONTIER - | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_x2000000) + | BATTLE_TYPE_INGAME_PARTNER | BATTLE_TYPE_RECORDED_LINK) ) ) { @@ -528,10 +528,9 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) { // handle negative checks on non-user target // check powder moves - if (TestMoveFlags(move, FLAG_POWDER)) + if (TestMoveFlags(move, FLAG_POWDER) && !IsAffectedByPowder(battlerDef, AI_DATA->defAbility, AI_DATA->defHoldEffect)) { - if (!IsAffectedByPowder(battlerDef, AI_DATA->defAbility, AI_DATA->defHoldEffect)) - score -= 10; + RETURN_SCORE_MINUS(20); } // check ground immunities @@ -543,11 +542,11 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) || (gStatuses3[battlerDef] & (STATUS3_MAGNET_RISE | STATUS3_TELEKINESIS))) && move != MOVE_THOUSAND_ARROWS) { - score -= 10; + RETURN_SCORE_MINUS(20); } // check off screen - if (IsSemiInvulnerable(battlerDef, move) && effect != EFFECT_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1) + if (IsSemiInvulnerable(battlerDef, move) && moveEffect != EFFECT_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1) RETURN_SCORE_MINUS(20); // if target off screen and we go first, don't use move // check if negates type @@ -2883,7 +2882,7 @@ static s16 AI_CheckViability(u8 battlerAtk, u8 battlerDef, u16 move, s16 score) score++; // check thawing moves - if ((gBattleMons[battlerAtk].status1 & STATUS1_FREEZE) && IsThawingMove(move)) + if ((gBattleMons[battlerAtk].status1 & STATUS1_FREEZE) && IsThawingMove(battlerAtk, move)) score += (gBattleTypeFlags & BATTLE_TYPE_DOUBLE) ? 20 : 10; // ability checks diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 8d5577603..9ede3ae99 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -1922,25 +1922,6 @@ bool32 HasTrappingMoveEffect(u8 battler) return FALSE; } -bool32 IsThawingMove(u16 move) -{ - switch (move) - { - case MOVE_FLAME_WHEEL: - case MOVE_SACRED_FIRE: - case MOVE_FLARE_BLITZ: - case MOVE_SCALD: - case MOVE_SCORCHING_SANDS: - case MOVE_FUSION_FLARE: - case MOVE_STEAM_ERUPTION: - case MOVE_BURN_UP: - case MOVE_PYRO_BALL: - return TRUE; - default: - return FALSE; - } -} - bool32 HasThawingMove(u8 battlerId) { s32 i; @@ -1948,7 +1929,7 @@ bool32 HasThawingMove(u8 battlerId) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && IsThawingMove(moves[i])) + if (moves[i] != MOVE_NONE && moves[i] != 0xFFFF && IsThawingMove(battlerId, moves[i])) return TRUE; } @@ -2545,7 +2526,7 @@ bool32 CanKnockOffItem(u8 battler, u16 item) if (!(gBattleTypeFlags & (BATTLE_TYPE_EREADER_TRAINER | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_LINK - | BATTLE_TYPE_x2000000 + | BATTLE_TYPE_RECORDED_LINK | BATTLE_TYPE_SECRET_BASE #if defined B_TRAINERS_KNOCK_OFF_ITEMS | BATTLE_TYPE_TRAINER diff --git a/src/battle_util.c b/src/battle_util.c index e06c17d66..7aef03591 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2963,7 +2963,7 @@ void TryClearRageAndFuryCutter(void) } } -static bool32 IsThawingMove(u8 battlerId, u16 move) +bool32 IsThawingMove(u8 battlerId, u16 move) { switch (move) {