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.
This commit is contained in:
WillKolada 2024-05-02 01:42:08 -05:00 committed by GitHub
parent d59ef3710a
commit 2aed78ebbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)