summaryrefslogtreecommitdiff
path: root/src/battle_script_commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle_script_commands.c')
-rw-r--r--src/battle_script_commands.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c
index 994d35625..5c1b1e370 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();
@@ -6340,15 +6340,13 @@ static void PutLevelAndGenderOnLvlUpBox(void)
AddTextPrinter(&printerTemplate, 0xFF, NULL);
txtPtr = gStringVar4;
- gStringVar4[0] = CHAR_SPECIAL_F9;
- txtPtr++;
- txtPtr[0] = CHAR_LV_2;
- txtPtr++;
+ *(txtPtr)++ = CHAR_EXTRA_SYMBOL;
+ *(txtPtr)++ = CHAR_LV_2;
var = (u32)(txtPtr);
txtPtr = ConvertIntToDecimalStringN(txtPtr, monLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
var = (u32)(txtPtr) - var;
- txtPtr = StringFill(txtPtr, 0x77, 4 - var);
+ txtPtr = StringFill(txtPtr, CHAR_UNK_SPACER, 4 - var);
if (monGender != MON_GENDERLESS)
{
@@ -7288,7 +7286,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 +7313,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 +7348,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 +8748,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 +8955,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 +9232,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);