summaryrefslogtreecommitdiff
path: root/src/pokemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pokemon.c')
-rw-r--r--src/pokemon.c44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/pokemon.c b/src/pokemon.c
index 87ea2551f..80e93c568 100644
--- a/src/pokemon.c
+++ b/src/pokemon.c
@@ -1349,7 +1349,7 @@ const struct SpindaSpot gSpindaSpotGraphics[] =
#include "data/pokemon/item_effects.h"
-const s8 gNatureStatTable[][NUM_EV_STATS] =
+const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
{
// Atk Def Spd Sp.Atk Sp.Def
{ 0, 0, 0, 0, 0}, // Hardy
@@ -2725,7 +2725,7 @@ void SetDeoxysStats(void)
}
}
-u16 sub_8068B48(void)
+u16 GetUnionRoomTrainerPic(void)
{
u8 linkId;
u32 arrId;
@@ -2740,7 +2740,7 @@ u16 sub_8068B48(void)
return FacilityClassToPicIndex(gLinkPlayerFacilityClasses[arrId]);
}
-u16 sub_8068BB0(void)
+u16 GetUnionRoomTrainerClass(void)
{
u8 linkId;
u32 arrId;
@@ -3234,7 +3234,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
- if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
+ if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// moves always do at least 1 damage.
@@ -3281,7 +3281,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
damage /= 2;
}
- if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == 8 && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
+ if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
damage /= 2;
// are effects of weather negated with cloud nine or air lock
@@ -5372,12 +5372,12 @@ u8 *UseStatIncreaseItem(u16 itemId)
u8 GetNature(struct Pokemon *mon)
{
- return GetMonData(mon, MON_DATA_PERSONALITY, 0) % 25;
+ return GetMonData(mon, MON_DATA_PERSONALITY, 0) % NUM_NATURES;
}
u8 GetNatureFromPersonality(u32 personality)
{
- return personality % 25;
+ return personality % NUM_NATURES;
}
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem)
@@ -5747,7 +5747,7 @@ u8 GetTrainerEncounterMusicId(u16 trainerOpponentId)
u16 ModifyStatByNature(u8 nature, u16 n, u8 statIndex)
{
// Dont modify HP, Accuracy, or Evasion by nature
- if (statIndex <= STAT_HP || statIndex > NUM_EV_STATS)
+ if (statIndex <= STAT_HP || statIndex > NUM_NATURE_STATS)
{
// Should just be "return n", but it wouldn't match without this.
u16 retVal = n;
@@ -5836,7 +5836,7 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
u16 totalEVs = 0;
u16 heldItem;
u8 holdEffect;
- int i;
+ int i, multiplier;
for (i = 0; i < NUM_STATS; i++)
{
@@ -5846,43 +5846,37 @@ void MonGainEVs(struct Pokemon *mon, u16 defeatedSpecies)
for (i = 0; i < NUM_STATS; i++)
{
- u8 hasHadPokerus;
- int multiplier;
-
if (totalEVs >= MAX_TOTAL_EVS)
break;
-
- hasHadPokerus = CheckPartyHasHadPokerus(mon, 0);
-
- if (hasHadPokerus)
+
+ if (CheckPartyHasHadPokerus(mon, 0))
multiplier = 2;
else
multiplier = 1;
switch (i)
{
- case 0:
+ case STAT_HP:
evIncrease = gBaseStats[defeatedSpecies].evYield_HP * multiplier;
break;
- case 1:
+ case STAT_ATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_Attack * multiplier;
break;
- case 2:
+ case STAT_DEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_Defense * multiplier;
break;
- case 3:
+ case STAT_SPEED:
evIncrease = gBaseStats[defeatedSpecies].evYield_Speed * multiplier;
break;
- case 4:
+ case STAT_SPATK:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpAttack * multiplier;
break;
- case 5:
+ case STAT_SPDEF:
evIncrease = gBaseStats[defeatedSpecies].evYield_SpDefense * multiplier;
break;
}
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, 0);
-
if (heldItem == ITEM_ENIGMA_BERRY)
{
if (gMain.inBattle)
@@ -6410,13 +6404,13 @@ bool8 IsMonSpriteNotFlipped(u16 species)
s8 GetMonFlavorRelation(struct Pokemon *mon, u8 flavor)
{
u8 nature = GetNature(mon);
- return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor];
+ return gPokeblockFlavorCompatibilityTable[nature * FLAVOR_COUNT + flavor];
}
s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor)
{
u8 nature = GetNatureFromPersonality(personality);
- return gPokeblockFlavorCompatibilityTable[nature * 5 + flavor];
+ return gPokeblockFlavorCompatibilityTable[nature * FLAVOR_COUNT + flavor];
}
bool8 IsTradedMon(struct Pokemon *mon)