Merge branch 'master' of https://github.com/pret/pokeemerald into doc-contest

This commit is contained in:
GriffinR
2020-08-16 05:59:10 -04:00
511 changed files with 17469 additions and 16800 deletions

View File

@@ -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
@@ -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,11 +4624,11 @@ 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;
sub_803FA70(battlerId);
UpdateSentPokesToOpponentValue(battlerId);
ClearTemporarySpeciesSpriteData(battlerId, FALSE);
}
@@ -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;
@@ -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)