summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2020-08-10 14:29:27 -0400
committerGitHub <noreply@github.com>2020-08-10 14:29:27 -0400
commit078c341b2b86d743c202a3968dbb5dad106a2fac (patch)
tree3094dec6062b03112a43280be23beaa229b3e313 /src/battle_script_commands.c
parent4aed5b078a53291820cca641b2c3a7e41c9f56de (diff)
parent5e8ffff62f6d4c7e4e2b62852eec14c086dc488e (diff)
Merge pull request #1122 from GriffinRichards/clean-battlemsg
Add stat stage constants, clean up misc battle msg data
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 994d35625..6ccefd7be 100644
--- a/src/battle_script_commands.c
+++ b/src/battle_script_commands.c
@@ -1128,13 +1128,13 @@ static void Cmd_accuracycheck(void)
else
{
u8 acc = gBattleMons[gBattlerAttacker].statStages[STAT_ACC];
- buff = acc + 6 - gBattleMons[gBattlerTarget].statStages[STAT_EVASION];
+ buff = acc + DEFAULT_STAT_STAGE - gBattleMons[gBattlerTarget].statStages[STAT_EVASION];
}
- if (buff < 0)
- buff = 0;
- if (buff > 0xC)
- buff = 0xC;
+ if (buff < MIN_STAT_STAGE)
+ buff = MIN_STAT_STAGE;
+ if (buff > MAX_STAT_STAGE)
+ buff = MAX_STAT_STAGE;
moveAcc = gBattleMoves[move].accuracy;
// check Thunder on sunny weather
@@ -3500,7 +3500,7 @@ static void Cmd_unknown_24(void)
if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId == TRAINER_STEVEN_PARTNER)
{
- for (i = 0; i < 3; i++)
+ for (i = 0; i < MULTI_PARTY_SIZE; i++)
{
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
HP_count += GetMonData(&gPlayerParty[i], MON_DATA_HP);
@@ -4385,7 +4385,7 @@ static void Cmd_playstatchangeanimation(void)
{
if (gBattlescriptCurrInstr[3] & STAT_CHANGE_CANT_PREVENT)
{
- if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
+ if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE)
{
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
@@ -4397,7 +4397,7 @@ static void Cmd_playstatchangeanimation(void)
&& !(gBattleMons[gActiveBattler].ability == ABILITY_KEEN_EYE && currStat == STAT_ACC)
&& !(gBattleMons[gActiveBattler].ability == ABILITY_HYPER_CUTTER && currStat == STAT_ATK))
{
- if (gBattleMons[gActiveBattler].statStages[currStat] > 0)
+ if (gBattleMons[gActiveBattler].statStages[currStat] > MIN_STAT_STAGE)
{
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
@@ -4425,7 +4425,7 @@ static void Cmd_playstatchangeanimation(void)
while (statsToCheck != 0)
{
- if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < 0xC)
+ if (statsToCheck & 1 && gBattleMons[gActiveBattler].statStages[currStat] < MAX_STAT_STAGE)
{
statAnimId = startingStatAnimId + currStat;
changeableStatsCount++;
@@ -4495,7 +4495,7 @@ static void Cmd_moveend(void)
&& 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] <= 0xB)
+ && gBattleMoves[gCurrentMove].power && gBattleMons[gBattlerTarget].statStages[STAT_ATK] < MAX_STAT_STAGE)
{
gBattleMons[gBattlerTarget].statStages[STAT_ATK]++;
BattleScriptPushCursor();
@@ -7288,7 +7288,7 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
index++;
gBattleTextBuff2[index] = B_BUFF_EOS;
- if (gBattleMons[gActiveBattler].statStages[statId] == 0)
+ if (gBattleMons[gActiveBattler].statStages[statId] == MIN_STAT_STAGE)
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
else
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
@@ -7315,17 +7315,17 @@ static u8 ChangeStatBuffs(s8 statValue, u8 statId, u8 flags, const u8 *BS_ptr)
index++;
gBattleTextBuff2[index] = B_BUFF_EOS;
- if (gBattleMons[gActiveBattler].statStages[statId] == 0xC)
+ if (gBattleMons[gActiveBattler].statStages[statId] == MAX_STAT_STAGE)
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
else
gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler);
}
gBattleMons[gActiveBattler].statStages[statId] += statValue;
- if (gBattleMons[gActiveBattler].statStages[statId] < 0)
- gBattleMons[gActiveBattler].statStages[statId] = 0;
- if (gBattleMons[gActiveBattler].statStages[statId] > 0xC)
- gBattleMons[gActiveBattler].statStages[statId] = 0xC;
+ if (gBattleMons[gActiveBattler].statStages[statId] < MIN_STAT_STAGE)
+ gBattleMons[gActiveBattler].statStages[statId] = MIN_STAT_STAGE;
+ if (gBattleMons[gActiveBattler].statStages[statId] > MAX_STAT_STAGE)
+ gBattleMons[gActiveBattler].statStages[statId] = MAX_STAT_STAGE;
if (gBattleCommunication[MULTISTRING_CHOOSER] == 2 && flags & STAT_BUFF_ALLOW_PTR)
gMoveResultFlags |= MOVE_RESULT_MISSED;
@@ -7350,7 +7350,7 @@ static void Cmd_normalisebuffs(void) // haze
for (i = 0; i < gBattlersCount; i++)
{
for (j = 0; j < NUM_BATTLE_STATS; j++)
- gBattleMons[i].statStages[j] = 6;
+ gBattleMons[i].statStages[j] = DEFAULT_STAT_STAGE;
}
gBattlescriptCurrInstr++;
@@ -8750,7 +8750,7 @@ static void Cmd_rolloutdamagecalculation(void)
static void Cmd_jumpifconfusedandstatmaxed(void)
{
if (gBattleMons[gBattlerTarget].status2 & STATUS2_CONFUSION
- && gBattleMons[gBattlerTarget].statStages[gBattlescriptCurrInstr[1]] == 0xC)
+ && gBattleMons[gBattlerTarget].statStages[gBattlescriptCurrInstr[1]] == MAX_STAT_STAGE)
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
else
gBattlescriptCurrInstr += 6;
@@ -8957,10 +8957,10 @@ static void Cmd_maxattackhalvehp(void) // belly drum
if (!(gBattleMons[gBattlerAttacker].maxHP / 2))
halfHp = 1;
- if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < 12
+ if (gBattleMons[gBattlerAttacker].statStages[STAT_ATK] < MAX_STAT_STAGE
&& gBattleMons[gBattlerAttacker].hp > halfHp)
{
- gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = 12;
+ gBattleMons[gBattlerAttacker].statStages[STAT_ATK] = MAX_STAT_STAGE;
gBattleMoveDamage = gBattleMons[gBattlerAttacker].maxHP / 2;
if (gBattleMoveDamage == 0)
gBattleMoveDamage = 1;
@@ -9234,8 +9234,8 @@ static void Cmd_sethail(void)
static void Cmd_jumpifattackandspecialattackcannotfall(void) // memento
{
- if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == 0
- && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == 0
+ if (gBattleMons[gBattlerTarget].statStages[STAT_ATK] == MIN_STAT_STAGE
+ && gBattleMons[gBattlerTarget].statStages[STAT_SPATK] == MIN_STAT_STAGE
&& gBattleCommunication[6] != 1)
{
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);