trap move related code cleanup

This commit is contained in:
sneed 2022-06-01 22:01:50 +03:00
parent 6be8151981
commit 86b436782a
3 changed files with 7 additions and 6 deletions

View File

@ -475,4 +475,7 @@
// For the second argument of GetMoveTarget, when no target override is needed
#define NO_TARGET_OVERRIDE 0
// Makes sure gWrappedStringIds and sTrappingMoves have the same size
#define TRAPPING_MOVES_COUNT 9
#endif // GUARD_CONSTANTS_BATTLE_H

View File

@ -1562,7 +1562,7 @@ const u16 gFirstTurnOfTwoStringIds[] =
};
// Index copied from move's index in sTrappingMoves
const u16 gWrappedStringIds[] =
const u16 gWrappedStringIds[TRAPPING_MOVES_COUNT] =
{
STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND
STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP

View File

@ -279,9 +279,9 @@ static const s32 sExperienceScalingFactors[] =
159767,
};
static const u16 sTrappingMoves[] =
static const u16 sTrappingMoves[TRAPPING_MOVES_COUNT] =
{
MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, MOVE_SNAP_TRAP, 0xFFFF
MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, MOVE_MAGMA_STORM, MOVE_INFESTATION, MOVE_SNAP_TRAP,
};
#define STAT_CHANGE_WORKED 0
@ -3037,10 +3037,8 @@ void SetMoveEffect(bool32 primary, u32 certain)
BattleScriptPush(gBattlescriptCurrInstr + 1);
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; ; gBattleCommunication[MULTISTRING_CHOOSER]++)
for (gBattleCommunication[MULTISTRING_CHOOSER] = 0; gBattleCommunication[MULTISTRING_CHOOSER] < TRAPPING_MOVES_COUNT; gBattleCommunication[MULTISTRING_CHOOSER]++)
{
if (gBattleCommunication[MULTISTRING_CHOOSER] > ARRAY_COUNT(sTrappingMoves) - 1)
break;
if (sTrappingMoves[gBattleCommunication[MULTISTRING_CHOOSER]] == gCurrentMove)
break;
}