Use MAX_MON_MOVES in Cmd_trysetencore

This commit is contained in:
sphericalice 2022-07-11 15:23:23 +01:00
parent 186f2c0232
commit 167353223c

View File

@ -2553,9 +2553,9 @@ void SetMoveEffect(bool8 primary, u8 certain)
case MOVE_EFFECT_PAYDAY: case MOVE_EFFECT_PAYDAY:
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER) if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER)
{ {
u16 payDay = gPaydayMoney; u16 payday = gPaydayMoney;
gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5); gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5);
if (payDay > gPaydayMoney) if (payday > gPaydayMoney)
gPaydayMoney = 0xFFFF; gPaydayMoney = 0xFFFF;
} }
BattleScriptPush(gBattlescriptCurrInstr + 1); BattleScriptPush(gBattlescriptCurrInstr + 1);
@ -7938,11 +7938,11 @@ static void Cmd_trysetencore(void)
|| gLastMoves[gBattlerTarget] == MOVE_ENCORE || gLastMoves[gBattlerTarget] == MOVE_ENCORE
|| gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE)
{ {
i = 4; i = MAX_MON_MOVES;
} }
if (gDisableStructs[gBattlerTarget].encoredMove == MOVE_NONE if (gDisableStructs[gBattlerTarget].encoredMove == MOVE_NONE
&& i != 4 && gBattleMons[gBattlerTarget].pp[i] != 0) && i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
{ {
gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i]; gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i];
gDisableStructs[gBattlerTarget].encoredMovePos = i; gDisableStructs[gBattlerTarget].encoredMovePos = i;