mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Merge pull request #1705 from sphericalice/move-unavailable
Introduces a MOVE_UNAVAILABLE constant
This commit is contained in:
commit
30a5821997
@ -359,4 +359,7 @@
|
||||
|
||||
#define MOVES_COUNT 355
|
||||
|
||||
// Used for checks for moves affected by Disable, Mimic, etc.
|
||||
#define MOVE_UNAVAILABLE 0xFFFF
|
||||
|
||||
#endif // GUARD_CONSTANTS_MOVES_H
|
||||
|
@ -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;
|
||||
|
@ -2747,7 +2747,7 @@ static int GetTypeEffectivenessPoints(int move, int targetSpecies, int mode)
|
||||
int i = 0;
|
||||
int typePower = TYPE_x1;
|
||||
|
||||
if (move == MOVE_NONE || move == 0xFFFF || gBattleMoves[move].power == 0)
|
||||
if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || gBattleMoves[move].power == 0)
|
||||
return 0;
|
||||
|
||||
defType1 = gBaseStats[targetSpecies].type1;
|
||||
|
@ -2355,7 +2355,7 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
break;
|
||||
if (gBattleMons[gEffectBattler].status1)
|
||||
break;
|
||||
if (noSunCanFreeze == 0)
|
||||
if (noSunCanFreeze == FALSE)
|
||||
break;
|
||||
if (gBattleMons[gEffectBattler].ability == ABILITY_MAGMA_ARMOR)
|
||||
break;
|
||||
@ -2553,9 +2553,9 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
case MOVE_EFFECT_PAYDAY:
|
||||
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER)
|
||||
{
|
||||
u16 PayDay = gPaydayMoney;
|
||||
u16 payday = gPaydayMoney;
|
||||
gPaydayMoney += (gBattleMons[gBattlerAttacker].level * 5);
|
||||
if (PayDay > gPaydayMoney)
|
||||
if (payday > gPaydayMoney)
|
||||
gPaydayMoney = 0xFFFF;
|
||||
}
|
||||
BattleScriptPush(gBattlescriptCurrInstr + 1);
|
||||
@ -2743,10 +2743,10 @@ void SetMoveEffect(bool8 primary, u8 certain)
|
||||
gLastUsedAbility = gBattleMons[gBattlerTarget].ability;
|
||||
RecordAbilityBattle(gBattlerTarget, gLastUsedAbility);
|
||||
}
|
||||
else if (gBattleMons[gBattlerAttacker].item != 0
|
||||
else if (gBattleMons[gBattlerAttacker].item != ITEM_NONE
|
||||
|| gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY
|
||||
|| IS_ITEM_MAIL(gBattleMons[gBattlerTarget].item)
|
||||
|| gBattleMons[gBattlerTarget].item == 0)
|
||||
|| gBattleMons[gBattlerTarget].item == ITEM_NONE)
|
||||
{
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
@ -4184,8 +4184,8 @@ static void Cmd_moveend(void)
|
||||
u8 endMode, endState;
|
||||
u16 originallyUsedMove;
|
||||
|
||||
if (gChosenMove == 0xFFFF)
|
||||
originallyUsedMove = 0;
|
||||
if (gChosenMove == MOVE_UNAVAILABLE)
|
||||
originallyUsedMove = MOVE_NONE;
|
||||
else
|
||||
originallyUsedMove = gChosenMove;
|
||||
|
||||
@ -4206,10 +4206,13 @@ static void Cmd_moveend(void)
|
||||
{
|
||||
case MOVEEND_RAGE: // rage check
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_RAGE
|
||||
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& gBattlerAttacker != gBattlerTarget
|
||||
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget)
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && TARGET_TURN_DAMAGED
|
||||
&& gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& TARGET_TURN_DAMAGED
|
||||
&& gBattleMoves[gCurrentMove].power != 0
|
||||
&& gBattleMons[gBattlerTarget].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gBattlerTarget].statStages[STAT_ATK]++;
|
||||
BattleScriptPushCursor();
|
||||
@ -4220,9 +4223,11 @@ static void Cmd_moveend(void)
|
||||
break;
|
||||
case MOVEEND_DEFROST: // defrosting check
|
||||
if (gBattleMons[gBattlerTarget].status1 & STATUS1_FREEZE
|
||||
&& gBattleMons[gBattlerTarget].hp != 0 && gBattlerAttacker != gBattlerTarget
|
||||
&& gBattleMons[gBattlerTarget].hp != 0
|
||||
&& gBattlerAttacker != gBattlerTarget
|
||||
&& gSpecialStatuses[gBattlerTarget].specialDmg
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT) && moveType == TYPE_FIRE)
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
&& moveType == TYPE_FIRE)
|
||||
{
|
||||
gBattleMons[gBattlerTarget].status1 &= ~STATUS1_FREEZE;
|
||||
gActiveBattler = gBattlerTarget;
|
||||
@ -4259,7 +4264,7 @@ static void Cmd_moveend(void)
|
||||
if (gHitMarker & HITMARKER_OBEYS
|
||||
&& holdEffectAtk == HOLD_EFFECT_CHOICE_BAND
|
||||
&& gChosenMove != MOVE_STRUGGLE
|
||||
&& (*choicedMoveAtk == 0 || *choicedMoveAtk == 0xFFFF))
|
||||
&& (*choicedMoveAtk == MOVE_NONE || *choicedMoveAtk == MOVE_UNAVAILABLE))
|
||||
{
|
||||
if (gChosenMove == MOVE_BATON_PASS && !(gMoveResultFlags & MOVE_RESULT_FAILED))
|
||||
{
|
||||
@ -4274,17 +4279,17 @@ static void Cmd_moveend(void)
|
||||
break;
|
||||
}
|
||||
if (i == MAX_MON_MOVES)
|
||||
*choicedMoveAtk = 0;
|
||||
*choicedMoveAtk = MOVE_NONE;
|
||||
++gBattleScripting.moveendState;
|
||||
break;
|
||||
case MOVEEND_CHANGED_ITEMS: // changed held items
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
u16* changedItem = &gBattleStruct->changedItems[i];
|
||||
if (*changedItem != 0)
|
||||
if (*changedItem != ITEM_NONE)
|
||||
{
|
||||
gBattleMons[i].item = *changedItem;
|
||||
*changedItem = 0;
|
||||
*changedItem = ITEM_NONE;
|
||||
}
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
@ -4371,8 +4376,8 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gLastMoves[gBattlerAttacker] = 0xFFFF;
|
||||
gLastResultingMoves[gBattlerAttacker] = 0xFFFF;
|
||||
gLastMoves[gBattlerAttacker] = MOVE_UNAVAILABLE;
|
||||
gLastResultingMoves[gBattlerAttacker] = MOVE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
if (!(gHitMarker & HITMARKER_FAINTED(gBattlerTarget)))
|
||||
@ -4380,7 +4385,7 @@ static void Cmd_moveend(void)
|
||||
|
||||
if (gHitMarker & HITMARKER_OBEYS && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
if (gChosenMove == 0xFFFF)
|
||||
if (gChosenMove == MOVE_UNAVAILABLE)
|
||||
{
|
||||
gLastLandedMoves[gBattlerTarget] = gChosenMove;
|
||||
}
|
||||
@ -4392,15 +4397,18 @@ static void Cmd_moveend(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
gLastLandedMoves[gBattlerTarget] = 0xFFFF;
|
||||
gLastLandedMoves[gBattlerTarget] = MOVE_UNAVAILABLE;
|
||||
}
|
||||
}
|
||||
gBattleScripting.moveendState++;
|
||||
break;
|
||||
case MOVEEND_MIRROR_MOVE: // mirror move
|
||||
if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker]) && !(gBattleStruct->absentBattlerFlags & gBitTable[gBattlerAttacker])
|
||||
&& gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED && gHitMarker & HITMARKER_OBEYS
|
||||
&& gBattlerAttacker != gBattlerTarget && !(gHitMarker & HITMARKER_FAINTED(gBattlerTarget))
|
||||
if (!(gAbsentBattlerFlags & gBitTable[gBattlerAttacker])
|
||||
&& !(gBattleStruct->absentBattlerFlags & gBitTable[gBattlerAttacker])
|
||||
&& gBattleMoves[originallyUsedMove].flags & FLAG_MIRROR_MOVE_AFFECTED
|
||||
&& gHitMarker & HITMARKER_OBEYS
|
||||
&& gBattlerAttacker != gBattlerTarget
|
||||
&& !(gHitMarker & HITMARKER_FAINTED(gBattlerTarget))
|
||||
&& !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT))
|
||||
{
|
||||
u8 target, attacker;
|
||||
@ -6585,10 +6593,10 @@ static void Cmd_trymirrormove(void)
|
||||
s32 validMovesCount;
|
||||
s32 i;
|
||||
u16 move;
|
||||
u16 movesArray[4];
|
||||
u16 validMoves[MAX_BATTLERS_COUNT];
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
movesArray[i] = 0;
|
||||
for (i = 0; i < (MAX_BATTLERS_COUNT - 1); i++) // -1 to exclude the user
|
||||
validMoves[i] = MOVE_NONE;
|
||||
|
||||
for (validMovesCount = 0, i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
@ -6597,9 +6605,9 @@ static void Cmd_trymirrormove(void)
|
||||
move = *(i * 2 + gBattlerAttacker * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 0)
|
||||
| (*(i * 2 + gBattlerAttacker * 8 + (u8*)(gBattleStruct->lastTakenMoveFrom) + 1) << 8);
|
||||
|
||||
if (move != 0 && move != 0xFFFF)
|
||||
if (move != MOVE_NONE && move != MOVE_UNAVAILABLE)
|
||||
{
|
||||
movesArray[validMovesCount] = move;
|
||||
validMoves[validMovesCount] = move;
|
||||
validMovesCount++;
|
||||
}
|
||||
}
|
||||
@ -6608,24 +6616,24 @@ static void Cmd_trymirrormove(void)
|
||||
move = *(gBattleStruct->lastTakenMove + gBattlerAttacker * 2 + 0)
|
||||
| (*(gBattleStruct->lastTakenMove + gBattlerAttacker * 2 + 1) << 8);
|
||||
|
||||
if (move != 0 && move != 0xFFFF)
|
||||
if (move != MOVE_NONE && move != MOVE_UNAVAILABLE)
|
||||
{
|
||||
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
|
||||
gCurrentMove = move;
|
||||
gBattlerTarget = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE);
|
||||
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
|
||||
}
|
||||
else if (validMovesCount)
|
||||
else if (validMovesCount != 0)
|
||||
{
|
||||
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
|
||||
i = Random() % validMovesCount;
|
||||
gCurrentMove = movesArray[i];
|
||||
gCurrentMove = validMoves[i];
|
||||
gBattlerTarget = GetMoveTarget(gCurrentMove, NO_TARGET_OVERRIDE);
|
||||
gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect];
|
||||
}
|
||||
else
|
||||
else // no valid moves found
|
||||
{
|
||||
gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = 1;
|
||||
gSpecialStatuses[gBattlerAttacker].ppNotAffectedByPressure = TRUE;
|
||||
gBattlescriptCurrInstr++;
|
||||
}
|
||||
}
|
||||
@ -7164,7 +7172,7 @@ static void Cmd_forcerandomswitch(void)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_BATTLE_TOWER && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER))
|
||||
{
|
||||
if ((gBattlerTarget & BIT_FLANK) != 0)
|
||||
if ((gBattlerTarget & BIT_FLANK) != B_FLANK_LEFT)
|
||||
{
|
||||
firstMonId = 3;
|
||||
lastMonId = 6;
|
||||
@ -7182,7 +7190,7 @@ static void Cmd_forcerandomswitch(void)
|
||||
else if ((gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_LINK)
|
||||
|| (gBattleTypeFlags & BATTLE_TYPE_MULTI && gBattleTypeFlags & BATTLE_TYPE_RECORDED_LINK))
|
||||
{
|
||||
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == 1)
|
||||
if (GetLinkTrainerFlankId(GetBattlerMultiplayerId(gBattlerTarget)) == B_FLANK_RIGHT)
|
||||
{
|
||||
firstMonId = 3;
|
||||
lastMonId = 6;
|
||||
@ -7208,7 +7216,7 @@ static void Cmd_forcerandomswitch(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((gBattlerTarget & BIT_FLANK) != 0)
|
||||
if ((gBattlerTarget & BIT_FLANK) != B_FLANK_LEFT)
|
||||
{
|
||||
firstMonId = 3;
|
||||
lastMonId = 6;
|
||||
@ -7305,7 +7313,7 @@ static void Cmd_tryconversiontypechange(void) // randomly changes user's type to
|
||||
|
||||
while (validMoves < MAX_MON_MOVES)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].moves[validMoves] == 0)
|
||||
if (gBattleMons[gBattlerAttacker].moves[validMoves] == MOVE_NONE)
|
||||
break;
|
||||
|
||||
validMoves++;
|
||||
@ -7674,7 +7682,7 @@ static void Cmd_setfocusenergy(void)
|
||||
|
||||
static void Cmd_transformdataexecution(void)
|
||||
{
|
||||
gChosenMove = 0xFFFF;
|
||||
gChosenMove = MOVE_UNAVAILABLE;
|
||||
gBattlescriptCurrInstr++;
|
||||
if (gBattleMons[gBattlerTarget].status2 & STATUS2_TRANSFORMED
|
||||
|| gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)
|
||||
@ -7688,7 +7696,7 @@ static void Cmd_transformdataexecution(void)
|
||||
u8 *battleMonAttacker, *battleMonTarget;
|
||||
|
||||
gBattleMons[gBattlerAttacker].status2 |= STATUS2_TRANSFORMED;
|
||||
gDisableStructs[gBattlerAttacker].disabledMove = 0;
|
||||
gDisableStructs[gBattlerAttacker].disabledMove = MOVE_NONE;
|
||||
gDisableStructs[gBattlerAttacker].disableTimer = 0;
|
||||
gDisableStructs[gBattlerAttacker].transformedMonPersonality = gBattleMons[gBattlerTarget].personality;
|
||||
gDisableStructs[gBattlerAttacker].mimickedMoves = 0;
|
||||
@ -7754,12 +7762,12 @@ static bool8 IsMoveUncopyableByMimic(u16 move)
|
||||
|
||||
static void Cmd_mimicattackcopy(void)
|
||||
{
|
||||
gChosenMove = 0xFFFF;
|
||||
gChosenMove = MOVE_UNAVAILABLE;
|
||||
|
||||
if (IsMoveUncopyableByMimic(gLastMoves[gBattlerTarget])
|
||||
|| gBattleMons[gBattlerAttacker].status2 & STATUS2_TRANSFORMED
|
||||
|| gLastMoves[gBattlerTarget] == 0
|
||||
|| gLastMoves[gBattlerTarget] == 0xFFFF)
|
||||
|| gLastMoves[gBattlerTarget] == MOVE_NONE
|
||||
|| gLastMoves[gBattlerTarget] == MOVE_UNAVAILABLE)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
@ -7900,7 +7908,7 @@ static void Cmd_disablelastusedattack(void)
|
||||
if (gBattleMons[gBattlerTarget].moves[i] == gLastMoves[gBattlerTarget])
|
||||
break;
|
||||
}
|
||||
if (gDisableStructs[gBattlerTarget].disabledMove == 0
|
||||
if (gDisableStructs[gBattlerTarget].disabledMove == MOVE_NONE
|
||||
&& i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
|
||||
{
|
||||
PREPARE_MOVE_BUFFER(gBattleTextBuff1, gBattleMons[gBattlerTarget].moves[i])
|
||||
@ -7930,11 +7938,11 @@ static void Cmd_trysetencore(void)
|
||||
|| gLastMoves[gBattlerTarget] == MOVE_ENCORE
|
||||
|| gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE)
|
||||
{
|
||||
i = 4;
|
||||
i = MAX_MON_MOVES;
|
||||
}
|
||||
|
||||
if (gDisableStructs[gBattlerTarget].encoredMove == 0
|
||||
&& i != 4 && gBattleMons[gBattlerTarget].pp[i] != 0)
|
||||
if (gDisableStructs[gBattlerTarget].encoredMove == MOVE_NONE
|
||||
&& i != MAX_MON_MOVES && gBattleMons[gBattlerTarget].pp[i] != 0)
|
||||
{
|
||||
gDisableStructs[gBattlerTarget].encoredMove = gBattleMons[gBattlerTarget].moves[i];
|
||||
gDisableStructs[gBattlerTarget].encoredMovePos = i;
|
||||
@ -7975,7 +7983,7 @@ static void Cmd_painsplitdmgcalc(void)
|
||||
static void Cmd_settypetorandomresistance(void) // conversion 2
|
||||
{
|
||||
if (gLastLandedMoves[gBattlerAttacker] == MOVE_NONE
|
||||
|| gLastLandedMoves[gBattlerAttacker] == 0xFFFF)
|
||||
|| gLastLandedMoves[gBattlerAttacker] == MOVE_UNAVAILABLE)
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
|
||||
}
|
||||
@ -8042,12 +8050,12 @@ static void Cmd_setalwayshitflag(void)
|
||||
|
||||
static void Cmd_copymovepermanently(void) // sketch
|
||||
{
|
||||
gChosenMove = 0xFFFF;
|
||||
gChosenMove = MOVE_UNAVAILABLE;
|
||||
|
||||
if (!(gBattleMons[gBattlerAttacker].status2 & STATUS2_TRANSFORMED)
|
||||
&& gLastPrintedMoves[gBattlerTarget] != MOVE_STRUGGLE
|
||||
&& gLastPrintedMoves[gBattlerTarget] != 0
|
||||
&& gLastPrintedMoves[gBattlerTarget] != 0xFFFF
|
||||
&& gLastPrintedMoves[gBattlerTarget] != MOVE_NONE
|
||||
&& gLastPrintedMoves[gBattlerTarget] != MOVE_UNAVAILABLE
|
||||
&& gLastPrintedMoves[gBattlerTarget] != MOVE_SKETCH)
|
||||
{
|
||||
s32 i;
|
||||
@ -8108,8 +8116,11 @@ static bool8 IsTwoTurnsMove(u16 move)
|
||||
|
||||
static bool8 IsInvalidForSleepTalkOrAssist(u16 move)
|
||||
{
|
||||
if (move == 0 || move == MOVE_SLEEP_TALK || move == MOVE_ASSIST
|
||||
|| move == MOVE_MIRROR_MOVE || move == MOVE_METRONOME)
|
||||
if (move == MOVE_NONE
|
||||
|| move == MOVE_SLEEP_TALK
|
||||
|| move == MOVE_ASSIST
|
||||
|| move == MOVE_MIRROR_MOVE
|
||||
|| move == MOVE_METRONOME)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
@ -8215,8 +8226,8 @@ static void Cmd_remaininghptopower(void)
|
||||
|
||||
static void Cmd_tryspiteppreduce(void)
|
||||
{
|
||||
if (gLastMoves[gBattlerTarget] != 0
|
||||
&& gLastMoves[gBattlerTarget] != 0xFFFF)
|
||||
if (gLastMoves[gBattlerTarget] != MOVE_NONE
|
||||
&& gLastMoves[gBattlerTarget] != MOVE_UNAVAILABLE)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -9092,7 +9103,7 @@ static void Cmd_tryswapitems(void) // trick
|
||||
}
|
||||
// can't swap if two pokemon don't have an item
|
||||
// or if either of them is an enigma berry or a mail
|
||||
else if ((gBattleMons[gBattlerAttacker].item == 0 && gBattleMons[gBattlerTarget].item == 0)
|
||||
else if ((gBattleMons[gBattlerAttacker].item == ITEM_NONE && gBattleMons[gBattlerTarget].item == ITEM_NONE)
|
||||
|| gBattleMons[gBattlerAttacker].item == ITEM_ENIGMA_BERRY
|
||||
|| gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY
|
||||
|| IS_ITEM_MAIL(gBattleMons[gBattlerAttacker].item)
|
||||
@ -9150,7 +9161,7 @@ static void Cmd_tryswapitems(void) // trick
|
||||
|
||||
static void Cmd_trycopyability(void) // role play
|
||||
{
|
||||
if (gBattleMons[gBattlerTarget].ability != 0
|
||||
if (gBattleMons[gBattlerTarget].ability != ABILITY_NONE
|
||||
&& gBattleMons[gBattlerTarget].ability != ABILITY_WONDER_GUARD)
|
||||
{
|
||||
gBattleMons[gBattlerAttacker].ability = gBattleMons[gBattlerTarget].ability;
|
||||
@ -9263,8 +9274,8 @@ static void Cmd_scaledamagebyhealthratio(void)
|
||||
|
||||
static void Cmd_tryswapabilities(void) // skill swap
|
||||
{
|
||||
if ((gBattleMons[gBattlerAttacker].ability == 0
|
||||
&& gBattleMons[gBattlerTarget].ability == 0)
|
||||
if ((gBattleMons[gBattlerAttacker].ability == ABILITY_NONE
|
||||
&& gBattleMons[gBattlerTarget].ability == ABILITY_NONE)
|
||||
|| gBattleMons[gBattlerAttacker].ability == ABILITY_WONDER_GUARD
|
||||
|| gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD
|
||||
|| gMoveResultFlags & MOVE_RESULT_NO_EFFECT)
|
||||
@ -9358,7 +9369,7 @@ static void Cmd_assistattackselect(void)
|
||||
s32 chooseableMovesNo = 0;
|
||||
struct Pokemon* party;
|
||||
s32 monId, moveId;
|
||||
u16* movesArray = gBattleStruct->assistPossibleMoves;
|
||||
u16* validMoves = gBattleStruct->assistPossibleMoves;
|
||||
|
||||
if (GET_BATTLER_SIDE(gBattlerAttacker) != B_SIDE_PLAYER)
|
||||
party = gEnemyParty;
|
||||
@ -9389,14 +9400,14 @@ static void Cmd_assistattackselect(void)
|
||||
if (move == MOVE_NONE)
|
||||
continue;
|
||||
|
||||
movesArray[chooseableMovesNo] = move;
|
||||
validMoves[chooseableMovesNo] = move;
|
||||
chooseableMovesNo++;
|
||||
}
|
||||
}
|
||||
if (chooseableMovesNo)
|
||||
{
|
||||
gHitMarker &= ~HITMARKER_ATTACKSTRING_PRINTED;
|
||||
gCalledMove = movesArray[((Random() & 0xFF) * chooseableMovesNo) >> 8];
|
||||
gCalledMove = validMoves[((Random() & 0xFF) * chooseableMovesNo) >> 8];
|
||||
gBattlerTarget = GetMoveTarget(gCalledMove, NO_TARGET_OVERRIDE);
|
||||
gBattlescriptCurrInstr += 5;
|
||||
}
|
||||
|
@ -679,10 +679,12 @@ void HandleAction_ActionFinished(void)
|
||||
gBattleResources->battleScriptsStack->size = 0;
|
||||
}
|
||||
|
||||
#define SOUND_MOVES_END 0xFFFF
|
||||
|
||||
static const u16 sSoundMovesTable[] =
|
||||
{
|
||||
MOVE_GROWL, MOVE_ROAR, MOVE_SING, MOVE_SUPERSONIC, MOVE_SCREECH, MOVE_SNORE,
|
||||
MOVE_UPROAR, MOVE_METAL_SOUND, MOVE_GRASS_WHISTLE, MOVE_HYPER_VOICE, 0xFFFF
|
||||
MOVE_UPROAR, MOVE_METAL_SOUND, MOVE_GRASS_WHISTLE, MOVE_HYPER_VOICE, SOUND_MOVES_END
|
||||
};
|
||||
|
||||
u8 GetBattlerForBattleScript(u8 caseId)
|
||||
@ -1029,7 +1031,7 @@ u8 TrySetCantSelectMoveBattleScript(void)
|
||||
|
||||
gPotentialItemEffectBattler = gActiveBattler;
|
||||
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != 0xFFFF && *choicedMove != move)
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != move)
|
||||
{
|
||||
gCurrentMove = *choicedMove;
|
||||
gLastUsedItem = gBattleMons[gActiveBattler].item;
|
||||
@ -1097,7 +1099,7 @@ u8 CheckMoveLimitations(u8 battlerId, u8 unusableMoves, u8 check)
|
||||
if (gDisableStructs[battlerId].encoreTimer && gDisableStructs[battlerId].encoredMove != gBattleMons[battlerId].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
// Choice Band
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != 0xFFFF && *choicedMove != gBattleMons[battlerId].moves[i])
|
||||
if (holdEffect == HOLD_EFFECT_CHOICE_BAND && *choicedMove != MOVE_NONE && *choicedMove != MOVE_UNAVAILABLE && *choicedMove != gBattleMons[battlerId].moves[i])
|
||||
unusableMoves |= gBitTable[i];
|
||||
}
|
||||
return unusableMoves;
|
||||
@ -2640,12 +2642,12 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
case ABILITYEFFECT_MOVES_BLOCK: // 2
|
||||
if (gLastUsedAbility == ABILITY_SOUNDPROOF)
|
||||
{
|
||||
for (i = 0; sSoundMovesTable[i] != 0xFFFF; i++)
|
||||
for (i = 0; sSoundMovesTable[i] != SOUND_MOVES_END; i++)
|
||||
{
|
||||
if (sSoundMovesTable[i] == move)
|
||||
break;
|
||||
}
|
||||
if (sSoundMovesTable[i] != 0xFFFF)
|
||||
if (sSoundMovesTable[i] != SOUND_MOVES_END)
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)
|
||||
gHitMarker |= HITMARKER_NO_PPDEDUCT;
|
||||
@ -3005,22 +3007,22 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
target2 = GetBattlerAtPosition(side + BIT_FLANK);
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_DOUBLE)
|
||||
{
|
||||
if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0
|
||||
&& gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0)
|
||||
if (gBattleMons[target1].ability != ABILITY_NONE && gBattleMons[target1].hp != 0
|
||||
&& gBattleMons[target2].ability != ABILITY_NONE && gBattleMons[target2].hp != 0)
|
||||
{
|
||||
gActiveBattler = GetBattlerAtPosition(((Random() & 1) * 2) | side);
|
||||
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
|
||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleMons[target1].ability != 0 && gBattleMons[target1].hp != 0)
|
||||
else if (gBattleMons[target1].ability != ABILITY_NONE && gBattleMons[target1].hp != 0)
|
||||
{
|
||||
gActiveBattler = target1;
|
||||
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
|
||||
gLastUsedAbility = gBattleMons[gActiveBattler].ability;
|
||||
effect++;
|
||||
}
|
||||
else if (gBattleMons[target2].ability != 0 && gBattleMons[target2].hp != 0)
|
||||
else if (gBattleMons[target2].ability != ABILITY_NONE && gBattleMons[target2].hp != 0)
|
||||
{
|
||||
gActiveBattler = target2;
|
||||
gBattleMons[i].ability = gBattleMons[gActiveBattler].ability;
|
||||
|
@ -5694,6 +5694,8 @@ static void SetContestLiveUpdateFlags(u8 contestant)
|
||||
}
|
||||
}
|
||||
|
||||
#define APPEAL_MOVES_END 0xFFFF
|
||||
|
||||
static void CalculateContestLiveUpdateData(void)
|
||||
{
|
||||
u8 loser;
|
||||
@ -5758,7 +5760,7 @@ static void CalculateContestLiveUpdateData(void)
|
||||
appealMoves[i] = MOVE_NONE;
|
||||
numMoveUses[i] = 0;
|
||||
}
|
||||
appealMoves[CONTEST_NUM_APPEALS] = 0xFFFF;
|
||||
appealMoves[CONTEST_NUM_APPEALS] = APPEAL_MOVES_END;
|
||||
numMoveUses[CONTEST_NUM_APPEALS] = 0;
|
||||
|
||||
for (i = 0; i < CONTEST_NUM_APPEALS; i++)
|
||||
@ -5787,7 +5789,7 @@ static void CalculateContestLiveUpdateData(void)
|
||||
moveCandidates[0] = appealMoves[0];
|
||||
mostUses = numMoveUses[0];
|
||||
numMoveCandidates = 0;
|
||||
for (i = 1; appealMoves[i] != 0xFFFF; i++)
|
||||
for (i = 1; appealMoves[i] != APPEAL_MOVES_END; i++)
|
||||
{
|
||||
if (mostUses < numMoveUses[i])
|
||||
{
|
||||
|
@ -2093,10 +2093,12 @@ static const s8 sFriendshipEventModifiers[][3] =
|
||||
[FRIENDSHIP_EVENT_FAINT_LARGE] = {-5, -5, -10},
|
||||
};
|
||||
|
||||
#define HM_MOVES_END 0xFFFF
|
||||
|
||||
static const u16 sHMMoves[] =
|
||||
{
|
||||
MOVE_CUT, MOVE_FLY, MOVE_SURF, MOVE_STRENGTH, MOVE_FLASH,
|
||||
MOVE_ROCK_SMASH, MOVE_WATERFALL, MOVE_DIVE, 0xFFFF
|
||||
MOVE_ROCK_SMASH, MOVE_WATERFALL, MOVE_DIVE, HM_MOVES_END
|
||||
};
|
||||
|
||||
static const struct SpeciesItem sAlteringCaveWildMonHeldItems[] =
|
||||
@ -6479,7 +6481,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
|
||||
bool32 IsHMMove2(u16 move)
|
||||
{
|
||||
int i = 0;
|
||||
while (sHMMoves[i] != 0xFFFF)
|
||||
while (sHMMoves[i] != HM_MOVES_END)
|
||||
{
|
||||
if (sHMMoves[i++] == move)
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user