Introduce a MOVE_UNAVAILABLE constant

This commit is contained in:
sphericalice
2022-07-11 15:18:13 +01:00
parent 15f386ede6
commit 186f2c0232
7 changed files with 112 additions and 89 deletions
+9 -6
View File
@@ -127,9 +127,9 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
if (HasSuperEffectiveMoveAgainstOpponents(TRUE) && Random() % 3 != 0)
return FALSE;
if (gLastLandedMoves[gActiveBattler] == 0)
if (gLastLandedMoves[gActiveBattler] == MOVE_NONE)
return FALSE;
if (gLastLandedMoves[gActiveBattler] == 0xFFFF)
if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE)
return FALSE;
if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0)
return FALSE;
@@ -224,13 +224,16 @@ static bool8 ShouldSwitchIfNaturalCure(void)
if (gBattleMons[gActiveBattler].hp < gBattleMons[gActiveBattler].maxHP / 2)
return FALSE;
if ((gLastLandedMoves[gActiveBattler] == 0 || gLastLandedMoves[gActiveBattler] == 0xFFFF) && Random() & 1)
if ((gLastLandedMoves[gActiveBattler] == MOVE_NONE
|| gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE)
&& Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
return TRUE;
}
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0 && Random() & 1)
else if (gBattleMoves[gLastLandedMoves[gActiveBattler]].power == 0
&& Random() & 1)
{
*(gBattleStruct->AI_monToSwitchIntoId + gActiveBattler) = PARTY_SIZE;
BtlController_EmitTwoReturnValues(BUFFER_B, B_ACTION_SWITCH, 0);
@@ -332,9 +335,9 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
u16 move;
u8 moveFlags;
if (gLastLandedMoves[gActiveBattler] == 0)
if (gLastLandedMoves[gActiveBattler] == MOVE_NONE)
return FALSE;
if (gLastLandedMoves[gActiveBattler] == 0xFFFF)
if (gLastLandedMoves[gActiveBattler] == MOVE_UNAVAILABLE)
return FALSE;
if (gLastHitBy[gActiveBattler] == 0xFF)
return FALSE;