From 2aed78ebbb762720e064c09c62cf806751cb139b Mon Sep 17 00:00:00 2001 From: WillKolada <57021938+WillKolada@users.noreply.github.com> Date: Thu, 2 May 2024 01:42:08 -0500 Subject: [PATCH] Update IsDamageMoveUsable to check for Steel Roller viability (#4476) * Update IsDamageMoveUsable to check for Steel Roller viability * Condense terrain flag checks and renamed IsDamageMoveUsable IsDamageMoveUsable is now named IsDamageMoveUnusable to more accurately reflect the boolean it returns. --- src/battle_ai_util.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/battle_ai_util.c b/src/battle_ai_util.c index 40f3da2b5a..2dc9946e3d 100644 --- a/src/battle_ai_util.c +++ b/src/battle_ai_util.c @@ -366,7 +366,7 @@ static inline s32 LowestRollDmg(s32 dmg) return dmg; } -bool32 IsDamageMoveUsable(u32 move, u32 battlerAtk, u32 battlerDef) +bool32 IsDamageMoveUnusable(u32 move, u32 battlerAtk, u32 battlerDef) { s32 moveType; struct AiLogicData *aiData = AI_DATA; @@ -438,6 +438,10 @@ bool32 IsDamageMoveUsable(u32 move, u32 battlerAtk, u32 battlerDef) if (!IS_BATTLER_OF_TYPE(battlerAtk, gMovesInfo[move].argument)) return TRUE; break; + case EFFECT_HIT_SET_REMOVE_TERRAIN: + if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_ANY)) + return TRUE; + break; } return FALSE; @@ -472,7 +476,7 @@ s32 AI_CalcDamage(u32 move, u32 battlerAtk, u32 battlerDef, u8 *typeEffectivenes GET_MOVE_TYPE(move, moveType); if (gMovesInfo[move].power) - isDamageMoveUnusable = IsDamageMoveUsable(move, battlerAtk, battlerDef); + isDamageMoveUnusable = IsDamageMoveUnusable(move, battlerAtk, battlerDef); effectivenessMultiplier = CalcTypeEffectivenessMultiplier(move, moveType, battlerAtk, battlerDef, aiData->abilities[battlerDef], FALSE); if (gMovesInfo[move].power && !isDamageMoveUnusable)