From 236f42e8023dd99547fec4dae27e7ad0fae46073 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 21 Dec 2023 13:00:49 +0100 Subject: [PATCH] same lists for healing moves --- include/battle_ai_util.h | 2 +- src/battle_ai_main.c | 2 +- src/battle_ai_util.c | 25 +++---------------------- src/battle_dome.c | 10 +++++----- src/battle_main.c | 2 +- 5 files changed, 11 insertions(+), 30 deletions(-) diff --git a/include/battle_ai_util.h b/include/battle_ai_util.h index 9b30d103e4b9..983526510935 100644 --- a/include/battle_ai_util.h +++ b/include/battle_ai_util.h @@ -119,7 +119,7 @@ bool32 ShouldSetSnow(u32 battler, u32 ability, u32 holdEffect); bool32 ShouldSetRain(u32 battlerAtk, u32 ability, u32 holdEffect); bool32 ShouldSetSun(u32 battlerAtk, u32 atkAbility, u32 holdEffect); bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef); -bool32 IsHealingMoveEffect(u32 effect); +bool32 IsHealingMove(u32 move); bool32 HasHealingEffect(u32 battler); bool32 IsTrappingMoveEffect(u32 effect); bool32 HasTrappingMoveEffect(u32 battler); diff --git a/src/battle_ai_main.c b/src/battle_ai_main.c index 4f7d04438b3f..d2e381687279 100644 --- a/src/battle_ai_main.c +++ b/src/battle_ai_main.c @@ -4715,7 +4715,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score ADJUST_SCORE(3); break; case EFFECT_HEAL_BLOCK: - if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER && predictedMove != MOVE_NONE && IsHealingMoveEffect(gBattleMoves[predictedMove].effect)) + if (AI_WhoStrikesFirst(battlerAtk, battlerDef, move) == AI_IS_FASTER && predictedMove != MOVE_NONE && IsHealingMove(predictedMove)) ADJUST_SCORE(3); // Try to cancel healing move else if (HasHealingEffect(battlerDef) || aiData->holdEffects[battlerDef] == HOLD_EFFECT_LEFTOVERS || (aiData->holdEffects[battlerDef] == HOLD_EFFECT_BLACK_SLUDGE && IS_BATTLER_OF_TYPE(battlerDef, TYPE_POISON))) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 967d31bc073e..71f3aa7d27e3 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -2017,28 +2017,9 @@ bool32 HasSleepMoveWithLowAccuracy(u32 battlerAtk, u32 battlerDef) return FALSE; } -bool32 IsHealingMoveEffect(u32 effect) +bool32 IsHealingMove(u32 move) { - switch (effect) - { - case EFFECT_RESTORE_HP: - case EFFECT_MORNING_SUN: - case EFFECT_SYNTHESIS: - case EFFECT_MOONLIGHT: - case EFFECT_SOFTBOILED: - case EFFECT_ROOST: - case EFFECT_SWALLOW: - case EFFECT_WISH: - case EFFECT_HEALING_WISH: - case EFFECT_HEAL_PULSE: - case EFFECT_REST: - case EFFECT_JUNGLE_HEALING: - case EFFECT_ABSORB: - case EFFECT_DREAM_EATER: - return TRUE; - default: - return FALSE; - } + return gBattleMoves[move].healBlockBanned; } bool32 HasHealingEffect(u32 battlerId) @@ -2048,7 +2029,7 @@ bool32 HasHealingEffect(u32 battlerId) for (i = 0; i < MAX_MON_MOVES; i++) { - if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsHealingMoveEffect(gBattleMoves[moves[i]].effect)) + if (moves[i] != MOVE_NONE && moves[i] != MOVE_UNAVAILABLE && IsHealingMove(moves[i])) return TRUE; } diff --git a/src/battle_dome.c b/src/battle_dome.c index 05b8ebec4a26..f4563666fccd 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -3928,12 +3928,12 @@ static u8 Task_GetInfoCardInput(u8 taskId) #undef tUsingAlternateSlot -static bool32 IsDomeHealingMoveEffect(u32 effect) +static bool32 IsDomeHealingMove(u32 move) { - if (IsHealingMoveEffect(effect)) + if (IsHealingMove(move)) return TRUE; // Check extra effects not considered plain healing by AI - switch(effect) + switch (gBattleMoves[move].effect) { case EFFECT_INGRAIN: case EFFECT_REFRESH: @@ -4343,7 +4343,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) move = gSaveBlock2Ptr->frontier.domePlayerPartyData[i].moves[j]; else move = gFacilityTrainerMons[DOME_MONS[trainerTourneyId][i]].moves[j]; - + switch (k) { case MOVE_POINTS_COMBO: @@ -4359,7 +4359,7 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) allocatedArray[k] = IsDomeRareMove(move) ? 1 : 0; break; case MOVE_POINTS_HEAL: - allocatedArray[k] = IsDomeHealingMoveEffect(gBattleMoves[move].effect) ? 1 : 0; + allocatedArray[k] = IsDomeHealingMove(move) ? 1 : 0; break; case MOVE_POINTS_RISKY: allocatedArray[k] = IsDomeRiskyMoveEffect(gBattleMoves[move].effect) ? 1 : 0; diff --git a/src/battle_main.c b/src/battle_main.c index a6eb17c130bb..1216d8dd3735 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4687,7 +4687,7 @@ s8 GetMovePriority(u32 battler, u16 move) { priority++; } - else if (ability == ABILITY_TRIAGE && IsHealingMoveEffect(gBattleMoves[move].effect)) + else if (ability == ABILITY_TRIAGE && IsHealingMove(move)) priority += 3; if (gProtectStructs[battler].quash)