Merge pull request #1122 from GriffinRichards/clean-battlemsg
Add stat stage constants, clean up misc battle msg data
This commit is contained in:
@@ -314,8 +314,8 @@ static bool8 AreStatsRaised(void)
|
||||
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[gActiveBattler].statStages[i] > 6)
|
||||
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - 6;
|
||||
if (gBattleMons[gActiveBattler].statStages[i] > DEFAULT_STAT_STAGE)
|
||||
buffedStatsValue += gBattleMons[gActiveBattler].statStages[i] - DEFAULT_STAT_STAGE;
|
||||
}
|
||||
|
||||
return (buffedStatsValue > 3);
|
||||
|
||||
@@ -3135,7 +3135,7 @@ void SwitchInClearSetData(void)
|
||||
if (gBattleMoves[gCurrentMove].effect != EFFECT_BATON_PASS)
|
||||
{
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if ((gBattleMons[i].status2 & STATUS2_ESCAPE_PREVENTION) && gDisableStructs[i].battlerPreventingEscape == gActiveBattler)
|
||||
@@ -3244,7 +3244,7 @@ void FaintClearSetData(void)
|
||||
u8 *ptr;
|
||||
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
gStatuses3[gActiveBattler] = 0;
|
||||
@@ -3398,7 +3398,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
|
||||
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
|
||||
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[gActiveBattler].statStages[i] = 6;
|
||||
gBattleMons[gActiveBattler].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
gBattleMons[gActiveBattler].status2 = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,12 +19,15 @@
|
||||
#include "text.h"
|
||||
#include "trainer_hill.h"
|
||||
#include "window.h"
|
||||
#include "constants/battle_dome.h"
|
||||
#include "constants/battle_string_ids.h"
|
||||
#include "constants/berry.h"
|
||||
#include "constants/frontier_util.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/trainer_hill.h"
|
||||
#include "constants/weather.h"
|
||||
|
||||
struct BattleWindowText
|
||||
{
|
||||
@@ -433,11 +436,16 @@ static const u8 sText_SpDef2[] = _("SP. DEF");
|
||||
static const u8 sText_Accuracy[] = _("accuracy");
|
||||
static const u8 sText_Evasiveness[] = _("evasiveness");
|
||||
|
||||
const u8 * const gStatNamesTable[] =
|
||||
const u8 * const gStatNamesTable[NUM_BATTLE_STATS] =
|
||||
{
|
||||
sText_HP2, sText_Attack2, sText_Defense2,
|
||||
sText_Speed, sText_SpAtk2, sText_SpDef2,
|
||||
sText_Accuracy, sText_Evasiveness
|
||||
[STAT_HP] = sText_HP2,
|
||||
[STAT_ATK] = sText_Attack2,
|
||||
[STAT_DEF] = sText_Defense2,
|
||||
[STAT_SPEED] = sText_Speed,
|
||||
[STAT_SPATK] = sText_SpAtk2,
|
||||
[STAT_SPDEF] = sText_SpDef2,
|
||||
[STAT_ACC] = sText_Accuracy,
|
||||
[STAT_EVASION] = sText_Evasiveness,
|
||||
};
|
||||
|
||||
static const u8 sText_PokeblockWasTooSpicy[] = _("was too spicy!");
|
||||
@@ -446,11 +454,13 @@ static const u8 sText_PokeblockWasTooSweet[] = _("was too sweet!");
|
||||
static const u8 sText_PokeblockWasTooBitter[] = _("was too bitter!");
|
||||
static const u8 sText_PokeblockWasTooSour[] = _("was too sour!");
|
||||
|
||||
const u8 * const gPokeblockWasTooXStringTable[] =
|
||||
const u8 * const gPokeblockWasTooXStringTable[FLAVOR_COUNT] =
|
||||
{
|
||||
sText_PokeblockWasTooSpicy, sText_PokeblockWasTooDry,
|
||||
sText_PokeblockWasTooSweet, sText_PokeblockWasTooBitter,
|
||||
sText_PokeblockWasTooSour
|
||||
[FLAVOR_SPICY] = sText_PokeblockWasTooSpicy,
|
||||
[FLAVOR_DRY] = sText_PokeblockWasTooDry,
|
||||
[FLAVOR_SWEET] = sText_PokeblockWasTooSweet,
|
||||
[FLAVOR_BITTER] = sText_PokeblockWasTooBitter,
|
||||
[FLAVOR_SOUR] = sText_PokeblockWasTooSour
|
||||
};
|
||||
|
||||
static const u8 sText_PlayerUsedItem[] = _("{B_PLAYER_NAME} used\n{B_LAST_ITEM}!");
|
||||
@@ -979,16 +989,28 @@ const u16 gStatDownStringIds[] =
|
||||
STRINGID_PKMNSSTATCHANGED3, STRINGID_PKMNSSTATCHANGED4, STRINGID_STATSWONTDECREASE, STRINGID_EMPTYSTRING3
|
||||
};
|
||||
|
||||
// Index read from sTWOTURN_STRINGID
|
||||
const u16 gFirstTurnOfTwoStringIds[] =
|
||||
{
|
||||
STRINGID_PKMNWHIPPEDWHIRLWIND, STRINGID_PKMNTOOKSUNLIGHT, STRINGID_PKMNLOWEREDHEAD, STRINGID_PKMNISGLOWING,
|
||||
STRINGID_PKMNFLEWHIGH, STRINGID_PKMNDUGHOLE, STRINGID_PKMNHIDUNDERWATER, STRINGID_PKMNSPRANGUP
|
||||
STRINGID_PKMNWHIPPEDWHIRLWIND, // MOVE_RAZOR_WIND
|
||||
STRINGID_PKMNTOOKSUNLIGHT, // MOVE_SOLAR_BEAM
|
||||
STRINGID_PKMNLOWEREDHEAD, // MOVE_SKULL_BASH
|
||||
STRINGID_PKMNISGLOWING, // MOVE_SKY_ATTACK
|
||||
STRINGID_PKMNFLEWHIGH, // MOVE_FLY
|
||||
STRINGID_PKMNDUGHOLE, // MOVE_DIG
|
||||
STRINGID_PKMNHIDUNDERWATER, // MOVE_DIVE
|
||||
STRINGID_PKMNSPRANGUP // MOVE_BOUNCE
|
||||
};
|
||||
|
||||
// Index copied from move's index in gTrappingMoves
|
||||
const u16 gWrappedStringIds[] =
|
||||
{
|
||||
STRINGID_PKMNSQUEEZEDBYBIND, STRINGID_PKMNWRAPPEDBY, STRINGID_PKMNTRAPPEDINVORTEX,
|
||||
STRINGID_PKMNCLAMPED, STRINGID_PKMNTRAPPEDINVORTEX, STRINGID_PKMNTRAPPEDBYSANDTOMB
|
||||
STRINGID_PKMNSQUEEZEDBYBIND, // MOVE_BIND
|
||||
STRINGID_PKMNWRAPPEDBY, // MOVE_WRAP
|
||||
STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_FIRE_SPIN
|
||||
STRINGID_PKMNCLAMPED, // MOVE_CLAMP
|
||||
STRINGID_PKMNTRAPPEDINVORTEX, // MOVE_WHIRLPOOL
|
||||
STRINGID_PKMNTRAPPEDBYSANDTOMB // MOVE_SAND_TOMB
|
||||
};
|
||||
|
||||
const u16 gMistUsedStringIds[] =
|
||||
@@ -1078,13 +1100,25 @@ const u16 gBallEscapeStringIds[] =
|
||||
STRINGID_PKMNBROKEFREE, STRINGID_ITAPPEAREDCAUGHT, STRINGID_AARGHALMOSTHADIT, STRINGID_SHOOTSOCLOSE
|
||||
};
|
||||
|
||||
const u16 gWeatherContinuesStringIds[] =
|
||||
// Overworld weathers that don't have an associated battle weather default to "It is raining."
|
||||
const u16 gWeatherStartsStringIds[] =
|
||||
{
|
||||
STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING,
|
||||
STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING,
|
||||
STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_SANDSTORMISRAGING,
|
||||
STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING,
|
||||
STRINGID_SUNLIGHTSTRONG, STRINGID_ITISRAINING, STRINGID_ITISRAINING, STRINGID_ITISRAINING
|
||||
[WEATHER_NONE] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SUNNY_CLOUDS] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SUNNY] = STRINGID_ITISRAINING,
|
||||
[WEATHER_RAIN] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SNOW] = STRINGID_ITISRAINING,
|
||||
[WEATHER_RAIN_THUNDERSTORM] = STRINGID_ITISRAINING,
|
||||
[WEATHER_FOG_HORIZONTAL] = STRINGID_ITISRAINING,
|
||||
[WEATHER_VOLCANIC_ASH] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SANDSTORM] = STRINGID_SANDSTORMISRAGING,
|
||||
[WEATHER_FOG_DIAGONAL] = STRINGID_ITISRAINING,
|
||||
[WEATHER_UNDERWATER] = STRINGID_ITISRAINING,
|
||||
[WEATHER_SHADE] = STRINGID_ITISRAINING,
|
||||
[WEATHER_DROUGHT] = STRINGID_SUNLIGHTSTRONG,
|
||||
[WEATHER_DOWNPOUR] = STRINGID_ITISRAINING,
|
||||
[WEATHER_UNDERWATER_BUBBLES] = STRINGID_ITISRAINING,
|
||||
[WEATHER_ABNORMAL] = STRINGID_ITISRAINING
|
||||
};
|
||||
|
||||
const u16 gInobedientStringIds[] =
|
||||
@@ -1146,7 +1180,13 @@ const u16 gCaughtMonStringIds[] =
|
||||
|
||||
const u16 gTrappingMoves[] =
|
||||
{
|
||||
MOVE_BIND, MOVE_WRAP, MOVE_FIRE_SPIN, MOVE_CLAMP, MOVE_WHIRLPOOL, MOVE_SAND_TOMB, 0xFFFF
|
||||
MOVE_BIND,
|
||||
MOVE_WRAP,
|
||||
MOVE_FIRE_SPIN,
|
||||
MOVE_CLAMP,
|
||||
MOVE_WHIRLPOOL,
|
||||
MOVE_SAND_TOMB,
|
||||
0xFFFF
|
||||
};
|
||||
|
||||
const u8 gText_PkmnIsEvolving[] = _("What?\n{STR_VAR_1} is evolving!");
|
||||
@@ -1207,26 +1247,27 @@ const u8 gText_Draw[] = _("{HIGHLIGHT TRANSPARENT}Draw");
|
||||
static const u8 sText_SpaceIs[] = _(" is");
|
||||
static const u8 sText_ApostropheS[] = _("'s");
|
||||
|
||||
static const u8 sATypeMove_Table[][17] =
|
||||
// For displaying names of invalid moves
|
||||
static const u8 sATypeMove_Table[][NUMBER_OF_MON_TYPES - 1] =
|
||||
{
|
||||
_("a NORMAL move"),
|
||||
_("a FIGHTING move"),
|
||||
_("a FLYING move"),
|
||||
_("a POISON move"),
|
||||
_("a GROUND move"),
|
||||
_("a ROCK move"),
|
||||
_("a BUG move"),
|
||||
_("a GHOST move"),
|
||||
_("a STEEL move"),
|
||||
_("a ??? move"),
|
||||
_("a FIRE move"),
|
||||
_("a WATER move"),
|
||||
_("a GRASS move"),
|
||||
_("an ELECTRIC move"),
|
||||
_("a PSYCHIC move"),
|
||||
_("an ICE move"),
|
||||
_("a DRAGON move"),
|
||||
_("a DARK move")
|
||||
[TYPE_NORMAL] = _("a NORMAL move"),
|
||||
[TYPE_FIGHTING] = _("a FIGHTING move"),
|
||||
[TYPE_FLYING] = _("a FLYING move"),
|
||||
[TYPE_POISON] = _("a POISON move"),
|
||||
[TYPE_GROUND] = _("a GROUND move"),
|
||||
[TYPE_ROCK] = _("a ROCK move"),
|
||||
[TYPE_BUG] = _("a BUG move"),
|
||||
[TYPE_GHOST] = _("a GHOST move"),
|
||||
[TYPE_STEEL] = _("a STEEL move"),
|
||||
[TYPE_MYSTERY] = _("a ??? move"),
|
||||
[TYPE_FIRE] = _("a FIRE move"),
|
||||
[TYPE_WATER] = _("a WATER move"),
|
||||
[TYPE_GRASS] = _("a GRASS move"),
|
||||
[TYPE_ELECTRIC] = _("an ELECTRIC move"),
|
||||
[TYPE_PSYCHIC] = _("a PSYCHIC move"),
|
||||
[TYPE_ICE] = _("an ICE move"),
|
||||
[TYPE_DRAGON] = _("a DRAGON move"),
|
||||
[TYPE_DARK] = _("a DARK move")
|
||||
};
|
||||
|
||||
const u8 gText_BattleTourney[] = _("BATTLE TOURNEY");
|
||||
@@ -1235,12 +1276,12 @@ static const u8 sText_Round2[] = _("Round 2");
|
||||
static const u8 sText_Semifinal[] = _("Semifinal");
|
||||
static const u8 sText_Final[] = _("Final");
|
||||
|
||||
const u8 *const gRoundsStringTable[] =
|
||||
const u8 *const gRoundsStringTable[DOME_ROUNDS_COUNT] =
|
||||
{
|
||||
sText_Round1,
|
||||
sText_Round2,
|
||||
sText_Semifinal,
|
||||
sText_Final
|
||||
[DOME_ROUND1] = sText_Round1,
|
||||
[DOME_ROUND2] = sText_Round2,
|
||||
[DOME_SEMIFINAL] = sText_Semifinal,
|
||||
[DOME_FINAL] = sText_Final
|
||||
};
|
||||
|
||||
const u8 gText_TheGreatNewHope[] = _("The great new hope!\p");
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1398,9 +1398,9 @@ static void TrySetBattleSeminarShow(void)
|
||||
return;
|
||||
else if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT)
|
||||
return;
|
||||
else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] <= 5)
|
||||
else if (gBattleMons[gBattlerAttacker].statStages[STAT_ACC] < DEFAULT_STAT_STAGE)
|
||||
return;
|
||||
else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > 6)
|
||||
else if (gBattleMons[gBattlerTarget].statStages[STAT_EVASION] > DEFAULT_STAT_STAGE)
|
||||
return;
|
||||
else if (gCurrentMove == MOVE_HIDDEN_POWER || gCurrentMove == MOVE_WEATHER_BALL)
|
||||
return;
|
||||
|
||||
@@ -1978,7 +1978,7 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
}
|
||||
break;
|
||||
case ABILITY_SPEED_BOOST:
|
||||
if (gBattleMons[battler].statStages[STAT_SPEED] < 0xC && gDisableStructs[battler].isFirstTurn != 2)
|
||||
if (gBattleMons[battler].statStages[STAT_SPEED] < MAX_STAT_STAGE && gDisableStructs[battler].isFirstTurn != 2)
|
||||
{
|
||||
gBattleMons[battler].statStages[STAT_SPEED]++;
|
||||
gBattleScripting.animArg1 = 0x11;
|
||||
@@ -2619,9 +2619,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = 6;
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
@@ -2690,9 +2690,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = 6;
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
@@ -2811,7 +2811,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
break;
|
||||
// copy/paste again, smh
|
||||
case HOLD_EFFECT_ATTACK_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam
|
||||
&& !moveTurn && gBattleMons[battlerId].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_ATK);
|
||||
PREPARE_STRING_BUFFER(gBattleTextBuff2, STRINGID_STATROSE);
|
||||
@@ -2825,7 +2826,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_DEFENSE_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_DEF] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& gBattleMons[battlerId].statStages[STAT_DEF] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_DEF);
|
||||
|
||||
@@ -2838,7 +2840,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SPEED_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPEED] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& gBattleMons[battlerId].statStages[STAT_SPEED] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPEED);
|
||||
|
||||
@@ -2851,7 +2854,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SP_ATTACK_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPATK] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& gBattleMons[battlerId].statStages[STAT_SPATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPATK);
|
||||
|
||||
@@ -2864,7 +2868,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_SP_DEFENSE_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && gBattleMons[battlerId].statStages[STAT_SPDEF] < 0xC)
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& gBattleMons[battlerId].statStages[STAT_SPDEF] < MAX_STAT_STAGE)
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, STAT_SPDEF);
|
||||
|
||||
@@ -2877,7 +2882,8 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
}
|
||||
break;
|
||||
case HOLD_EFFECT_CRITICAL_UP:
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn && !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
|
||||
if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / battlerHoldEffectParam && !moveTurn
|
||||
&& !(gBattleMons[battlerId].status2 & STATUS2_FOCUS_ENERGY))
|
||||
{
|
||||
gBattleMons[battlerId].status2 |= STATUS2_FOCUS_ENERGY;
|
||||
BattleScriptExecute(BattleScript_BerryFocusEnergyEnd2);
|
||||
@@ -2889,7 +2895,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
{
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[STAT_ATK + i] < 0xC)
|
||||
if (gBattleMons[battlerId].statStages[STAT_ATK + i] < MAX_STAT_STAGE)
|
||||
break;
|
||||
}
|
||||
if (i != 5)
|
||||
@@ -2897,7 +2903,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
do
|
||||
{
|
||||
i = Random() % 5;
|
||||
} while (gBattleMons[battlerId].statStages[STAT_ATK + i] == 0xC);
|
||||
} while (gBattleMons[battlerId].statStages[STAT_ATK + i] == MAX_STAT_STAGE);
|
||||
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, i + 1);
|
||||
|
||||
@@ -3166,9 +3172,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||
case HOLD_EFFECT_RESTORE_STATS:
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
{
|
||||
if (gBattleMons[battlerId].statStages[i] < 6)
|
||||
if (gBattleMons[battlerId].statStages[i] < DEFAULT_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[battlerId].statStages[i] = 6;
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
effect = ITEM_STATS_CHANGE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1868,21 +1868,21 @@ const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up c
|
||||
const u8 gPPUpSetMask[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count
|
||||
const u8 gPPUpAddMask[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count
|
||||
|
||||
const u8 gStatStageRatios[][2] =
|
||||
const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2] =
|
||||
{
|
||||
{10, 40}, // -6
|
||||
{10, 40}, // -6, MIN_STAT_STAGE
|
||||
{10, 35}, // -5
|
||||
{10, 30}, // -4
|
||||
{10, 25}, // -3
|
||||
{10, 20}, // -2
|
||||
{10, 15}, // -1
|
||||
{10, 10}, // 0
|
||||
{10, 10}, // 0, DEFAULT_STAT_STAGE
|
||||
{15, 10}, // +1
|
||||
{20, 10}, // +2
|
||||
{25, 10}, // +3
|
||||
{30, 10}, // +4
|
||||
{35, 10}, // +5
|
||||
{40, 10}, // +6
|
||||
{40, 10}, // +6, MAX_STAT_STAGE
|
||||
};
|
||||
|
||||
static const u16 sDeoxysBaseStats[] =
|
||||
@@ -3199,7 +3199,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
if (attacker->statStages[STAT_ATK] > 6)
|
||||
if (attacker->statStages[STAT_ATK] > DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damage, attacker, attack, STAT_ATK)
|
||||
else
|
||||
damage = attack;
|
||||
@@ -3212,7 +3212,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
if (defender->statStages[STAT_DEF] < 6)
|
||||
if (defender->statStages[STAT_DEF] < DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damageHelper, defender, defense, STAT_DEF)
|
||||
else
|
||||
damageHelper = defense;
|
||||
@@ -3249,7 +3249,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
if (attacker->statStages[STAT_SPATK] > 6)
|
||||
if (attacker->statStages[STAT_SPATK] > DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damage, attacker, spAttack, STAT_SPATK)
|
||||
else
|
||||
damage = spAttack;
|
||||
@@ -3262,7 +3262,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
if (defender->statStages[STAT_SPDEF] < 6)
|
||||
if (defender->statStages[STAT_SPDEF] < DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damageHelper, defender, spDefense, STAT_SPDEF)
|
||||
else
|
||||
damageHelper = spDefense;
|
||||
@@ -4624,8 +4624,8 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
|
||||
hpSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(battlerId)];
|
||||
*hpSwitchout = gBattleMons[battlerId].hp;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
gBattleMons[battlerId].statStages[i] = 6;
|
||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||
gBattleMons[battlerId].statStages[i] = DEFAULT_STAT_STAGE;
|
||||
|
||||
gBattleMons[battlerId].status2 = 0;
|
||||
UpdateSentPokesToOpponentValue(battlerId);
|
||||
@@ -4728,49 +4728,49 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & ITEM0_X_ATTACK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] += itemEffect[cmdIndex] & ITEM0_X_ATTACK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] = 12;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ATK] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ATK] = MAX_STAT_STAGE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// in-battle stat boosting effects
|
||||
case 1:
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_DEFEND)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_DEF] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] += (itemEffect[cmdIndex] & ITEM1_X_DEFEND) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] = 12;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_DEF] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_DEF] = MAX_STAT_STAGE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & ITEM1_X_SPEED)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPEED] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] += itemEffect[cmdIndex] & ITEM1_X_SPEED;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = 12;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPEED] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPEED] = MAX_STAT_STAGE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
// more stat boosting effects
|
||||
case 2:
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_ACCURACY)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_ACC] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] += (itemEffect[cmdIndex] & ITEM2_X_ACCURACY) >> 4;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] = 12;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_ACC] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_ACC] = MAX_STAT_STAGE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
if ((itemEffect[cmdIndex] & ITEM2_X_SPATK)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < 12)
|
||||
&& gBattleMons[gActiveBattler].statStages[STAT_SPATK] < MAX_STAT_STAGE)
|
||||
{
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] += itemEffect[cmdIndex] & ITEM2_X_SPATK;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > 12)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = 12;
|
||||
if (gBattleMons[gActiveBattler].statStages[STAT_SPATK] > MAX_STAT_STAGE)
|
||||
gBattleMons[gActiveBattler].statStages[STAT_SPATK] = MAX_STAT_STAGE;
|
||||
retVal = FALSE;
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user