Use move flags instead of lists for AI calcs (#3389)

This commit is contained in:
Alex 2023-10-07 19:31:25 +02:00 committed by GitHub
parent 410dc1d6c0
commit 28506b4cf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 68 deletions

View file

@ -112,8 +112,6 @@ bool32 IsStatLoweringMoveEffect(u32 moveEffect);
bool32 IsMoveRedirectionPrevented(u32 move, u32 atkAbility);
bool32 IsMoveEncouragedToHit(u32 battlerAtk, u32 battlerDef, u32 move);
bool32 IsHazardMoveEffect(u32 moveEffect);
bool32 MoveCallsOtherMove(u32 move);
bool32 MoveRequiresRecharging(u32 move);
bool32 IsEncoreEncouragedEffect(u32 moveEffect);
void ProtectChecks(u32 battlerAtk, u32 battlerDef, u32 move, u32 predictedMove, s32 *score);
bool32 ShouldSetSandstorm(u32 battler, u32 ability, u32 holdEffect);

View file

@ -2534,8 +2534,7 @@ static s32 AI_CheckBadMove(u32 battlerAtk, u32 battlerDef, u32 move, s32 score)
if (instructedMove == MOVE_NONE
|| gBattleMoves[instructedMove].instructBanned
|| MoveRequiresRecharging(instructedMove)
|| MoveCallsOtherMove(instructedMove)
|| gBattleMoves[instructedMove].effect == EFFECT_RECHARGE
|| IsZMove(instructedMove)
|| (gLockedMoves[battlerDef] != 0 && gLockedMoves[battlerDef] != 0xFFFF)
|| gBattleMons[battlerDef].status2 & STATUS2_MULTIPLETURNS

View file

@ -383,41 +383,6 @@ static const u16 sIgnoredPowerfulMoveEffects[] =
IGNORED_MOVES_END
};
static const u16 sIgnoreMoldBreakerMoves[] =
{
MOVE_MOONGEIST_BEAM,
MOVE_SUNSTEEL_STRIKE,
MOVE_PHOTON_GEYSER,
MOVE_LIGHT_THAT_BURNS_THE_SKY,
MOVE_MENACING_MOONRAZE_MAELSTROM,
MOVE_SEARING_SUNRAZE_SMASH,
};
static const u16 sRechargeMoves[] =
{
MOVE_HYPER_BEAM,
MOVE_BLAST_BURN,
MOVE_HYDRO_CANNON,
MOVE_FRENZY_PLANT,
MOVE_GIGA_IMPACT,
MOVE_ROCK_WRECKER,
MOVE_ROAR_OF_TIME,
MOVE_PRISMATIC_LASER,
MOVE_METEOR_ASSAULT,
MOVE_ETERNABEAM,
};
static const u16 sOtherMoveCallingMoves[] =
{
MOVE_ASSIST,
MOVE_COPYCAT,
MOVE_ME_FIRST,
MOVE_METRONOME,
MOVE_MIRROR_MOVE,
MOVE_NATURE_POWER,
MOVE_SLEEP_TALK,
};
// Functions
u32 GetAIChosenMove(u32 battlerId)
{
@ -1505,13 +1470,7 @@ bool32 DoesBattlerIgnoreAbilityChecks(u32 atkAbility, u32 move)
if (AI_THINKING_STRUCT->aiFlags & AI_FLAG_NEGATE_UNAWARE)
return FALSE; // AI handicap flag: doesn't understand ability suppression concept
for (i = 0; i < ARRAY_COUNT(sIgnoreMoldBreakerMoves); i++)
{
if (move == sIgnoreMoldBreakerMoves[i])
return TRUE;
}
if (IsMoldBreakerTypeAbility(atkAbility))
if (IsMoldBreakerTypeAbility(atkAbility) || gBattleMoves[move].ignoresTargetAbility)
return TRUE;
return FALSE;
@ -2453,28 +2412,6 @@ bool32 IsEncoreEncouragedEffect(u32 moveEffect)
return FALSE;
}
bool32 MoveRequiresRecharging(u32 move)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sRechargeMoves); i++)
{
if (move == sRechargeMoves[i])
return TRUE;
}
return FALSE;
}
bool32 MoveCallsOtherMove(u32 move)
{
u32 i;
for (i = 0; i < ARRAY_COUNT(sOtherMoveCallingMoves); i++)
{
if (move == sOtherMoveCallingMoves[i])
return TRUE;
}
return FALSE;
}
static u32 GetLeechSeedDamage(u32 battlerId)
{
u32 damage = 0;