mirror of
https://github.com/pret/pokeemerald.git
synced 2026-04-26 09:33:41 -05:00
cleanup GetMon Null Data Instances (#8867)
Co-authored-by: Meister-anon <user@DESKTOP-TQ65PS9>
This commit is contained in:
parent
3dfef14c77
commit
6aaf5d43dc
|
|
@ -242,10 +242,10 @@ static u32 GetHPHealAmount(u8 itemEffectParam, struct Pokemon *mon)
|
||||||
switch (itemEffectParam)
|
switch (itemEffectParam)
|
||||||
{
|
{
|
||||||
case ITEM6_HEAL_HP_FULL:
|
case ITEM6_HEAL_HP_FULL:
|
||||||
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL);
|
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP) - GetMonData(mon, MON_DATA_HP);
|
||||||
break;
|
break;
|
||||||
case ITEM6_HEAL_HP_HALF:
|
case ITEM6_HEAL_HP_HALF:
|
||||||
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2;
|
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP) / 2;
|
||||||
if (itemEffectParam == 0)
|
if (itemEffectParam == 0)
|
||||||
itemEffectParam = 1;
|
itemEffectParam = 1;
|
||||||
break;
|
break;
|
||||||
|
|
@ -253,7 +253,7 @@ static u32 GetHPHealAmount(u8 itemEffectParam, struct Pokemon *mon)
|
||||||
itemEffectParam = gBattleScripting.levelUpHP;
|
itemEffectParam = gBattleScripting.levelUpHP;
|
||||||
break;
|
break;
|
||||||
case ITEM6_HEAL_HP_QUARTER:
|
case ITEM6_HEAL_HP_QUARTER:
|
||||||
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 4;
|
itemEffectParam = GetMonData(mon, MON_DATA_MAX_HP) / 4;
|
||||||
if (itemEffectParam == 0)
|
if (itemEffectParam == 0)
|
||||||
itemEffectParam = 1;
|
itemEffectParam = 1;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1051,7 +1051,7 @@ static bool32 CanMonSurviveHazardSwitchin(u32 battler)
|
||||||
|
|
||||||
for (u32 moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
for (u32 moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||||
{
|
{
|
||||||
aiMove = GetMonData(&party[monIndex], MON_DATA_MOVE1 + moveIndex, NULL);
|
aiMove = GetMonData(&party[monIndex], MON_DATA_MOVE1 + moveIndex);
|
||||||
if (IsHazardClearingMove(aiMove)) // Have a mon that can clear the hazards, so switching out is okay
|
if (IsHazardClearingMove(aiMove)) // Have a mon that can clear the hazards, so switching out is okay
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4405,7 +4405,7 @@ bool32 ShouldUseWishAromatherapy(u32 battlerAtk, u32 battlerDef, enum Move move)
|
||||||
u32 currHp = GetMonData(&party[monIndex], MON_DATA_HP);
|
u32 currHp = GetMonData(&party[monIndex], MON_DATA_HP);
|
||||||
u32 maxHp = GetMonData(&party[monIndex], MON_DATA_MAX_HP);
|
u32 maxHp = GetMonData(&party[monIndex], MON_DATA_MAX_HP);
|
||||||
|
|
||||||
if (!GetMonData(&party[monIndex], MON_DATA_IS_EGG, NULL) && currHp > 0)
|
if (!GetMonData(&party[monIndex], MON_DATA_IS_EGG) && currHp > 0)
|
||||||
{
|
{
|
||||||
if ((currHp * 100) / maxHp < 65 // Less than 65% health remaining
|
if ((currHp * 100) / maxHp < 65 // Less than 65% health remaining
|
||||||
&& monIndex >= firstId && monIndex < lastId) // Can only switch to mon on your team
|
&& monIndex >= firstId && monIndex < lastId) // Can only switch to mon on your team
|
||||||
|
|
@ -4559,13 +4559,13 @@ bool32 PartyHasMoveCategory(u32 battlerId, enum DamageCategory category)
|
||||||
|
|
||||||
for (u32 monIndex = 0; monIndex < PARTY_SIZE; monIndex++)
|
for (u32 monIndex = 0; monIndex < PARTY_SIZE; monIndex++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&party[monIndex], MON_DATA_HP, NULL) == 0)
|
if (GetMonData(&party[monIndex], MON_DATA_HP) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (u32 moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
for (u32 moveIndex = 0; moveIndex < MAX_MON_MOVES; moveIndex++)
|
||||||
{
|
{
|
||||||
enum Move move = GetMonData(&party[monIndex], MON_DATA_MOVE1 + moveIndex, NULL);
|
enum Move move = GetMonData(&party[monIndex], MON_DATA_MOVE1 + moveIndex);
|
||||||
u32 pp = GetMonData(&party[monIndex], MON_DATA_PP1 + moveIndex, NULL);
|
u32 pp = GetMonData(&party[monIndex], MON_DATA_PP1 + moveIndex);
|
||||||
|
|
||||||
if (pp > 0 && move != MOVE_NONE)
|
if (pp > 0 && move != MOVE_NONE)
|
||||||
{
|
{
|
||||||
|
|
@ -4814,10 +4814,10 @@ static enum AIScore IncreaseStatUpScoreInternal(u32 battlerAtk, u32 battlerDef,
|
||||||
// If expected switchin outspeeds and has Encore, don't increase
|
// If expected switchin outspeeds and has Encore, don't increase
|
||||||
for (u32 monIndex = 0; monIndex < MAX_MON_MOVES; monIndex++)
|
for (u32 monIndex = 0; monIndex < MAX_MON_MOVES; monIndex++)
|
||||||
{
|
{
|
||||||
if (GetMoveEffect(GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_MOVE1 + monIndex, NULL)) == EFFECT_ENCORE
|
if (GetMoveEffect(GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_MOVE1 + monIndex)) == EFFECT_ENCORE
|
||||||
&& GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_PP1 + monIndex, NULL) > 0);
|
&& GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_PP1 + monIndex) > 0);
|
||||||
{
|
{
|
||||||
if (GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_SPEED, NULL) > gBattleMons[battlerAtk].speed)
|
if (GetMonData(&playerParty[gAiLogicData->mostSuitableMonId[battlerDef]], MON_DATA_SPEED) > gBattleMons[battlerAtk].speed)
|
||||||
return NO_INCREASE;
|
return NO_INCREASE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -657,7 +657,7 @@ static u8 GetBattleEnvironmentOverride(void)
|
||||||
return BATTLE_ENVIRONMENT_FRONTIER;
|
return BATTLE_ENVIRONMENT_FRONTIER;
|
||||||
else if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
|
else if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
|
||||||
{
|
{
|
||||||
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL))
|
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES))
|
||||||
{
|
{
|
||||||
case SPECIES_GROUDON:
|
case SPECIES_GROUDON:
|
||||||
return BATTLE_ENVIRONMENT_GROUDON;
|
return BATTLE_ENVIRONMENT_GROUDON;
|
||||||
|
|
|
||||||
|
|
@ -1935,11 +1935,11 @@ static void InitDomeTrainers(void)
|
||||||
// Store the data used to display party information on the player's tourney page
|
// Store the data used to display party information on the player's tourney page
|
||||||
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
DOME_MONS[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES, NULL);
|
DOME_MONS[0][i] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_SPECIES);
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j, NULL);
|
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].moves[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_MOVE1 + j);
|
||||||
for (j = 0; j < NUM_STATS; j++)
|
for (j = 0; j < NUM_STATS; j++)
|
||||||
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HP_EV + j, NULL);
|
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].evs[j] = GetMonData(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1], MON_DATA_HP_EV + j);
|
||||||
|
|
||||||
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].nature = GetNature(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1]);
|
gSaveBlock2Ptr->frontier.domePlayerPartyData[i].nature = GetNature(&gPlayerParty[gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1]);
|
||||||
}
|
}
|
||||||
|
|
@ -2012,14 +2012,14 @@ static void InitDomeTrainers(void)
|
||||||
{
|
{
|
||||||
// trainerId var re-used here as index of selected mons
|
// trainerId var re-used here as index of selected mons
|
||||||
trainerId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
trainerId = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_ATK, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_ATK);
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_DEF, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_DEF);
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPATK, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPATK);
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPDEF, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPDEF);
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPEED, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_SPEED);
|
||||||
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_MAX_HP, NULL);
|
rankingScores[0] += GetMonData(&gPlayerParty[trainerId], MON_DATA_MAX_HP);
|
||||||
monTypesBits |= 1u << GetSpeciesType(GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL), 0);
|
monTypesBits |= 1u << GetSpeciesType(GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES), 0);
|
||||||
monTypesBits |= 1u << GetSpeciesType(GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES, NULL), 1);
|
monTypesBits |= 1u << GetSpeciesType(GetMonData(&gPlayerParty[trainerId], MON_DATA_SPECIES), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count the number of types in the players party, to factor into the ranking
|
// Count the number of types in the players party, to factor into the ranking
|
||||||
|
|
@ -2270,12 +2270,12 @@ static int SelectOpponentMons_Good(u16 tournamentTrainerId, bool8 allowRandom)
|
||||||
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
|
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
|
||||||
{
|
{
|
||||||
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
|
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
|
||||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD);
|
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES), EFFECTIVENESS_MODE_GOOD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
|
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
|
||||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_GOOD);
|
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES), EFFECTIVENESS_MODE_GOOD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2299,12 +2299,12 @@ static int SelectOpponentMons_Bad(u16 tournamentTrainerId, bool8 allowRandom)
|
||||||
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
|
if (DOME_TRAINERS[tournamentTrainerId].trainerId == TRAINER_FRONTIER_BRAIN)
|
||||||
{
|
{
|
||||||
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
|
partyMovePoints[i] += GetTypeEffectivenessPoints(GetFrontierBrainMonMove(i, moveIndex),
|
||||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD);
|
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES), EFFECTIVENESS_MODE_BAD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
|
partyMovePoints[i] += GetTypeEffectivenessPoints(gFacilityTrainerMons[DOME_MONS[tournamentTrainerId][i]].moves[moveIndex],
|
||||||
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES, NULL), EFFECTIVENESS_MODE_BAD);
|
GetMonData(&gPlayerParty[playerMonId], MON_DATA_SPECIES), EFFECTIVENESS_MODE_BAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5666,7 +5666,7 @@ static void ResetSketchedMoves(void)
|
||||||
count = 0;
|
count = 0;
|
||||||
while (count < MAX_MON_MOVES)
|
while (count < MAX_MON_MOVES)
|
||||||
{
|
{
|
||||||
if (GetMonData(GetSavedPlayerPartyMon(playerMonId), MON_DATA_MOVE1 + count, NULL) == GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveSlot, NULL))
|
if (GetMonData(GetSavedPlayerPartyMon(playerMonId), MON_DATA_MOVE1 + count) == GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + moveSlot))
|
||||||
break;
|
break;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -5685,7 +5685,7 @@ static void RestoreDomePlayerPartyHeldItems(void)
|
||||||
for (i = 0; i < DOME_BATTLE_PARTY_SIZE; i++)
|
for (i = 0; i < DOME_BATTLE_PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
int playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
|
int playerMonId = gSaveBlock2Ptr->frontier.selectedPartyMons[gSelectedOrderFromParty[i] - 1] - 1;
|
||||||
u16 item = GetMonData(GetSavedPlayerPartyMon(playerMonId), MON_DATA_HELD_ITEM, NULL);
|
u16 item = GetMonData(GetSavedPlayerPartyMon(playerMonId), MON_DATA_HELD_ITEM);
|
||||||
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
|
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -325,9 +325,9 @@ static void SetRentalsToOpponentParty(void)
|
||||||
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].monId = gFrontierTempParty[i];
|
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].monId = gFrontierTempParty[i];
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].ivs = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ATK_IV, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].ivs = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ATK_IV);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].personality = GetMonData(&gEnemyParty[i], MON_DATA_PERSONALITY, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].personality = GetMonData(&gEnemyParty[i], MON_DATA_PERSONALITY);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].abilityNum = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ABILITY_NUM, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i + FRONTIER_PARTY_SIZE].abilityNum = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ABILITY_NUM);
|
||||||
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gFacilityTrainerMons[gFrontierTempParty[i]].heldItem);
|
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gFacilityTrainerMons[gFrontierTempParty[i]].heldItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1772,9 +1772,9 @@ static void Select_CopyMonsToPlayerParty(void)
|
||||||
{
|
{
|
||||||
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
|
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monId;
|
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monId;
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i].abilityNum = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ABILITY_NUM, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i].abilityNum = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ABILITY_NUM);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1836,7 +1836,7 @@ static void Select_PrintMonSpecies(void)
|
||||||
u8 monId = sFactorySelectScreen->cursorPos;
|
u8 monId = sFactorySelectScreen->cursorPos;
|
||||||
|
|
||||||
FillWindowPixelBuffer(SELECT_WIN_SPECIES, PIXEL_FILL(0));
|
FillWindowPixelBuffer(SELECT_WIN_SPECIES, PIXEL_FILL(0));
|
||||||
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL);
|
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES);
|
||||||
StringCopy(gStringVar4, GetSpeciesName(species));
|
StringCopy(gStringVar4, GetSpeciesName(species));
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
||||||
AddTextPrinterParameterized3(SELECT_WIN_SPECIES, FONT_NORMAL, x, 1, sSpeciesNameTextColors, 0, gStringVar4);
|
AddTextPrinterParameterized3(SELECT_WIN_SPECIES, FONT_NORMAL, x, 1, sSpeciesNameTextColors, 0, gStringVar4);
|
||||||
|
|
@ -1956,7 +1956,7 @@ static void Select_PrintMonCategory(void)
|
||||||
{
|
{
|
||||||
PutWindowTilemap(SELECT_WIN_MON_CATEGORY);
|
PutWindowTilemap(SELECT_WIN_MON_CATEGORY);
|
||||||
FillWindowPixelBuffer(SELECT_WIN_MON_CATEGORY, PIXEL_FILL(0));
|
FillWindowPixelBuffer(SELECT_WIN_MON_CATEGORY, PIXEL_FILL(0));
|
||||||
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES, NULL);
|
species = GetMonData(&sFactorySelectScreen->mons[monId].monData, MON_DATA_SPECIES);
|
||||||
CopyMonCategoryText(species, text);
|
CopyMonCategoryText(species, text);
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118);
|
||||||
AddTextPrinterParameterized(SELECT_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL);
|
AddTextPrinterParameterized(SELECT_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL);
|
||||||
|
|
@ -1968,9 +1968,9 @@ static void Select_CreateMonSprite(void)
|
||||||
{
|
{
|
||||||
u8 monId = sFactorySelectScreen->cursorPos;
|
u8 monId = sFactorySelectScreen->cursorPos;
|
||||||
struct Pokemon *mon = &sFactorySelectScreen->mons[monId].monData;
|
struct Pokemon *mon = &sFactorySelectScreen->mons[monId].monData;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
bool8 isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
bool8 isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
|
|
||||||
sFactorySelectScreen->monPics[1].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
sFactorySelectScreen->monPics[1].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
||||||
gSprites[sFactorySelectScreen->monPics[1].monSpriteId].centerToCornerVecX = 0;
|
gSprites[sFactorySelectScreen->monPics[1].monSpriteId].centerToCornerVecX = 0;
|
||||||
|
|
@ -1995,9 +1995,9 @@ static void Select_ReshowMonSprite(void)
|
||||||
StartSpriteAffineAnim(&gSprites[sFactorySelectScreen->monPics[1].bgSpriteId], 2);
|
StartSpriteAffineAnim(&gSprites[sFactorySelectScreen->monPics[1].bgSpriteId], 2);
|
||||||
|
|
||||||
mon = &sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monData;
|
mon = &sFactorySelectScreen->mons[sFactorySelectScreen->cursorPos].monData;
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
|
|
||||||
sFactorySelectScreen->monPics[1].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
sFactorySelectScreen->monPics[1].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
||||||
gSprites[sFactorySelectScreen->monPics[1].monSpriteId].centerToCornerVecX = 0;
|
gSprites[sFactorySelectScreen->monPics[1].monSpriteId].centerToCornerVecX = 0;
|
||||||
|
|
@ -2017,9 +2017,9 @@ static void Select_CreateChosenMonsSprites(void)
|
||||||
if (sFactorySelectScreen->mons[j].selectedId == i + 1)
|
if (sFactorySelectScreen->mons[j].selectedId == i + 1)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &sFactorySelectScreen->mons[j].monData;
|
struct Pokemon *mon = &sFactorySelectScreen->mons[j].monData;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
bool8 isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
bool8 isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
|
|
||||||
sFactorySelectScreen->monPics[i].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, (i * 72) + 16, 32, i + 13, TAG_NONE);
|
sFactorySelectScreen->monPics[i].monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, (i * 72) + 16, 32, i + 13, TAG_NONE);
|
||||||
gSprites[sFactorySelectScreen->monPics[i].monSpriteId].centerToCornerVecX = 0;
|
gSprites[sFactorySelectScreen->monPics[i].monSpriteId].centerToCornerVecX = 0;
|
||||||
|
|
@ -2310,8 +2310,8 @@ static void CopySwappedMonData(void)
|
||||||
SetMonData(&gPlayerParty[sFactorySwapScreen->playerMonId], MON_DATA_FRIENDSHIP, &friendship);
|
SetMonData(&gPlayerParty[sFactorySwapScreen->playerMonId], MON_DATA_FRIENDSHIP, &friendship);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].monId = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + FRONTIER_PARTY_SIZE].monId;
|
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].monId = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + FRONTIER_PARTY_SIZE].monId;
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].ivs = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + FRONTIER_PARTY_SIZE].ivs;
|
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].ivs = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + FRONTIER_PARTY_SIZE].ivs;
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].personality = GetMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId], MON_DATA_PERSONALITY, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].personality = GetMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId], MON_DATA_PERSONALITY);
|
||||||
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].abilityNum = GetBoxMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId].box, MON_DATA_ABILITY_NUM, NULL);
|
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].abilityNum = GetBoxMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId].box, MON_DATA_ABILITY_NUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Main swap states
|
// Main swap states
|
||||||
|
|
@ -3740,9 +3740,9 @@ static void Swap_PrintMonSpecies(void)
|
||||||
{
|
{
|
||||||
u8 monId = sFactorySwapScreen->cursorPos;
|
u8 monId = sFactorySwapScreen->cursorPos;
|
||||||
if (!sFactorySwapScreen->inEnemyScreen)
|
if (!sFactorySwapScreen->inEnemyScreen)
|
||||||
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||||
else
|
else
|
||||||
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||||
StringCopy(gStringVar4, GetSpeciesName(species));
|
StringCopy(gStringVar4, GetSpeciesName(species));
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
||||||
AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
||||||
|
|
@ -3849,9 +3849,9 @@ static void Swap_PrintMonSpeciesAtFade(void)
|
||||||
{
|
{
|
||||||
u8 monId = sFactorySwapScreen->cursorPos;
|
u8 monId = sFactorySwapScreen->cursorPos;
|
||||||
if (!sFactorySwapScreen->inEnemyScreen)
|
if (!sFactorySwapScreen->inEnemyScreen)
|
||||||
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||||
else
|
else
|
||||||
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||||
StringCopy(gStringVar4, GetSpeciesName(species));
|
StringCopy(gStringVar4, GetSpeciesName(species));
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
||||||
AddTextPrinterParameterized3(SWAP_WIN_SPECIES_AT_FADE, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
AddTextPrinterParameterized3(SWAP_WIN_SPECIES_AT_FADE, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
||||||
|
|
@ -3876,9 +3876,9 @@ static void Swap_PrintMonSpeciesForTransition(void)
|
||||||
{
|
{
|
||||||
u8 monId = sFactorySwapScreen->cursorPos;
|
u8 monId = sFactorySwapScreen->cursorPos;
|
||||||
if (!sFactorySwapScreen->inEnemyScreen)
|
if (!sFactorySwapScreen->inEnemyScreen)
|
||||||
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||||
else
|
else
|
||||||
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||||
StringCopy(gStringVar4, GetSpeciesName(species));
|
StringCopy(gStringVar4, GetSpeciesName(species));
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, gStringVar4, 86);
|
||||||
AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
AddTextPrinterParameterized3(SWAP_WIN_SPECIES, FONT_NORMAL, x, 1, sSwapSpeciesNameTextColors, 0, gStringVar4);
|
||||||
|
|
@ -3902,9 +3902,9 @@ static void Swap_PrintMonCategory(void)
|
||||||
{
|
{
|
||||||
PutWindowTilemap(SWAP_WIN_MON_CATEGORY);
|
PutWindowTilemap(SWAP_WIN_MON_CATEGORY);
|
||||||
if (!sFactorySwapScreen->inEnemyScreen)
|
if (!sFactorySwapScreen->inEnemyScreen)
|
||||||
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES);
|
||||||
else
|
else
|
||||||
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||||
CopyMonCategoryText(species, text);
|
CopyMonCategoryText(species, text);
|
||||||
x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118);
|
x = GetStringRightAlignXOffset(FONT_NORMAL, text, 118);
|
||||||
AddTextPrinterParameterized(SWAP_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL);
|
AddTextPrinterParameterized(SWAP_WIN_MON_CATEGORY, FONT_NORMAL, text, x, 1, 0, NULL);
|
||||||
|
|
@ -4037,9 +4037,9 @@ static void Swap_ShowSummaryMonSprite(void)
|
||||||
StartSpriteAffineAnim(&gSprites[sFactorySwapScreen->monPic.bgSpriteId], 2);
|
StartSpriteAffineAnim(&gSprites[sFactorySwapScreen->monPic.bgSpriteId], 2);
|
||||||
|
|
||||||
mon = &gPlayerParty[sFactorySwapScreen->cursorPos];
|
mon = &gPlayerParty[sFactorySwapScreen->cursorPos];
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
|
|
||||||
sFactorySwapScreen->monPic.monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
sFactorySwapScreen->monPic.monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
||||||
gSprites[sFactorySwapScreen->monPic.monSpriteId].centerToCornerVecX = 0;
|
gSprites[sFactorySwapScreen->monPic.monSpriteId].centerToCornerVecX = 0;
|
||||||
|
|
@ -4113,11 +4113,11 @@ static void Swap_TaskCantHaveSameMons(u8 taskId)
|
||||||
static bool8 Swap_AlreadyHasSameSpecies(u8 monId)
|
static bool8 Swap_AlreadyHasSameSpecies(u8 monId)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
u16 species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(&gEnemyParty[monId], MON_DATA_SPECIES);
|
||||||
|
|
||||||
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
for (i = 0; i < FRONTIER_PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (i != sFactorySwapScreen->playerMonId && (u16)(GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL)) == species)
|
if (i != sFactorySwapScreen->playerMonId && (u16)(GetMonData(&gPlayerParty[i], MON_DATA_SPECIES)) == species)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -4254,9 +4254,9 @@ static void Swap_CreateMonSprite(void)
|
||||||
else
|
else
|
||||||
mon = &gEnemyParty[sFactorySwapScreen->cursorPos];
|
mon = &gEnemyParty[sFactorySwapScreen->cursorPos];
|
||||||
|
|
||||||
species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
|
|
||||||
sFactorySwapScreen->monPic.monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
sFactorySwapScreen->monPic.monSpriteId = CreateMonPicSprite(species, isShiny, personality, TRUE, 88, 32, 15, TAG_NONE);
|
||||||
gSprites[sFactorySwapScreen->monPic.monSpriteId].centerToCornerVecX = 0;
|
gSprites[sFactorySwapScreen->monPic.monSpriteId].centerToCornerVecX = 0;
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||||
// Ensure this Pokémon species isn't a duplicate.
|
// Ensure this Pokémon species isn't a duplicate.
|
||||||
for (j = 0; j < i + firstMonId; j++)
|
for (j = 0; j < i + firstMonId; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species)
|
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES) == gFacilityTrainerMons[monId].species)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j != i + firstMonId)
|
if (j != i + firstMonId)
|
||||||
|
|
@ -278,8 +278,8 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||||
// Ensure this Pokemon's held item isn't a duplicate.
|
// Ensure this Pokemon's held item isn't a duplicate.
|
||||||
for (j = 0; j < i + firstMonId; j++)
|
for (j = 0; j < i + firstMonId; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) != ITEM_NONE
|
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM) != ITEM_NONE
|
||||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gFacilityTrainerMons[monId].heldItem)
|
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM) == gFacilityTrainerMons[monId].heldItem)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j != i + firstMonId)
|
if (j != i + firstMonId)
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ void HandleIntroSlide(u8 environment)
|
||||||
{
|
{
|
||||||
taskId = CreateTask(BattleIntroSlide3, 0);
|
taskId = CreateTask(BattleIntroSlide3, 0);
|
||||||
}
|
}
|
||||||
else if (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) == SPECIES_KYOGRE)
|
else if (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES) == SPECIES_KYOGRE)
|
||||||
{
|
{
|
||||||
environment = BATTLE_ENVIRONMENT_UNDERWATER;
|
environment = BATTLE_ENVIRONMENT_UNDERWATER;
|
||||||
taskId = CreateTask(BattleIntroSlide2, 0);
|
taskId = CreateTask(BattleIntroSlide2, 0);
|
||||||
|
|
|
||||||
|
|
@ -3485,7 +3485,7 @@ static void DoBattleIntro(void)
|
||||||
{
|
{
|
||||||
BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER);
|
BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER);
|
||||||
MarkBattlerForControllerExec(battler);
|
MarkBattlerForControllerExec(battler);
|
||||||
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES, NULL);
|
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case B_POSITION_PLAYER_RIGHT:
|
case B_POSITION_PLAYER_RIGHT:
|
||||||
|
|
@ -3508,7 +3508,7 @@ static void DoBattleIntro(void)
|
||||||
{
|
{
|
||||||
BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER);
|
BtlController_EmitLoadMonSprite(battler, B_COMM_TO_CONTROLLER);
|
||||||
MarkBattlerForControllerExec(battler);
|
MarkBattlerForControllerExec(battler);
|
||||||
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES, NULL);
|
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -5478,12 +5478,12 @@ static void HandleEndTurn_FinishBattle(void)
|
||||||
{
|
{
|
||||||
if (gBattleResults.playerMon1Species == SPECIES_NONE)
|
if (gBattleResults.playerMon1Species == SPECIES_NONE)
|
||||||
{
|
{
|
||||||
gBattleResults.playerMon1Species = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES, NULL);
|
gBattleResults.playerMon1Species = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES);
|
||||||
GetMonData(GetBattlerMon(battler), MON_DATA_NICKNAME, gBattleResults.playerMon1Name);
|
GetMonData(GetBattlerMon(battler), MON_DATA_NICKNAME, gBattleResults.playerMon1Name);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gBattleResults.playerMon2Species = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES, NULL);
|
gBattleResults.playerMon2Species = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES);
|
||||||
GetMonData(GetBattlerMon(battler), MON_DATA_NICKNAME, gBattleResults.playerMon2Name);
|
GetMonData(GetBattlerMon(battler), MON_DATA_NICKNAME, gBattleResults.playerMon2Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -470,7 +470,7 @@ static enum MoveEndResult MoveEnd_FaintBlock(void)
|
||||||
{
|
{
|
||||||
if (gBattleResults.opponentFaintCounter < 255)
|
if (gBattleResults.opponentFaintCounter < 255)
|
||||||
gBattleResults.opponentFaintCounter++;
|
gBattleResults.opponentFaintCounter++;
|
||||||
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(gBattlerTarget), MON_DATA_SPECIES, NULL);
|
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(gBattlerTarget), MON_DATA_SPECIES);
|
||||||
gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2;
|
gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2;
|
||||||
}
|
}
|
||||||
BattleScriptCall(BattleScript_FaintBattler);
|
BattleScriptCall(BattleScript_FaintBattler);
|
||||||
|
|
|
||||||
|
|
@ -1112,7 +1112,7 @@ bool32 TryGenerateBattlePikeWildMon(bool8 checkKeenEyeIntimidate)
|
||||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||||
const struct PikeWildMon *const *const wildMons = sWildMons[lvlMode];
|
const struct PikeWildMon *const *const wildMons = sWildMons[lvlMode];
|
||||||
u32 abilityNum;
|
u32 abilityNum;
|
||||||
s32 pikeMonId = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL);
|
s32 pikeMonId = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES);
|
||||||
pikeMonId = SpeciesToPikeMonId(pikeMonId);
|
pikeMonId = SpeciesToPikeMonId(pikeMonId);
|
||||||
|
|
||||||
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50)
|
if (gSaveBlock2Ptr->frontier.lvlMode != FRONTIER_LVL_50)
|
||||||
|
|
|
||||||
|
|
@ -1221,13 +1221,13 @@ static void RestorePyramidPlayerParty(void)
|
||||||
int partyIndex = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
int partyIndex = gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1;
|
||||||
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
|
for (j = 0; j < FRONTIER_PARTY_SIZE; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(GetSavedPlayerPartyMon(partyIndex), MON_DATA_SPECIES, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL))
|
if (GetMonData(GetSavedPlayerPartyMon(partyIndex), MON_DATA_SPECIES) == GetMonData(&gPlayerParty[j], MON_DATA_SPECIES))
|
||||||
{
|
{
|
||||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||||
{
|
{
|
||||||
for (l = 0; l < MAX_MON_MOVES; l++)
|
for (l = 0; l < MAX_MON_MOVES; l++)
|
||||||
{
|
{
|
||||||
if (GetMonData(GetSavedPlayerPartyMon(partyIndex), MON_DATA_MOVE1 + l, NULL) == GetMonData(&gPlayerParty[j], MON_DATA_MOVE1 + k, NULL))
|
if (GetMonData(GetSavedPlayerPartyMon(partyIndex), MON_DATA_MOVE1 + l) == GetMonData(&gPlayerParty[j], MON_DATA_MOVE1 + k))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (l == MAX_MON_MOVES)
|
if (l == MAX_MON_MOVES)
|
||||||
|
|
@ -1414,7 +1414,7 @@ void GenerateBattlePyramidWildMon(void)
|
||||||
if (round >= TOTAL_PYRAMID_ROUNDS)
|
if (round >= TOTAL_PYRAMID_ROUNDS)
|
||||||
round = TOTAL_PYRAMID_ROUNDS - 1;
|
round = TOTAL_PYRAMID_ROUNDS - 1;
|
||||||
|
|
||||||
id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1; // index in table (0-11) -> higher index is lower probability
|
id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES) - 1; // index in table (0-11) -> higher index is lower probability
|
||||||
bstLim = 450 + (25*round) + (5*id); // higher BST limit for 'rarer' wild mon rolls
|
bstLim = 450 + (25*round) + (5*id); // higher BST limit for 'rarer' wild mon rolls
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
|
@ -1522,7 +1522,7 @@ void GenerateBattlePyramidWildMon(void)
|
||||||
// Initialize a random ability num
|
// Initialize a random ability num
|
||||||
if (GetSpeciesAbility(species, 1))
|
if (GetSpeciesAbility(species, 1))
|
||||||
{
|
{
|
||||||
i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY, NULL) % 2;
|
i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY) % 2;
|
||||||
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
|
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1580,7 +1580,7 @@ void GenerateBattlePyramidWildMon(void)
|
||||||
else
|
else
|
||||||
wildMons = sLevel50WildMonPointers[round];
|
wildMons = sLevel50WildMonPointers[round];
|
||||||
|
|
||||||
id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL) - 1;
|
id = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES) - 1;
|
||||||
SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &wildMons[id].species);
|
SetMonData(&gEnemyParty[0], MON_DATA_SPECIES, &wildMons[id].species);
|
||||||
StringCopy(name, GetSpeciesName(wildMons[id].species));
|
StringCopy(name, GetSpeciesName(wildMons[id].species));
|
||||||
SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name);
|
SetMonData(&gEnemyParty[0], MON_DATA_NICKNAME, &name);
|
||||||
|
|
@ -1608,7 +1608,7 @@ void GenerateBattlePyramidWildMon(void)
|
||||||
default:
|
default:
|
||||||
if (GetSpeciesAbility(wildMons[id].species, 1))
|
if (GetSpeciesAbility(wildMons[id].species, 1))
|
||||||
{
|
{
|
||||||
i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY, NULL) % 2;
|
i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY) % 2;
|
||||||
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
|
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -4016,7 +4016,7 @@ static void Cmd_tryfaintmon(void)
|
||||||
{
|
{
|
||||||
if (gBattleResults.opponentFaintCounter < 255)
|
if (gBattleResults.opponentFaintCounter < 255)
|
||||||
gBattleResults.opponentFaintCounter++;
|
gBattleResults.opponentFaintCounter++;
|
||||||
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES, NULL);
|
gBattleResults.lastOpponentSpecies = GetMonData(GetBattlerMon(battler), MON_DATA_SPECIES);
|
||||||
gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2;
|
gSideTimers[B_SIDE_OPPONENT].retaliateTimer = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -11640,9 +11640,9 @@ static void Cmd_givecaughtmon(void)
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER]++;
|
gBattleCommunication[MULTISTRING_CHOOSER]++;
|
||||||
}
|
}
|
||||||
|
|
||||||
gBattleResults.caughtMonSpecies = GetMonData(caughtMon, MON_DATA_SPECIES, NULL);
|
gBattleResults.caughtMonSpecies = GetMonData(caughtMon, MON_DATA_SPECIES);
|
||||||
GetMonData(caughtMon, MON_DATA_NICKNAME, gBattleResults.caughtMonNick);
|
GetMonData(caughtMon, MON_DATA_NICKNAME, gBattleResults.caughtMonNick);
|
||||||
gBattleResults.caughtMonBall = GetMonData(caughtMon, MON_DATA_POKEBALL, NULL);
|
gBattleResults.caughtMonBall = GetMonData(caughtMon, MON_DATA_POKEBALL);
|
||||||
|
|
||||||
gSelectedMonPartyId = PARTY_SIZE;
|
gSelectedMonPartyId = PARTY_SIZE;
|
||||||
gBattleCommunication[MULTIUSE_STATE] = 0;
|
gBattleCommunication[MULTIUSE_STATE] = 0;
|
||||||
|
|
@ -11664,8 +11664,8 @@ static void Cmd_trysetcaughtmondexflags(void)
|
||||||
CMD_ARGS(const u8 *failInstr);
|
CMD_ARGS(const u8 *failInstr);
|
||||||
|
|
||||||
struct Pokemon *caughtMon = GetBattlerMon(GetCatchingBattler());
|
struct Pokemon *caughtMon = GetBattlerMon(GetCatchingBattler());
|
||||||
u32 species = GetMonData(caughtMon, MON_DATA_SPECIES, NULL);
|
u32 species = GetMonData(caughtMon, MON_DATA_SPECIES);
|
||||||
u32 personality = GetMonData(caughtMon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetMonData(caughtMon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT))
|
if (GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT))
|
||||||
{
|
{
|
||||||
|
|
@ -11684,7 +11684,7 @@ static void Cmd_displaydexinfo(void)
|
||||||
|
|
||||||
u32 caughtBattler = GetCatchingBattler();
|
u32 caughtBattler = GetCatchingBattler();
|
||||||
struct Pokemon *mon = GetBattlerMon(caughtBattler);
|
struct Pokemon *mon = GetBattlerMon(caughtBattler);
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
|
|
||||||
switch (gBattleCommunication[0])
|
switch (gBattleCommunication[0])
|
||||||
{
|
{
|
||||||
|
|
@ -11861,7 +11861,7 @@ static void Cmd_trygivecaughtmonnick(void)
|
||||||
DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick,
|
DoNamingScreen(NAMING_SCREEN_CAUGHT_MON, gBattleStruct->caughtMonNick,
|
||||||
GetMonData(caughtMon, MON_DATA_SPECIES),
|
GetMonData(caughtMon, MON_DATA_SPECIES),
|
||||||
GetMonGender(caughtMon),
|
GetMonGender(caughtMon),
|
||||||
GetMonData(caughtMon, MON_DATA_PERSONALITY, NULL),
|
GetMonData(caughtMon, MON_DATA_PERSONALITY),
|
||||||
callback);
|
callback);
|
||||||
|
|
||||||
gBattleCommunication[MULTIUSE_STATE]++;
|
gBattleCommunication[MULTIUSE_STATE]++;
|
||||||
|
|
@ -12592,9 +12592,9 @@ void BS_ItemRestorePP(void)
|
||||||
// Heal PP!
|
// Heal PP!
|
||||||
for (; i < loopEnd; i++)
|
for (; i < loopEnd; i++)
|
||||||
{
|
{
|
||||||
pp = GetMonData(mon, MON_DATA_PP1 + i, NULL);
|
pp = GetMonData(mon, MON_DATA_PP1 + i);
|
||||||
moveId = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
|
moveId = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||||
maxPP = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), i);
|
maxPP = CalculatePPWithBonus(moveId, GetMonData(mon, MON_DATA_PP_BONUSES), i);
|
||||||
if (pp != maxPP)
|
if (pp != maxPP)
|
||||||
{
|
{
|
||||||
pp += effect[6];
|
pp += effect[6];
|
||||||
|
|
|
||||||
|
|
@ -481,7 +481,7 @@ void BattleSetup_StartLegendaryBattle(void)
|
||||||
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
gMain.savedCallback = CB2_EndScriptedWildBattle;
|
||||||
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
gBattleTypeFlags = BATTLE_TYPE_LEGENDARY;
|
||||||
|
|
||||||
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL))
|
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case SPECIES_GROUDON:
|
case SPECIES_GROUDON:
|
||||||
|
|
|
||||||
|
|
@ -1176,8 +1176,8 @@ static void GetApprenticeMultiPartnerParty(u16 trainerId)
|
||||||
{
|
{
|
||||||
s32 i, count;
|
s32 i, count;
|
||||||
u32 validSpecies[MULTI_PARTY_SIZE];
|
u32 validSpecies[MULTI_PARTY_SIZE];
|
||||||
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < MULTI_PARTY_SIZE; i++)
|
for (i = 0; i < MULTI_PARTY_SIZE; i++)
|
||||||
|
|
@ -1202,8 +1202,8 @@ static void GetRecordMixFriendMultiPartnerParty(u16 trainerId)
|
||||||
s32 i, count;
|
s32 i, count;
|
||||||
u32 validSpecies[3];
|
u32 validSpecies[3];
|
||||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||||
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
u16 species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
u16 species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
for (i = 0; i < MAX_FRONTIER_PARTY_SIZE; i++)
|
||||||
|
|
@ -1242,8 +1242,8 @@ static void LoadMultiPartnerCandidatesData(void)
|
||||||
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||||
battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
battleMode = VarGet(VAR_FRONTIER_BATTLE_MODE);
|
||||||
challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE;
|
challengeNum = gSaveBlock2Ptr->frontier.towerWinStreaks[battleMode][lvlMode] / FRONTIER_STAGES_PER_CHALLENGE;
|
||||||
species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
level = SetFacilityPtrsGetLevel();
|
level = SetFacilityPtrsGetLevel();
|
||||||
|
|
||||||
j = 0;
|
j = 0;
|
||||||
|
|
@ -1636,8 +1636,8 @@ static void SetTowerInterviewData(void)
|
||||||
StripExtCtrlCodes(text);
|
StripExtCtrlCodes(text);
|
||||||
StringCopy(gSaveBlock2Ptr->frontier.towerInterview.opponentName, text);
|
StringCopy(gSaveBlock2Ptr->frontier.towerInterview.opponentName, text);
|
||||||
GetBattleTowerTrainerLanguage(&gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage, TRAINER_BATTLE_PARAM.opponentA);
|
GetBattleTowerTrainerLanguage(&gSaveBlock2Ptr->frontier.towerInterview.opponentLanguage, TRAINER_BATTLE_PARAM.opponentA);
|
||||||
gSaveBlock2Ptr->frontier.towerInterview.opponentSpecies = GetMonData(GetBattlerMon(1), MON_DATA_SPECIES, NULL);
|
gSaveBlock2Ptr->frontier.towerInterview.opponentSpecies = GetMonData(GetBattlerMon(1), MON_DATA_SPECIES);
|
||||||
gSaveBlock2Ptr->frontier.towerInterview.playerSpecies = GetMonData(GetBattlerMon(0), MON_DATA_SPECIES, NULL);
|
gSaveBlock2Ptr->frontier.towerInterview.playerSpecies = GetMonData(GetBattlerMon(0), MON_DATA_SPECIES);
|
||||||
for (i = 0; i < VANILLA_POKEMON_NAME_LENGTH + 1; i++)
|
for (i = 0; i < VANILLA_POKEMON_NAME_LENGTH + 1; i++)
|
||||||
gSaveBlock2Ptr->frontier.towerInterview.opponentMonNickname[i] = gBattleMons[0].nickname[i];
|
gSaveBlock2Ptr->frontier.towerInterview.opponentMonNickname[i] = gBattleMons[0].nickname[i];
|
||||||
gSaveBlock2Ptr->frontier.towerBattleOutcome = gBattleOutcome;
|
gSaveBlock2Ptr->frontier.towerBattleOutcome = gBattleOutcome;
|
||||||
|
|
@ -2053,7 +2053,7 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||||
// Ensure this Pokémon species isn't a duplicate.
|
// Ensure this Pokémon species isn't a duplicate.
|
||||||
for (j = 0; j < i + firstMonId; j++)
|
for (j = 0; j < i + firstMonId; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES, NULL) == gFacilityTrainerMons[monId].species)
|
if (GetMonData(&gEnemyParty[j], MON_DATA_SPECIES) == gFacilityTrainerMons[monId].species)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j != i + firstMonId)
|
if (j != i + firstMonId)
|
||||||
|
|
@ -2062,8 +2062,8 @@ static void FillTentTrainerParty_(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||||
// Ensure this Pokemon's held item isn't a duplicate.
|
// Ensure this Pokemon's held item isn't a duplicate.
|
||||||
for (j = 0; j < i + firstMonId; j++)
|
for (j = 0; j < i + firstMonId; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) != ITEM_NONE
|
if (GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM) != ITEM_NONE
|
||||||
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM, NULL) == gFacilityTrainerMons[monId].heldItem)
|
&& GetMonData(&gEnemyParty[j], MON_DATA_HELD_ITEM) == gFacilityTrainerMons[monId].heldItem)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (j != i + firstMonId)
|
if (j != i + firstMonId)
|
||||||
|
|
@ -2127,7 +2127,7 @@ void TrySetLinkBattleTowerEnemyPartyLevel(void)
|
||||||
|
|
||||||
for (u32 i = 0; i < PARTY_SIZE; i++)
|
for (u32 i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u32 species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL);
|
u32 species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES);
|
||||||
if (species)
|
if (species)
|
||||||
{
|
{
|
||||||
SetMonData(&gEnemyParty[i], MON_DATA_EXP, &gExperienceTables[gSpeciesInfo[species].growthRate][enemyLevel]);
|
SetMonData(&gEnemyParty[i], MON_DATA_EXP, &gExperienceTables[gSpeciesInfo[species].growthRate][enemyLevel]);
|
||||||
|
|
|
||||||
|
|
@ -192,7 +192,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
case STRINGID_NOTVERYEFFECTIVE:
|
case STRINGID_NOTVERYEFFECTIVE:
|
||||||
case STRINGID_NOTVERYEFFECTIVETWOFOES:
|
case STRINGID_NOTVERYEFFECTIVETWOFOES:
|
||||||
AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 1, 0);
|
AddMovePoints(PTS_EFFECTIVENESS, moveSlot, 1, 0);
|
||||||
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && GetMonData(defMon, MON_DATA_HP, NULL) != 0)
|
if (!(gBattleTypeFlags & BATTLE_TYPE_LINK) && GetMonData(defMon, MON_DATA_HP) != 0)
|
||||||
TrySetBattleSeminarShow();
|
TrySetBattleSeminarShow();
|
||||||
break;
|
break;
|
||||||
case STRINGID_SUPEREFFECTIVE:
|
case STRINGID_SUPEREFFECTIVE:
|
||||||
|
|
@ -315,7 +315,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
tvPtr->pos[defSide][defFlank].curseMoveSlot = moveSlot;
|
tvPtr->pos[defSide][defFlank].curseMoveSlot = moveSlot;
|
||||||
break;
|
break;
|
||||||
case STRINGID_PKMNAFFLICTEDBYCURSE:
|
case STRINGID_PKMNAFFLICTEDBYCURSE:
|
||||||
if (GetMonData(atkMon, MON_DATA_HP, NULL)
|
if (GetMonData(atkMon, MON_DATA_HP)
|
||||||
&& tvPtr->pos[atkSide][atkFlank].curseMonId != 0)
|
&& tvPtr->pos[atkSide][atkFlank].curseMonId != 0)
|
||||||
{
|
{
|
||||||
AddMovePoints(PTS_STATUS_DMG, 0, tvPtr->pos[atkSide][atkFlank].curseMonId - 1, tvPtr->pos[atkSide][atkFlank].curseMoveSlot);
|
AddMovePoints(PTS_STATUS_DMG, 0, tvPtr->pos[atkSide][atkFlank].curseMonId - 1, tvPtr->pos[atkSide][atkFlank].curseMoveSlot);
|
||||||
|
|
@ -340,7 +340,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
tvPtr->pos[defSide][defFlank].nightmareMoveSlot = moveSlot;
|
tvPtr->pos[defSide][defFlank].nightmareMoveSlot = moveSlot;
|
||||||
break;
|
break;
|
||||||
case STRINGID_PKMNLOCKEDINNIGHTMARE:
|
case STRINGID_PKMNLOCKEDINNIGHTMARE:
|
||||||
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
|
if (GetMonData(atkMon, MON_DATA_HP) != 0
|
||||||
&& tvPtr->pos[atkSide][atkFlank].nightmareMonId != 0)
|
&& tvPtr->pos[atkSide][atkFlank].nightmareMonId != 0)
|
||||||
{
|
{
|
||||||
AddMovePoints(PTS_STATUS_DMG, 5, tvPtr->pos[atkSide][atkFlank].nightmareMonId - 1, tvPtr->pos[atkSide][atkFlank].nightmareMoveSlot);
|
AddMovePoints(PTS_STATUS_DMG, 5, tvPtr->pos[atkSide][atkFlank].nightmareMonId - 1, tvPtr->pos[atkSide][atkFlank].nightmareMoveSlot);
|
||||||
|
|
@ -357,7 +357,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
tvPtr->pos[defSide][defFlank].wrapMoveSlot = moveSlot;
|
tvPtr->pos[defSide][defFlank].wrapMoveSlot = moveSlot;
|
||||||
break;
|
break;
|
||||||
case STRINGID_PKMNHURTBY:
|
case STRINGID_PKMNHURTBY:
|
||||||
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0
|
if (GetMonData(atkMon, MON_DATA_HP) != 0
|
||||||
&& tvPtr->pos[atkSide][atkFlank].wrapMonId != 0)
|
&& tvPtr->pos[atkSide][atkFlank].wrapMonId != 0)
|
||||||
{
|
{
|
||||||
AddMovePoints(PTS_STATUS_DMG, 6, tvPtr->pos[atkSide][atkFlank].wrapMonId - 1, tvPtr->pos[atkSide][atkFlank].wrapMoveSlot);
|
AddMovePoints(PTS_STATUS_DMG, 6, tvPtr->pos[atkSide][atkFlank].wrapMonId - 1, tvPtr->pos[atkSide][atkFlank].wrapMoveSlot);
|
||||||
|
|
@ -370,7 +370,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMoveSlot = moveSlot;
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].brnMoveSlot = moveSlot;
|
||||||
break;
|
break;
|
||||||
case STRINGID_PKMNHURTBYBURN:
|
case STRINGID_PKMNHURTBYBURN:
|
||||||
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
|
if (GetMonData(atkMon, MON_DATA_HP) != 0)
|
||||||
{
|
{
|
||||||
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId != 0)
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId != 0)
|
||||||
AddMovePoints(PTS_STATUS_DMG, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot);
|
AddMovePoints(PTS_STATUS_DMG, 4, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].brnMoveSlot);
|
||||||
|
|
@ -387,7 +387,7 @@ void BattleTv_SetDataBasedOnString(enum StringID stringId)
|
||||||
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMoveSlot = moveSlot;
|
tvPtr->mon[effSide][gBattlerPartyIndexes[gEffectBattler]].badPsnMoveSlot = moveSlot;
|
||||||
break;
|
break;
|
||||||
case STRINGID_PKMNHURTBYPOISON:
|
case STRINGID_PKMNHURTBYPOISON:
|
||||||
if (GetMonData(atkMon, MON_DATA_HP, NULL) != 0)
|
if (GetMonData(atkMon, MON_DATA_HP) != 0)
|
||||||
{
|
{
|
||||||
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId != 0)
|
if (tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId != 0)
|
||||||
AddMovePoints(PTS_STATUS_DMG, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot);
|
AddMovePoints(PTS_STATUS_DMG, 2, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMonId - 1, tvPtr->mon[atkSide][gBattlerPartyIndexes[gBattlerAttacker]].psnMoveSlot);
|
||||||
|
|
@ -677,9 +677,9 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||||
movePoints = &gBattleStruct->tvMovePoints;
|
movePoints = &gBattleStruct->tvMovePoints;
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
countPlayer++;
|
countPlayer++;
|
||||||
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if (GetMonData(&gEnemyParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
countOpponent++;
|
countOpponent++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -688,8 +688,8 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES);
|
||||||
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG, NULL))
|
if (species != SPECIES_NONE && !GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG))
|
||||||
{
|
{
|
||||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||||
sum += movePoints->points[zero][i * 4 + j];
|
sum += movePoints->points[zero][i * 4 + j];
|
||||||
|
|
@ -702,15 +702,15 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES, NULL);
|
species = GetMonData(&gEnemyParty[i], MON_DATA_SPECIES);
|
||||||
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG, NULL))
|
if (species != SPECIES_NONE && !GetMonData(&gEnemyParty[i], MON_DATA_IS_EGG))
|
||||||
{
|
{
|
||||||
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
for (sum = 0, j = 0; j < MAX_MON_MOVES; j++)
|
||||||
sum += movePoints->points[one][i * 4 + j];
|
sum += movePoints->points[one][i * 4 + j];
|
||||||
|
|
||||||
if (opponentBestSum == sum)
|
if (opponentBestSum == sum)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[i], MON_DATA_EXP, NULL) > GetMonData(&gEnemyParty[opponentBestMonId], MON_DATA_EXP, NULL))
|
if (GetMonData(&gEnemyParty[i], MON_DATA_EXP) > GetMonData(&gEnemyParty[opponentBestMonId], MON_DATA_EXP))
|
||||||
{
|
{
|
||||||
opponentBestMonId = i;
|
opponentBestMonId = i;
|
||||||
opponentBestSum = sum;
|
opponentBestSum = sum;
|
||||||
|
|
@ -735,7 +735,7 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
move = GetMonData(&gPlayerParty[playerBestMonId], MON_DATA_MOVE1 + i, NULL);
|
move = GetMonData(&gPlayerParty[playerBestMonId], MON_DATA_MOVE1 + i);
|
||||||
if (playerBestSum == 0 || move == MOVE_NONE)
|
if (playerBestSum == 0 || move == MOVE_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1310,8 +1310,8 @@ static void TrySetBattleSeminarShow(void)
|
||||||
bestMoveId = i;
|
bestMoveId = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
opponentSpecies = GetMonData(GetBattlerMon(gBattlerTarget), MON_DATA_SPECIES, NULL);
|
opponentSpecies = GetMonData(GetBattlerMon(gBattlerTarget), MON_DATA_SPECIES);
|
||||||
playerSpecies = GetMonData(GetBattlerMon(gBattlerAttacker), MON_DATA_SPECIES, NULL);
|
playerSpecies = GetMonData(GetBattlerMon(gBattlerAttacker), MON_DATA_SPECIES);
|
||||||
TryPutBattleSeminarOnAir(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]);
|
TryPutBattleSeminarOnAir(opponentSpecies, playerSpecies, gMoveSelectionCursor[gBattlerAttacker], gBattleMons[gBattlerAttacker].moves, gBattleMons[gBattlerAttacker].moves[bestMoveId]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1394,7 +1394,7 @@ u8 GetBattlerMoveSlotId(u8 battler, enum Move move)
|
||||||
{
|
{
|
||||||
if (i >= MAX_MON_MOVES)
|
if (i >= MAX_MON_MOVES)
|
||||||
break;
|
break;
|
||||||
if (GetMonData(mon, MON_DATA_MOVE1 + i, NULL) == move)
|
if (GetMonData(mon, MON_DATA_MOVE1 + i) == move)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9145,14 +9145,14 @@ static inline s32 DoFutureSightAttackDamageCalcVars(struct BattleContext *ctx)
|
||||||
|
|
||||||
struct Pokemon *party = GetBattlerParty(battlerAtk);
|
struct Pokemon *party = GetBattlerParty(battlerAtk);
|
||||||
struct Pokemon *partyMon = &party[gBattleStruct->futureSight[battlerDef].partyIndex];
|
struct Pokemon *partyMon = &party[gBattleStruct->futureSight[battlerDef].partyIndex];
|
||||||
u32 partyMonLevel = GetMonData(partyMon, MON_DATA_LEVEL, NULL);
|
u32 partyMonLevel = GetMonData(partyMon, MON_DATA_LEVEL);
|
||||||
u32 partyMonSpecies = GetMonData(partyMon, MON_DATA_SPECIES, NULL);
|
u32 partyMonSpecies = GetMonData(partyMon, MON_DATA_SPECIES);
|
||||||
gBattleMovePower = GetMovePower(move);
|
gBattleMovePower = GetMovePower(move);
|
||||||
|
|
||||||
if (IsBattleMovePhysical(move))
|
if (IsBattleMovePhysical(move))
|
||||||
userFinalAttack = GetMonData(partyMon, MON_DATA_ATK, NULL);
|
userFinalAttack = GetMonData(partyMon, MON_DATA_ATK);
|
||||||
else
|
else
|
||||||
userFinalAttack = GetMonData(partyMon, MON_DATA_SPATK, NULL);
|
userFinalAttack = GetMonData(partyMon, MON_DATA_SPATK);
|
||||||
|
|
||||||
targetFinalDefense = CalcDefenseStat(ctx);
|
targetFinalDefense = CalcDefenseStat(ctx);
|
||||||
dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, partyMonLevel, targetFinalDefense);
|
dmg = CalculateBaseDamage(gBattleMovePower, userFinalAttack, partyMonLevel, targetFinalDefense);
|
||||||
|
|
@ -10038,7 +10038,7 @@ bool32 TryRevertPartyMonFormChange(u32 partyIndex)
|
||||||
bool32 changedForm = FALSE;
|
bool32 changedForm = FALSE;
|
||||||
|
|
||||||
// Appeared in battle and didn't faint
|
// Appeared in battle and didn't faint
|
||||||
if (gBattleStruct->partyState[B_SIDE_PLAYER][partyIndex].sentOut && GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP, NULL) != 0)
|
if (gBattleStruct->partyState[B_SIDE_PLAYER][partyIndex].sentOut && GetMonData(&gPlayerParty[partyIndex], MON_DATA_HP) != 0)
|
||||||
changedForm = TryFormChange(partyIndex, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE_ENVIRONMENT);
|
changedForm = TryFormChange(partyIndex, B_SIDE_PLAYER, FORM_CHANGE_END_BATTLE_ENVIRONMENT);
|
||||||
|
|
||||||
if (!changedForm)
|
if (!changedForm)
|
||||||
|
|
@ -10993,7 +10993,7 @@ bool32 MoveIsAffectedBySheerForce(enum Move move)
|
||||||
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon)
|
bool8 CanMonParticipateInSkyBattle(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u16 monAbilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL);
|
u16 monAbilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
|
||||||
|
|
||||||
bool8 hasLevitateAbility = GetSpeciesAbility(species, monAbilityNum) == ABILITY_LEVITATE;
|
bool8 hasLevitateAbility = GetSpeciesAbility(species, monAbilityNum) == ABILITY_LEVITATE;
|
||||||
bool8 isFlyingType = GetSpeciesType(species, 0) == TYPE_FLYING || GetSpeciesType(species, 1) == TYPE_FLYING;
|
bool8 isFlyingType = GetSpeciesType(species, 0) == TYPE_FLYING || GetSpeciesType(species, 1) == TYPE_FLYING;
|
||||||
|
|
|
||||||
|
|
@ -372,8 +372,8 @@ static void Task_LinkupExchangeDataWithLeader(u8 taskId)
|
||||||
SaveLinkPlayers(gFieldLinkPlayerCount);
|
SaveLinkPlayers(gFieldLinkPlayerCount);
|
||||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||||
TrainerCard_GenerateCardForLinkPlayer(card);
|
TrainerCard_GenerateCardForLinkPlayer(card);
|
||||||
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
|
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
|
||||||
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
|
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES);
|
||||||
gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
|
gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -420,8 +420,8 @@ static void Task_LinkupCheckStatusAfterConfirm(u8 taskId)
|
||||||
SaveLinkPlayers(gFieldLinkPlayerCount);
|
SaveLinkPlayers(gFieldLinkPlayerCount);
|
||||||
card = (struct TrainerCard *)gBlockSendBuffer;
|
card = (struct TrainerCard *)gBlockSendBuffer;
|
||||||
TrainerCard_GenerateCardForLinkPlayer(card);
|
TrainerCard_GenerateCardForLinkPlayer(card);
|
||||||
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
|
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
|
||||||
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
|
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES);
|
||||||
gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
|
gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
|
||||||
SendBlockRequest(BLOCK_REQ_SIZE_100);
|
SendBlockRequest(BLOCK_REQ_SIZE_100);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -591,7 +591,7 @@ static void _TriggerPendingDaycareEgg(struct DayCare *daycare)
|
||||||
// inherit nature
|
// inherit nature
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
u8 wantedNature = GetNatureFromPersonality(GetBoxMonData(&daycare->mons[parent].mon, MON_DATA_PERSONALITY, NULL));
|
u8 wantedNature = GetNatureFromPersonality(GetBoxMonData(&daycare->mons[parent].mon, MON_DATA_PERSONALITY));
|
||||||
u32 personality;
|
u32 personality;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -1280,7 +1280,7 @@ static void DexNavGenerateMoveset(u16 species, u8 searchLevel, u8 encounterLevel
|
||||||
|
|
||||||
// Store generated mon moves into Dex Nav Struct
|
// Store generated mon moves into Dex Nav Struct
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
moveDst[i] = GetMonData(&gEnemyParty[0], MON_DATA_MOVE1 + i, NULL);
|
moveDst[i] = GetMonData(&gEnemyParty[0], MON_DATA_MOVE1 + i);
|
||||||
|
|
||||||
// set first move slot to a random egg move if search level is good enough
|
// set first move slot to a random egg move if search level is good enough
|
||||||
if (genMove)
|
if (genMove)
|
||||||
|
|
|
||||||
|
|
@ -1438,7 +1438,7 @@ bool8 FoundAbandonedShipRoom6Key(void)
|
||||||
|
|
||||||
bool8 LeadMonHasEffortRibbon(void)
|
bool8 LeadMonHasEffortRibbon(void)
|
||||||
{
|
{
|
||||||
return GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_EFFORT_RIBBON, NULL);
|
return GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_EFFORT_RIBBON);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GiveLeadMonEffortRibbon(void)
|
void GiveLeadMonEffortRibbon(void)
|
||||||
|
|
@ -1508,7 +1508,7 @@ bool8 IsStarterInParty(void)
|
||||||
u8 partyCount = CalculatePlayerPartyCount();
|
u8 partyCount = CalculatePlayerPartyCount();
|
||||||
for (i = 0; i < partyCount; i++)
|
for (i = 0; i < partyCount; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) == starter)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) == starter)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -1601,8 +1601,8 @@ u8 GetLeadMonIndex(void)
|
||||||
u8 partyCount = CalculatePlayerPartyCount();
|
u8 partyCount = CalculatePlayerPartyCount();
|
||||||
for (i = 0; i < partyCount; i++)
|
for (i = 0; i < partyCount; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) != SPECIES_EGG
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_EGG
|
||||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) != SPECIES_NONE)
|
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_NONE)
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -4316,7 +4316,7 @@ void TrySkyBattle(void)
|
||||||
for (i = 0; i < CalculatePlayerPartyCount(); i++)
|
for (i = 0; i < CalculatePlayerPartyCount(); i++)
|
||||||
{
|
{
|
||||||
struct Pokemon* pokemon = &gPlayerParty[i];
|
struct Pokemon* pokemon = &gPlayerParty[i];
|
||||||
if (CanMonParticipateInSkyBattle(pokemon) && GetMonData(pokemon, MON_DATA_HP, NULL) > 0)
|
if (CanMonParticipateInSkyBattle(pokemon) && GetMonData(pokemon, MON_DATA_HP) > 0)
|
||||||
{
|
{
|
||||||
PreparePartyForSkyBattle();
|
PreparePartyForSkyBattle();
|
||||||
gSpecialVar_Result = TRUE;
|
gSpecialVar_Result = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -2259,7 +2259,7 @@ static void RestoreHeldItems(void)
|
||||||
{
|
{
|
||||||
if (gSaveBlock2Ptr->frontier.selectedPartyMons[i] != 0)
|
if (gSaveBlock2Ptr->frontier.selectedPartyMons[i] != 0)
|
||||||
{
|
{
|
||||||
u16 item = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1), MON_DATA_HELD_ITEM, NULL);
|
u16 item = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1), MON_DATA_HELD_ITEM);
|
||||||
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
|
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2297,8 +2297,8 @@ static void ResetSketchedMoves(void)
|
||||||
{
|
{
|
||||||
for (k = 0; k < MAX_MON_MOVES; k++)
|
for (k = 0; k < MAX_MON_MOVES; k++)
|
||||||
{
|
{
|
||||||
if (GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1), MON_DATA_MOVE1 + k, NULL)
|
if (GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[i] - 1), MON_DATA_MOVE1 + k)
|
||||||
== GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j, NULL))
|
== GetMonData(&gPlayerParty[i], MON_DATA_MOVE1 + j))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (k == MAX_MON_MOVES)
|
if (k == MAX_MON_MOVES)
|
||||||
|
|
@ -3294,10 +3294,10 @@ s32 GetHighestLevelInPlayerParty(void)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES)
|
||||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) != SPECIES_EGG)
|
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_EGG)
|
||||||
{
|
{
|
||||||
s32 level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL, NULL);
|
s32 level = GetMonData(&gPlayerParty[i], MON_DATA_LEVEL);
|
||||||
if (level > highestLevel)
|
if (level > highestLevel)
|
||||||
highestLevel = level;
|
highestLevel = level;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4969,8 +4969,8 @@ void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task)
|
||||||
|
|
||||||
tState = 0;
|
tState = 0;
|
||||||
tMonId = gPartyMenu.slotId;
|
tMonId = gPartyMenu.slotId;
|
||||||
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES, NULL);
|
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES);
|
||||||
tAbilityNum = GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, NULL) ^ 1;
|
tAbilityNum = GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM) ^ 1;
|
||||||
SetWordTaskArg(taskId, tOldFunc, (uintptr_t)(gTasks[taskId].func));
|
SetWordTaskArg(taskId, tOldFunc, (uintptr_t)(gTasks[taskId].func));
|
||||||
gTasks[taskId].func = Task_AbilityCapsule;
|
gTasks[taskId].func = Task_AbilityCapsule;
|
||||||
}
|
}
|
||||||
|
|
@ -5054,8 +5054,8 @@ void ItemUseCB_AbilityPatch(u8 taskId, TaskFunc task)
|
||||||
|
|
||||||
tState = 0;
|
tState = 0;
|
||||||
tMonId = gPartyMenu.slotId;
|
tMonId = gPartyMenu.slotId;
|
||||||
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES, NULL);
|
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES);
|
||||||
if (GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, NULL) == 2)
|
if (GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM) == 2)
|
||||||
tAbilityNum = 0;
|
tAbilityNum = 0;
|
||||||
else
|
else
|
||||||
tAbilityNum = 2;
|
tAbilityNum = 2;
|
||||||
|
|
@ -5793,7 +5793,7 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sFinalLevel = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
sFinalLevel = GetMonData(mon, MON_DATA_LEVEL);
|
||||||
gPartyMenuUseExitCallback = TRUE;
|
gPartyMenuUseExitCallback = TRUE;
|
||||||
UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon);
|
UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon);
|
||||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||||
|
|
@ -6258,7 +6258,7 @@ void DeleteMove(struct Pokemon *mon, enum Move move)
|
||||||
{
|
{
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
u32 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
|
u32 existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i);
|
||||||
if (existingMove == move)
|
if (existingMove == move)
|
||||||
{
|
{
|
||||||
SetMonMoveSlot(mon, MOVE_NONE, i);
|
SetMonMoveSlot(mon, MOVE_NONE, i);
|
||||||
|
|
@ -6278,7 +6278,7 @@ bool32 DoesMonHaveAnyMoves(struct Pokemon *mon)
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
enum Move existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
|
enum Move existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i);
|
||||||
if (existingMove != MOVE_NONE)
|
if (existingMove != MOVE_NONE)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -6321,7 +6321,7 @@ static void RestoreFusionMon(struct Pokemon *mon)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6703,7 +6703,7 @@ static void Task_TryItemUseFormChange(u8 taskId)
|
||||||
if (gTasks[taskId].tAnimWait == 0)
|
if (gTasks[taskId].tAnimWait == 0)
|
||||||
{
|
{
|
||||||
FreeAndDestroyMonIconSprite(icon);
|
FreeAndDestroyMonIconSprite(icon);
|
||||||
CreatePartyMonIconSpriteParameterized(targetSpecies, GetMonData(mon, MON_DATA_PERSONALITY, NULL), FALSE, &sPartyMenuBoxes[gPartyMenu.slotId], 1);
|
CreatePartyMonIconSpriteParameterized(targetSpecies, GetMonData(mon, MON_DATA_PERSONALITY), FALSE, &sPartyMenuBoxes[gPartyMenu.slotId], 1);
|
||||||
icon->oam.mosaic = TRUE;
|
icon->oam.mosaic = TRUE;
|
||||||
icon->data[0] = 10;
|
icon->data[0] = 10;
|
||||||
icon->data[1] = 1;
|
icon->data[1] = 1;
|
||||||
|
|
@ -6911,7 +6911,7 @@ void TryItemHoldFormChange(struct Pokemon *mon, s8 slotId)
|
||||||
PlayCry_NormalNoDucking(targetSpecies, 0, CRY_VOLUME_RS, CRY_VOLUME_RS);
|
PlayCry_NormalNoDucking(targetSpecies, 0, CRY_VOLUME_RS, CRY_VOLUME_RS);
|
||||||
SetMonData(mon, MON_DATA_SPECIES, &targetSpecies);
|
SetMonData(mon, MON_DATA_SPECIES, &targetSpecies);
|
||||||
FreeAndDestroyMonIconSprite(&gSprites[sPartyMenuBoxes[slotId].monSpriteId]);
|
FreeAndDestroyMonIconSprite(&gSprites[sPartyMenuBoxes[slotId].monSpriteId]);
|
||||||
CreatePartyMonIconSpriteParameterized(targetSpecies, GetMonData(mon, MON_DATA_PERSONALITY, NULL), FALSE, &sPartyMenuBoxes[slotId], 1);
|
CreatePartyMonIconSpriteParameterized(targetSpecies, GetMonData(mon, MON_DATA_PERSONALITY), FALSE, &sPartyMenuBoxes[slotId], 1);
|
||||||
CalculateMonStats(mon);
|
CalculateMonStats(mon);
|
||||||
UpdatePartyMonHeldItemSprite(mon, &sPartyMenuBoxes[slotId]);
|
UpdatePartyMonHeldItemSprite(mon, &sPartyMenuBoxes[slotId]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
282
src/pokemon.c
282
src/pokemon.c
|
|
@ -1401,8 +1401,8 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP
|
||||||
s32 i;
|
s32 i;
|
||||||
u16 heldItem;
|
u16 heldItem;
|
||||||
|
|
||||||
dest->species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
dest->species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL);
|
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||||
|
|
||||||
if (heldItem == ITEM_ENIGMA_BERRY_E_READER)
|
if (heldItem == ITEM_ENIGMA_BERRY_E_READER)
|
||||||
heldItem = ITEM_NONE;
|
heldItem = ITEM_NONE;
|
||||||
|
|
@ -1410,26 +1410,26 @@ void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerP
|
||||||
dest->heldItem = heldItem;
|
dest->heldItem = heldItem;
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
dest->moves[i] = GetMonData(mon, MON_DATA_MOVE1 + i, NULL);
|
dest->moves[i] = GetMonData(mon, MON_DATA_MOVE1 + i);
|
||||||
|
|
||||||
dest->level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
dest->level = GetMonData(mon, MON_DATA_LEVEL);
|
||||||
dest->ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
dest->ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
dest->otId = GetMonData(mon, MON_DATA_OT_ID, NULL);
|
dest->otId = GetMonData(mon, MON_DATA_OT_ID);
|
||||||
dest->hpEV = GetMonData(mon, MON_DATA_HP_EV, NULL);
|
dest->hpEV = GetMonData(mon, MON_DATA_HP_EV);
|
||||||
dest->attackEV = GetMonData(mon, MON_DATA_ATK_EV, NULL);
|
dest->attackEV = GetMonData(mon, MON_DATA_ATK_EV);
|
||||||
dest->defenseEV = GetMonData(mon, MON_DATA_DEF_EV, NULL);
|
dest->defenseEV = GetMonData(mon, MON_DATA_DEF_EV);
|
||||||
dest->speedEV = GetMonData(mon, MON_DATA_SPEED_EV, NULL);
|
dest->speedEV = GetMonData(mon, MON_DATA_SPEED_EV);
|
||||||
dest->spAttackEV = GetMonData(mon, MON_DATA_SPATK_EV, NULL);
|
dest->spAttackEV = GetMonData(mon, MON_DATA_SPATK_EV);
|
||||||
dest->spDefenseEV = GetMonData(mon, MON_DATA_SPDEF_EV, NULL);
|
dest->spDefenseEV = GetMonData(mon, MON_DATA_SPDEF_EV);
|
||||||
dest->friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
dest->friendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||||
dest->hpIV = GetMonData(mon, MON_DATA_HP_IV, NULL);
|
dest->hpIV = GetMonData(mon, MON_DATA_HP_IV);
|
||||||
dest->attackIV = GetMonData(mon, MON_DATA_ATK_IV, NULL);
|
dest->attackIV = GetMonData(mon, MON_DATA_ATK_IV);
|
||||||
dest->defenseIV = GetMonData(mon, MON_DATA_DEF_IV, NULL);
|
dest->defenseIV = GetMonData(mon, MON_DATA_DEF_IV);
|
||||||
dest->speedIV = GetMonData(mon, MON_DATA_SPEED_IV, NULL);
|
dest->speedIV = GetMonData(mon, MON_DATA_SPEED_IV);
|
||||||
dest->spAttackIV = GetMonData(mon, MON_DATA_SPATK_IV, NULL);
|
dest->spAttackIV = GetMonData(mon, MON_DATA_SPATK_IV);
|
||||||
dest->spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL);
|
dest->spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV);
|
||||||
dest->abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL);
|
dest->abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
|
||||||
dest->personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
dest->personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
GetMonData(mon, MON_DATA_NICKNAME10, dest->nickname);
|
GetMonData(mon, MON_DATA_NICKNAME10, dest->nickname);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1529,14 +1529,14 @@ static u16 CalculateBoxMonChecksumReencrypt(struct BoxPokemon *boxMon)
|
||||||
|
|
||||||
void CalculateMonStats(struct Pokemon *mon)
|
void CalculateMonStats(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
s32 oldMaxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL);
|
s32 oldMaxHP = GetMonData(mon, MON_DATA_MAX_HP);
|
||||||
s32 currentHP = GetMonData(mon, MON_DATA_HP, NULL);
|
s32 currentHP = GetMonData(mon, MON_DATA_HP);
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u8 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL);
|
u8 friendship = GetMonData(mon, MON_DATA_FRIENDSHIP);
|
||||||
s32 level = GetLevelFromMonExp(mon);
|
s32 level = GetLevelFromMonExp(mon);
|
||||||
s32 newMaxHP;
|
s32 newMaxHP;
|
||||||
|
|
||||||
u8 nature = GetMonData(mon, MON_DATA_HIDDEN_NATURE, NULL);
|
u8 nature = GetMonData(mon, MON_DATA_HIDDEN_NATURE);
|
||||||
|
|
||||||
SetMonData(mon, MON_DATA_LEVEL, &level);
|
SetMonData(mon, MON_DATA_LEVEL, &level);
|
||||||
|
|
||||||
|
|
@ -1610,7 +1610,7 @@ void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest)
|
||||||
{
|
{
|
||||||
u32 value = 0;
|
u32 value = 0;
|
||||||
dest->box = *src;
|
dest->box = *src;
|
||||||
dest->status = GetBoxMonData(&dest->box, MON_DATA_STATUS, NULL);
|
dest->status = GetBoxMonData(&dest->box, MON_DATA_STATUS);
|
||||||
dest->hp = 0;
|
dest->hp = 0;
|
||||||
dest->maxHP = 0;
|
dest->maxHP = 0;
|
||||||
value = MAIL_NONE;
|
value = MAIL_NONE;
|
||||||
|
|
@ -1623,8 +1623,8 @@ void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest)
|
||||||
|
|
||||||
u8 GetLevelFromMonExp(struct Pokemon *mon)
|
u8 GetLevelFromMonExp(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u32 exp = GetMonData(mon, MON_DATA_EXP, NULL);
|
u32 exp = GetMonData(mon, MON_DATA_EXP);
|
||||||
s32 level = 1;
|
s32 level = 1;
|
||||||
|
|
||||||
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
|
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
|
||||||
|
|
@ -1635,8 +1635,8 @@ u8 GetLevelFromMonExp(struct Pokemon *mon)
|
||||||
|
|
||||||
u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon)
|
u8 GetLevelFromBoxMonExp(struct BoxPokemon *boxMon)
|
||||||
{
|
{
|
||||||
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES);
|
||||||
u32 exp = GetBoxMonData(boxMon, MON_DATA_EXP, NULL);
|
u32 exp = GetBoxMonData(boxMon, MON_DATA_EXP);
|
||||||
s32 level = 1;
|
s32 level = 1;
|
||||||
|
|
||||||
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
|
while (level <= MAX_LEVEL && gExperienceTables[gSpeciesInfo[species].growthRate][level] <= exp)
|
||||||
|
|
@ -1655,7 +1655,7 @@ u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, enum Move move)
|
||||||
s32 i;
|
s32 i;
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
enum Move existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i, NULL);
|
enum Move existingMove = GetBoxMonData(boxMon, MON_DATA_MOVE1 + i);
|
||||||
if (existingMove == MOVE_NONE)
|
if (existingMove == MOVE_NONE)
|
||||||
{
|
{
|
||||||
u32 pp = GetMovePP(move);
|
u32 pp = GetMovePP(move);
|
||||||
|
|
@ -1695,8 +1695,8 @@ void SetMonMoveSlot(struct Pokemon *mon, enum Move move, u8 slot)
|
||||||
|
|
||||||
static void SetMonMoveSlot_KeepPP(struct Pokemon *mon, enum Move move, u8 slot)
|
static void SetMonMoveSlot_KeepPP(struct Pokemon *mon, enum Move move, u8 slot)
|
||||||
{
|
{
|
||||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
u8 currPP = GetMonData(mon, MON_DATA_PP1 + slot, NULL);
|
u8 currPP = GetMonData(mon, MON_DATA_PP1 + slot);
|
||||||
u8 newPP = CalculatePPWithBonus(move, ppBonuses, slot);
|
u8 newPP = CalculatePPWithBonus(move, ppBonuses, slot);
|
||||||
u16 finalPP = min(currPP, newPP);
|
u16 finalPP = min(currPP, newPP);
|
||||||
|
|
||||||
|
|
@ -1717,7 +1717,7 @@ void GiveMonInitialMoveset(struct Pokemon *mon)
|
||||||
|
|
||||||
void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) //Credit: AsparagusEduardo
|
void GiveBoxMonInitialMoveset(struct BoxPokemon *boxMon) //Credit: AsparagusEduardo
|
||||||
{
|
{
|
||||||
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES);
|
||||||
s32 level = GetLevelFromBoxMonExp(boxMon);
|
s32 level = GetLevelFromBoxMonExp(boxMon);
|
||||||
s32 i;
|
s32 i;
|
||||||
enum Move moves[MAX_MON_MOVES] = {MOVE_NONE};
|
enum Move moves[MAX_MON_MOVES] = {MOVE_NONE};
|
||||||
|
|
@ -1807,7 +1807,7 @@ void GiveBoxMonDefaultMove(struct BoxPokemon *boxMon, u32 slot)
|
||||||
enum Move MonTryLearningNewMoveAtLevel(struct Pokemon *mon, bool32 firstMove, u32 level)
|
enum Move MonTryLearningNewMoveAtLevel(struct Pokemon *mon, bool32 firstMove, u32 level)
|
||||||
{
|
{
|
||||||
enum Move retVal = MOVE_NONE;
|
enum Move retVal = MOVE_NONE;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(species);
|
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(species);
|
||||||
|
|
||||||
// since you can learn more than one move per level
|
// since you can learn more than one move per level
|
||||||
|
|
@ -1857,7 +1857,7 @@ enum Move MonTryLearningNewMoveAtLevel(struct Pokemon *mon, bool32 firstMove, u3
|
||||||
|
|
||||||
enum Move MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
enum Move MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove)
|
||||||
{
|
{
|
||||||
return MonTryLearningNewMoveAtLevel(mon, firstMove, GetMonData(mon, MON_DATA_LEVEL, NULL));
|
return MonTryLearningNewMoveAtLevel(mon, firstMove, GetMonData(mon, MON_DATA_LEVEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, enum Move move)
|
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, enum Move move)
|
||||||
|
|
@ -1869,11 +1869,11 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, enum Move move)
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
||||||
{
|
{
|
||||||
moves[i] = GetMonData(mon, MON_DATA_MOVE2 + i, NULL);
|
moves[i] = GetMonData(mon, MON_DATA_MOVE2 + i);
|
||||||
pp[i] = GetMonData(mon, MON_DATA_PP2 + i, NULL);
|
pp[i] = GetMonData(mon, MON_DATA_PP2 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
ppBonuses >>= 2;
|
ppBonuses >>= 2;
|
||||||
moves[MAX_MON_MOVES - 1] = move;
|
moves[MAX_MON_MOVES - 1] = move;
|
||||||
pp[MAX_MON_MOVES - 1] = GetMovePP(move);
|
pp[MAX_MON_MOVES - 1] = GetMovePP(move);
|
||||||
|
|
@ -1896,11 +1896,11 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, enum Move mov
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
for (i = 0; i < MAX_MON_MOVES - 1; i++)
|
||||||
{
|
{
|
||||||
moves[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i, NULL);
|
moves[i] = GetBoxMonData(boxMon, MON_DATA_MOVE2 + i);
|
||||||
pp[i] = GetBoxMonData(boxMon, MON_DATA_PP2 + i, NULL);
|
pp[i] = GetBoxMonData(boxMon, MON_DATA_PP2 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
ppBonuses = GetBoxMonData(boxMon, MON_DATA_PP_BONUSES, NULL);
|
ppBonuses = GetBoxMonData(boxMon, MON_DATA_PP_BONUSES);
|
||||||
ppBonuses >>= 2;
|
ppBonuses >>= 2;
|
||||||
moves[MAX_MON_MOVES - 1] = move;
|
moves[MAX_MON_MOVES - 1] = move;
|
||||||
pp[MAX_MON_MOVES - 1] = GetMovePP(move);
|
pp[MAX_MON_MOVES - 1] = GetMovePP(move);
|
||||||
|
|
@ -1980,8 +1980,8 @@ u8 GetMonGender(struct Pokemon *mon)
|
||||||
|
|
||||||
u8 GetBoxMonGender(struct BoxPokemon *boxMon)
|
u8 GetBoxMonGender(struct BoxPokemon *boxMon)
|
||||||
{
|
{
|
||||||
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
u16 species = GetBoxMonData(boxMon, MON_DATA_SPECIES);
|
||||||
u32 personality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetBoxMonData(boxMon, MON_DATA_PERSONALITY);
|
||||||
|
|
||||||
switch (gSpeciesInfo[species].genderRatio)
|
switch (gSpeciesInfo[species].genderRatio)
|
||||||
{
|
{
|
||||||
|
|
@ -3132,7 +3132,7 @@ u8 GiveCapturedMonToPlayer(struct Pokemon *mon)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3157,7 +3157,7 @@ u8 CopyMonToPC(struct Pokemon *mon)
|
||||||
for (boxPos = 0; boxPos < IN_BOX_COUNT; boxPos++)
|
for (boxPos = 0; boxPos < IN_BOX_COUNT; boxPos++)
|
||||||
{
|
{
|
||||||
struct BoxPokemon *checkingMon = GetBoxedMonPtr(boxNo, boxPos);
|
struct BoxPokemon *checkingMon = GetBoxedMonPtr(boxNo, boxPos);
|
||||||
if (GetBoxMonData(checkingMon, MON_DATA_SPECIES, NULL) == SPECIES_NONE)
|
if (GetBoxMonData(checkingMon, MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
{
|
{
|
||||||
MonRestorePP(mon);
|
MonRestorePP(mon);
|
||||||
CopyMon(checkingMon, &mon->box, sizeof(mon->box));
|
CopyMon(checkingMon, &mon->box, sizeof(mon->box));
|
||||||
|
|
@ -3183,7 +3183,7 @@ u8 CalculatePartyCount(struct Pokemon *party)
|
||||||
u32 partyCount = 0;
|
u32 partyCount = 0;
|
||||||
|
|
||||||
while (partyCount < PARTY_SIZE
|
while (partyCount < PARTY_SIZE
|
||||||
&& GetMonData(&party[partyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
&& GetMonData(&party[partyCount], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
partyCount++;
|
partyCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -3197,7 +3197,7 @@ u8 CalculatePartyCountOfSide(u32 battler, struct Pokemon *party)
|
||||||
GetAIPartyIndexes(battler, &partyCount, &partySize);
|
GetAIPartyIndexes(battler, &partyCount, &partySize);
|
||||||
|
|
||||||
while (partyCount < partySize
|
while (partyCount < partySize
|
||||||
&& GetMonData(&party[partyCount], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
&& GetMonData(&party[partyCount], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
partyCount++;
|
partyCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -3236,9 +3236,9 @@ u8 GetMonsStateToDoubles(void)
|
||||||
|
|
||||||
for (i = 0; i < gPlayerPartyCount; i++)
|
for (i = 0; i < gPlayerPartyCount; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) != SPECIES_EGG
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_EGG
|
||||||
&& GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0
|
&& GetMonData(&gPlayerParty[i], MON_DATA_HP) != 0
|
||||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL) != SPECIES_NONE)
|
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG) != SPECIES_NONE)
|
||||||
aliveCount++;
|
aliveCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3256,9 +3256,9 @@ u8 GetMonsStateToDoubles_2(void)
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u32 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG, NULL);
|
u32 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES_OR_EGG);
|
||||||
if (species != SPECIES_EGG && species != SPECIES_NONE
|
if (species != SPECIES_EGG && species != SPECIES_NONE
|
||||||
&& GetMonData(&gPlayerParty[i], MON_DATA_HP, NULL) != 0)
|
&& GetMonData(&gPlayerParty[i], MON_DATA_HP) != 0)
|
||||||
aliveCount++;
|
aliveCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3295,8 +3295,8 @@ enum Ability GetAbilityBySpecies(u16 species, u8 abilityNum)
|
||||||
|
|
||||||
enum Ability GetMonAbility(struct Pokemon *mon)
|
enum Ability GetMonAbility(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u8 abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL);
|
u8 abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
|
||||||
return GetAbilityBySpecies(species, abilityNum);
|
return GetAbilityBySpecies(species, abilityNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3349,7 +3349,7 @@ bool8 IsPlayerPartyAndPokemonStorageFull(void)
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return IsPokemonStorageFull();
|
return IsPokemonStorageFull();
|
||||||
|
|
@ -3517,7 +3517,7 @@ u8 CalculatePPWithBonus(enum Move move, u8 ppBonuses, u8 moveIndex)
|
||||||
|
|
||||||
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
|
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
|
||||||
{
|
{
|
||||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
ppBonuses &= gPPUpClearMask[moveIndex];
|
ppBonuses &= gPPUpClearMask[moveIndex];
|
||||||
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
|
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
|
||||||
}
|
}
|
||||||
|
|
@ -3534,33 +3534,33 @@ void PokemonToBattleMon(struct Pokemon *src, struct BattlePokemon *dst)
|
||||||
|
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
dst->moves[i] = GetMonData(src, MON_DATA_MOVE1 + i, NULL);
|
dst->moves[i] = GetMonData(src, MON_DATA_MOVE1 + i);
|
||||||
dst->pp[i] = GetMonData(src, MON_DATA_PP1 + i, NULL);
|
dst->pp[i] = GetMonData(src, MON_DATA_PP1 + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
dst->species = GetMonData(src, MON_DATA_SPECIES, NULL);
|
dst->species = GetMonData(src, MON_DATA_SPECIES);
|
||||||
dst->item = GetMonData(src, MON_DATA_HELD_ITEM, NULL);
|
dst->item = GetMonData(src, MON_DATA_HELD_ITEM);
|
||||||
dst->ppBonuses = GetMonData(src, MON_DATA_PP_BONUSES, NULL);
|
dst->ppBonuses = GetMonData(src, MON_DATA_PP_BONUSES);
|
||||||
dst->friendship = GetMonData(src, MON_DATA_FRIENDSHIP, NULL);
|
dst->friendship = GetMonData(src, MON_DATA_FRIENDSHIP);
|
||||||
dst->experience = GetMonData(src, MON_DATA_EXP, NULL);
|
dst->experience = GetMonData(src, MON_DATA_EXP);
|
||||||
dst->hpIV = GetMonData(src, MON_DATA_HP_IV, NULL);
|
dst->hpIV = GetMonData(src, MON_DATA_HP_IV);
|
||||||
dst->attackIV = GetMonData(src, MON_DATA_ATK_IV, NULL);
|
dst->attackIV = GetMonData(src, MON_DATA_ATK_IV);
|
||||||
dst->defenseIV = GetMonData(src, MON_DATA_DEF_IV, NULL);
|
dst->defenseIV = GetMonData(src, MON_DATA_DEF_IV);
|
||||||
dst->speedIV = GetMonData(src, MON_DATA_SPEED_IV, NULL);
|
dst->speedIV = GetMonData(src, MON_DATA_SPEED_IV);
|
||||||
dst->spAttackIV = GetMonData(src, MON_DATA_SPATK_IV, NULL);
|
dst->spAttackIV = GetMonData(src, MON_DATA_SPATK_IV);
|
||||||
dst->spDefenseIV = GetMonData(src, MON_DATA_SPDEF_IV, NULL);
|
dst->spDefenseIV = GetMonData(src, MON_DATA_SPDEF_IV);
|
||||||
dst->personality = GetMonData(src, MON_DATA_PERSONALITY, NULL);
|
dst->personality = GetMonData(src, MON_DATA_PERSONALITY);
|
||||||
dst->status1 = GetMonData(src, MON_DATA_STATUS, NULL);
|
dst->status1 = GetMonData(src, MON_DATA_STATUS);
|
||||||
dst->level = GetMonData(src, MON_DATA_LEVEL, NULL);
|
dst->level = GetMonData(src, MON_DATA_LEVEL);
|
||||||
dst->hp = GetMonData(src, MON_DATA_HP, NULL);
|
dst->hp = GetMonData(src, MON_DATA_HP);
|
||||||
dst->maxHP = GetMonData(src, MON_DATA_MAX_HP, NULL);
|
dst->maxHP = GetMonData(src, MON_DATA_MAX_HP);
|
||||||
dst->attack = GetMonData(src, MON_DATA_ATK, NULL);
|
dst->attack = GetMonData(src, MON_DATA_ATK);
|
||||||
dst->defense = GetMonData(src, MON_DATA_DEF, NULL);
|
dst->defense = GetMonData(src, MON_DATA_DEF);
|
||||||
dst->speed = GetMonData(src, MON_DATA_SPEED, NULL);
|
dst->speed = GetMonData(src, MON_DATA_SPEED);
|
||||||
dst->spAttack = GetMonData(src, MON_DATA_SPATK, NULL);
|
dst->spAttack = GetMonData(src, MON_DATA_SPATK);
|
||||||
dst->spDefense = GetMonData(src, MON_DATA_SPDEF, NULL);
|
dst->spDefense = GetMonData(src, MON_DATA_SPDEF);
|
||||||
dst->abilityNum = GetMonData(src, MON_DATA_ABILITY_NUM, NULL);
|
dst->abilityNum = GetMonData(src, MON_DATA_ABILITY_NUM);
|
||||||
dst->otId = GetMonData(src, MON_DATA_OT_ID, NULL);
|
dst->otId = GetMonData(src, MON_DATA_OT_ID);
|
||||||
dst->types[0] = GetSpeciesType(dst->species, 0);
|
dst->types[0] = GetSpeciesType(dst->species, 0);
|
||||||
dst->types[1] = GetSpeciesType(dst->species, 1);
|
dst->types[1] = GetSpeciesType(dst->species, 1);
|
||||||
dst->types[2] = TYPE_MYSTERY;
|
dst->types[2] = TYPE_MYSTERY;
|
||||||
|
|
@ -3596,7 +3596,7 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
|
||||||
if ((retVal == 0 || friendshipOnly) && !ShouldSkipFriendshipChange() && friendshipChange == 0) \
|
if ((retVal == 0 || friendshipOnly) && !ShouldSkipFriendshipChange() && friendshipChange == 0) \
|
||||||
{ \
|
{ \
|
||||||
friendshipChange = itemEffect[itemEffectParam]; \
|
friendshipChange = itemEffect[itemEffectParam]; \
|
||||||
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP, NULL); \
|
friendship = GetMonData(mon, MON_DATA_FRIENDSHIP); \
|
||||||
friendship += CalculateFriendshipBonuses(mon,friendshipChange,holdEffect); \
|
friendship += CalculateFriendshipBonuses(mon,friendshipChange,holdEffect); \
|
||||||
if (friendship < 0) \
|
if (friendship < 0) \
|
||||||
friendship = 0; \
|
friendship = 0; \
|
||||||
|
|
@ -3640,7 +3640,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
u32 maxAllowedEVs = !B_EV_ITEMS_CAP ? MAX_TOTAL_EVS : GetCurrentEVCap();
|
u32 maxAllowedEVs = !B_EV_ITEMS_CAP ? MAX_TOTAL_EVS : GetCurrentEVCap();
|
||||||
|
|
||||||
// Get item hold effect
|
// Get item hold effect
|
||||||
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM, NULL);
|
heldItem = GetMonData(mon, MON_DATA_HELD_ITEM);
|
||||||
if (heldItem == ITEM_ENIGMA_BERRY_E_READER)
|
if (heldItem == ITEM_ENIGMA_BERRY_E_READER)
|
||||||
#if FREE_ENIGMA_BERRY == FALSE
|
#if FREE_ENIGMA_BERRY == FALSE
|
||||||
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
holdEffect = gSaveBlock1Ptr->enigmaBerry.holdEffect;
|
||||||
|
|
@ -3680,19 +3680,19 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
case 3:
|
case 3:
|
||||||
// Rare Candy / EXP Candy
|
// Rare Candy / EXP Candy
|
||||||
if ((itemEffect[i] & ITEM3_LEVEL_UP)
|
if ((itemEffect[i] & ITEM3_LEVEL_UP)
|
||||||
&& GetMonData(mon, MON_DATA_LEVEL, NULL) != MAX_LEVEL)
|
&& GetMonData(mon, MON_DATA_LEVEL) != MAX_LEVEL)
|
||||||
{
|
{
|
||||||
u8 param = GetItemHoldEffectParam(item);
|
u8 param = GetItemHoldEffectParam(item);
|
||||||
dataUnsigned = 0;
|
dataUnsigned = 0;
|
||||||
|
|
||||||
if (param == 0) // Rare Candy
|
if (param == 0) // Rare Candy
|
||||||
{
|
{
|
||||||
dataUnsigned = gExperienceTables[gSpeciesInfo[GetMonData(mon, MON_DATA_SPECIES, NULL)].growthRate][GetMonData(mon, MON_DATA_LEVEL, NULL) + 1];
|
dataUnsigned = gExperienceTables[gSpeciesInfo[GetMonData(mon, MON_DATA_SPECIES)].growthRate][GetMonData(mon, MON_DATA_LEVEL) + 1];
|
||||||
}
|
}
|
||||||
else if (param - 1 < ARRAY_COUNT(sExpCandyExperienceTable)) // EXP Candies
|
else if (param - 1 < ARRAY_COUNT(sExpCandyExperienceTable)) // EXP Candies
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
dataUnsigned = sExpCandyExperienceTable[param - 1] + GetMonData(mon, MON_DATA_EXP, NULL);
|
dataUnsigned = sExpCandyExperienceTable[param - 1] + GetMonData(mon, MON_DATA_EXP);
|
||||||
|
|
||||||
if (B_RARE_CANDY_CAP && B_EXP_CAP_TYPE == EXP_CAP_HARD)
|
if (B_RARE_CANDY_CAP && B_EXP_CAP_TYPE == EXP_CAP_HARD)
|
||||||
{
|
{
|
||||||
|
|
@ -3734,17 +3734,17 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
// PP Up
|
// PP Up
|
||||||
if (effectFlags & ITEM4_PP_UP)
|
if (effectFlags & ITEM4_PP_UP)
|
||||||
{
|
{
|
||||||
u32 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
u32 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
effectFlags &= ~ITEM4_PP_UP;
|
effectFlags &= ~ITEM4_PP_UP;
|
||||||
dataUnsigned = (ppBonuses & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
dataUnsigned = (ppBonuses & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
||||||
temp1 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), ppBonuses, moveIndex);
|
temp1 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex), ppBonuses, moveIndex);
|
||||||
if (dataUnsigned <= 2 && temp1 > 4)
|
if (dataUnsigned <= 2 && temp1 > 4)
|
||||||
{
|
{
|
||||||
dataUnsigned = ppBonuses + gPPUpAddValues[moveIndex];
|
dataUnsigned = ppBonuses + gPPUpAddValues[moveIndex];
|
||||||
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
||||||
|
|
||||||
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp1;
|
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex), dataUnsigned, moveIndex) - temp1;
|
||||||
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + dataUnsigned;
|
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex) + dataUnsigned;
|
||||||
SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned);
|
SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned);
|
||||||
retVal = FALSE;
|
retVal = FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -3762,7 +3762,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
case 1: // ITEM4_EV_ATK
|
case 1: // ITEM4_EV_ATK
|
||||||
evCount = GetMonEVCount(mon);
|
evCount = GetMonEVCount(mon);
|
||||||
temp2 = itemEffect[itemEffectParam];
|
temp2 = itemEffect[itemEffectParam];
|
||||||
dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1], NULL);
|
dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1]);
|
||||||
evChange = temp2;
|
evChange = temp2;
|
||||||
|
|
||||||
if (evChange > 0) // Increasing EV (HP or Atk)
|
if (evChange > 0) // Increasing EV (HP or Atk)
|
||||||
|
|
@ -3826,8 +3826,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
|
|
||||||
case 2: // ITEM4_HEAL_HP
|
case 2: // ITEM4_HEAL_HP
|
||||||
{
|
{
|
||||||
u32 currentHP = GetMonData(mon, MON_DATA_HP, NULL);
|
u32 currentHP = GetMonData(mon, MON_DATA_HP);
|
||||||
u32 maxHP = GetMonData(mon, MON_DATA_MAX_HP, NULL);
|
u32 maxHP = GetMonData(mon, MON_DATA_MAX_HP);
|
||||||
// Check use validity.
|
// Check use validity.
|
||||||
if ((effectFlags & (ITEM4_REVIVE >> 2) && currentHP != 0)
|
if ((effectFlags & (ITEM4_REVIVE >> 2) && currentHP != 0)
|
||||||
|| (!(effectFlags & (ITEM4_REVIVE >> 2)) && currentHP == 0))
|
|| (!(effectFlags & (ITEM4_REVIVE >> 2)) && currentHP == 0))
|
||||||
|
|
@ -3879,9 +3879,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
{
|
{
|
||||||
enum Move move;
|
enum Move move;
|
||||||
u32 ppBonus;
|
u32 ppBonus;
|
||||||
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + temp2, NULL);
|
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + temp2);
|
||||||
move = GetMonData(mon, MON_DATA_MOVE1 + temp2, NULL);
|
move = GetMonData(mon, MON_DATA_MOVE1 + temp2);
|
||||||
ppBonus = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), temp2);
|
ppBonus = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES), temp2);
|
||||||
if (dataUnsigned != ppBonus)
|
if (dataUnsigned != ppBonus)
|
||||||
{
|
{
|
||||||
dataUnsigned += itemEffect[itemEffectParam];
|
dataUnsigned += itemEffect[itemEffectParam];
|
||||||
|
|
@ -3897,9 +3897,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
{
|
{
|
||||||
// Heal PP for one move
|
// Heal PP for one move
|
||||||
enum Move move;
|
enum Move move;
|
||||||
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL);
|
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex);
|
||||||
move = GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL);
|
move = GetMonData(mon, MON_DATA_MOVE1 + moveIndex);
|
||||||
u32 ppBonus = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
|
u32 ppBonus = CalculatePPWithBonus(move, GetMonData(mon, MON_DATA_PP_BONUSES), moveIndex);
|
||||||
if (dataUnsigned != ppBonus)
|
if (dataUnsigned != ppBonus)
|
||||||
{
|
{
|
||||||
dataUnsigned += itemEffect[itemEffectParam++];
|
dataUnsigned += itemEffect[itemEffectParam++];
|
||||||
|
|
@ -3952,7 +3952,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
case 3: // ITEM5_EV_SPATK
|
case 3: // ITEM5_EV_SPATK
|
||||||
evCount = GetMonEVCount(mon);
|
evCount = GetMonEVCount(mon);
|
||||||
temp2 = itemEffect[itemEffectParam];
|
temp2 = itemEffect[itemEffectParam];
|
||||||
dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1 + 2], NULL);
|
dataSigned = GetMonData(mon, sGetMonDataEVConstants[temp1 + 2]);
|
||||||
evChange = temp2;
|
evChange = temp2;
|
||||||
if (evChange > 0) // Increasing EV
|
if (evChange > 0) // Increasing EV
|
||||||
{
|
{
|
||||||
|
|
@ -4015,9 +4015,9 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
|
|
||||||
case 4: // ITEM5_PP_MAX
|
case 4: // ITEM5_PP_MAX
|
||||||
{
|
{
|
||||||
u32 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
u32 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES);
|
||||||
dataUnsigned = (ppBonuses & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
dataUnsigned = (ppBonuses & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
||||||
temp2 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), ppBonuses, moveIndex);
|
temp2 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex), ppBonuses, moveIndex);
|
||||||
|
|
||||||
// Check if 3 PP Ups have been applied already, and that the move has a total PP of at least 5 (excludes Sketch)
|
// Check if 3 PP Ups have been applied already, and that the move has a total PP of at least 5 (excludes Sketch)
|
||||||
if (dataUnsigned < 3 && temp2 >= 5)
|
if (dataUnsigned < 3 && temp2 >= 5)
|
||||||
|
|
@ -4027,8 +4027,8 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
dataUnsigned += gPPUpAddValues[moveIndex] * 3; // Apply 3 PP Ups (max)
|
dataUnsigned += gPPUpAddValues[moveIndex] * 3; // Apply 3 PP Ups (max)
|
||||||
|
|
||||||
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
||||||
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp2;
|
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex), dataUnsigned, moveIndex) - temp2;
|
||||||
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex, NULL) + dataUnsigned;
|
dataUnsigned = GetMonData(mon, MON_DATA_PP1 + moveIndex) + dataUnsigned;
|
||||||
SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned);
|
SetMonData(mon, MON_DATA_PP1 + moveIndex, &dataUnsigned);
|
||||||
retVal = FALSE;
|
retVal = FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -4039,19 +4039,19 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||||
// how much friendship the Pokémon already has.
|
// how much friendship the Pokémon already has.
|
||||||
// In general, Pokémon with lower friendship receive more,
|
// In general, Pokémon with lower friendship receive more,
|
||||||
// and Pokémon with higher friendship receive less.
|
// and Pokémon with higher friendship receive less.
|
||||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100)
|
if (GetMonData(mon, MON_DATA_FRIENDSHIP) < 100)
|
||||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||||
itemEffectParam++;
|
itemEffectParam++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6: // ITEM5_FRIENDSHIP_MID
|
case 6: // ITEM5_FRIENDSHIP_MID
|
||||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200)
|
if (GetMonData(mon, MON_DATA_FRIENDSHIP) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP) < 200)
|
||||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||||
itemEffectParam++;
|
itemEffectParam++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7: // ITEM5_FRIENDSHIP_HIGH
|
case 7: // ITEM5_FRIENDSHIP_HIGH
|
||||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200)
|
if (GetMonData(mon, MON_DATA_FRIENDSHIP) >= 200)
|
||||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||||
itemEffectParam++;
|
itemEffectParam++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -4451,7 +4451,7 @@ bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct Evoluti
|
||||||
case IF_SPECIES_IN_PARTY:
|
case IF_SPECIES_IN_PARTY:
|
||||||
for (j = 0; j < PARTY_SIZE; j++)
|
for (j = 0; j < PARTY_SIZE; j++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL) == params[i].arg1)
|
if (GetMonData(&gPlayerParty[j], MON_DATA_SPECIES) == params[i].arg1)
|
||||||
{
|
{
|
||||||
currentCondition = TRUE;
|
currentCondition = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -4479,7 +4479,7 @@ bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct Evoluti
|
||||||
case IF_TYPE_IN_PARTY:
|
case IF_TYPE_IN_PARTY:
|
||||||
for (j = 0; j < PARTY_SIZE; j++)
|
for (j = 0; j < PARTY_SIZE; j++)
|
||||||
{
|
{
|
||||||
u16 currSpecies = GetMonData(&gPlayerParty[j], MON_DATA_SPECIES, NULL);
|
u16 currSpecies = GetMonData(&gPlayerParty[j], MON_DATA_SPECIES);
|
||||||
if (GetSpeciesType(currSpecies, 0) == params[i].arg1
|
if (GetSpeciesType(currSpecies, 0) == params[i].arg1
|
||||||
|| GetSpeciesType(currSpecies, 1) == params[i].arg1)
|
|| GetSpeciesType(currSpecies, 1) == params[i].arg1)
|
||||||
{
|
{
|
||||||
|
|
@ -4507,7 +4507,7 @@ bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct Evoluti
|
||||||
case IF_KNOWS_MOVE_TYPE:
|
case IF_KNOWS_MOVE_TYPE:
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
{
|
{
|
||||||
if (GetMoveType(GetMonData(mon, MON_DATA_MOVE1 + j, NULL)) == params[i].arg1)
|
if (GetMoveType(GetMonData(mon, MON_DATA_MOVE1 + j)) == params[i].arg1)
|
||||||
{
|
{
|
||||||
currentCondition = TRUE;
|
currentCondition = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
@ -4564,8 +4564,8 @@ bool32 DoesMonMeetAdditionalConditions(struct Pokemon *mon, const struct Evoluti
|
||||||
break;
|
break;
|
||||||
case IF_CURRENT_DAMAGE_GE:
|
case IF_CURRENT_DAMAGE_GE:
|
||||||
{
|
{
|
||||||
u32 currentHp = GetMonData(mon, MON_DATA_HP, NULL);
|
u32 currentHp = GetMonData(mon, MON_DATA_HP);
|
||||||
if (currentHp != 0 && (GetMonData(mon, MON_DATA_MAX_HP, NULL) - currentHp >= params[i].arg1))
|
if (currentHp != 0 && (GetMonData(mon, MON_DATA_MAX_HP) - currentHp >= params[i].arg1))
|
||||||
currentCondition = TRUE;
|
currentCondition = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -4826,7 +4826,7 @@ u32 GetEvolutionTargetSpecies(struct Pokemon *mon, enum EvolutionMode mode, u16
|
||||||
// Pikachu, Meowth, Eevee and Duraludon cannot evolve if they have the
|
// Pikachu, Meowth, Eevee and Duraludon cannot evolve if they have the
|
||||||
// Gigantamax Factor. We assume that is because their evolutions
|
// Gigantamax Factor. We assume that is because their evolutions
|
||||||
// do not have a Gigantamax Form.
|
// do not have a Gigantamax Form.
|
||||||
if (GetMonData(mon, MON_DATA_GIGANTAMAX_FACTOR, NULL)
|
if (GetMonData(mon, MON_DATA_GIGANTAMAX_FACTOR)
|
||||||
&& GetGMaxTargetSpecies(species) != species
|
&& GetGMaxTargetSpecies(species) != species
|
||||||
&& GetGMaxTargetSpecies(targetSpecies) == targetSpecies)
|
&& GetGMaxTargetSpecies(targetSpecies) == targetSpecies)
|
||||||
{
|
{
|
||||||
|
|
@ -5183,10 +5183,10 @@ u8 CalculateFriendshipBonuses(struct Pokemon *mon, u32 modifier, enum HoldEffect
|
||||||
if (modifier == 0)
|
if (modifier == 0)
|
||||||
return bonus;
|
return bonus;
|
||||||
|
|
||||||
if (GetMonData(mon, MON_DATA_POKEBALL, NULL) == ITEM_LUXURY_BALL)
|
if (GetMonData(mon, MON_DATA_POKEBALL) == ITEM_LUXURY_BALL)
|
||||||
bonus += ITEM_FRIENDSHIP_LUXURY_BONUS;
|
bonus += ITEM_FRIENDSHIP_LUXURY_BONUS;
|
||||||
|
|
||||||
if (GetMonData(mon, MON_DATA_MET_LOCATION, NULL) == GetCurrentRegionMapSectionId())
|
if (GetMonData(mon, MON_DATA_MET_LOCATION) == GetCurrentRegionMapSectionId())
|
||||||
bonus += ITEM_FRIENDSHIP_MAPSEC_BONUS;
|
bonus += ITEM_FRIENDSHIP_MAPSEC_BONUS;
|
||||||
|
|
||||||
return bonus;
|
return bonus;
|
||||||
|
|
@ -5867,7 +5867,7 @@ u16 GetBattleBGM(void)
|
||||||
{
|
{
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
|
if (gBattleTypeFlags & BATTLE_TYPE_LEGENDARY)
|
||||||
{
|
{
|
||||||
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, NULL))
|
switch (GetMonData(&gEnemyParty[0], MON_DATA_SPECIES))
|
||||||
{
|
{
|
||||||
case SPECIES_RAYQUAZA:
|
case SPECIES_RAYQUAZA:
|
||||||
return MUS_VS_RAYQUAZA;
|
return MUS_VS_RAYQUAZA;
|
||||||
|
|
@ -5984,10 +5984,10 @@ static void Task_PlayMapChosenOrBattleBGM(u8 taskId)
|
||||||
|
|
||||||
const u16 *GetMonFrontSpritePal(struct Pokemon *mon)
|
const u16 *GetMonFrontSpritePal(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
bool32 isShiny = GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
bool32 isShiny = GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
bool32 isEgg = GetMonData(mon, MON_DATA_IS_EGG, NULL);
|
bool32 isEgg = GetMonData(mon, MON_DATA_IS_EGG);
|
||||||
return GetMonSpritePalFromSpeciesAndPersonalityIsEgg(species, isShiny, personality, isEgg);
|
return GetMonSpritePalFromSpeciesAndPersonalityIsEgg(species, isShiny, personality, isEgg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -6177,7 +6177,7 @@ void SetWildMonHeldItem(void)
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, NULL) != ITEM_NONE)
|
if (GetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM) != ITEM_NONE)
|
||||||
continue; // prevent overwriting previously set item
|
continue; // prevent overwriting previously set item
|
||||||
|
|
||||||
rnd = Random() % 100;
|
rnd = Random() % 100;
|
||||||
|
|
@ -6226,7 +6226,7 @@ void SetWildMonHeldItem(void)
|
||||||
|
|
||||||
bool8 IsMonShiny(struct Pokemon *mon)
|
bool8 IsMonShiny(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
return GetMonData(mon, MON_DATA_IS_SHINY, NULL);
|
return GetMonData(mon, MON_DATA_IS_SHINY);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8 *GetTrainerPartnerName(void)
|
const u8 *GetTrainerPartnerName(void)
|
||||||
|
|
@ -6687,7 +6687,7 @@ u32 GetFormChangeTargetSpecies(struct Pokemon *mon, enum FormChanges method, u32
|
||||||
u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges method, u32 arg)
|
u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges method, u32 arg)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u32 species = GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL);
|
u32 species = GetBoxMonData(boxMon, MON_DATA_SPECIES);
|
||||||
u32 targetSpecies = species;
|
u32 targetSpecies = species;
|
||||||
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
||||||
u16 heldItem;
|
u16 heldItem;
|
||||||
|
|
@ -6695,8 +6695,8 @@ u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges
|
||||||
|
|
||||||
if (formChanges != NULL)
|
if (formChanges != NULL)
|
||||||
{
|
{
|
||||||
heldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM, NULL);
|
heldItem = GetBoxMonData(boxMon, MON_DATA_HELD_ITEM);
|
||||||
ability = GetAbilityBySpecies(species, GetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, NULL));
|
ability = GetAbilityBySpecies(species, GetBoxMonData(boxMon, MON_DATA_ABILITY_NUM));
|
||||||
|
|
||||||
for (i = 0; formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
|
for (i = 0; formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
|
||||||
{
|
{
|
||||||
|
|
@ -6741,7 +6741,7 @@ u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (formChanges[i].param3 != STATUS1_NONE && GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param3)
|
if (formChanges[i].param3 != STATUS1_NONE && GetBoxMonData(boxMon, MON_DATA_STATUS) & formChanges[i].param3)
|
||||||
pass = FALSE;
|
pass = FALSE;
|
||||||
|
|
||||||
if (pass)
|
if (pass)
|
||||||
|
|
@ -6775,7 +6775,7 @@ u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges
|
||||||
targetSpecies = formChanges[i].targetSpecies;
|
targetSpecies = formChanges[i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
case FORM_CHANGE_STATUS:
|
case FORM_CHANGE_STATUS:
|
||||||
if (GetBoxMonData(boxMon, MON_DATA_STATUS, NULL) & formChanges[i].param1)
|
if (GetBoxMonData(boxMon, MON_DATA_STATUS) & formChanges[i].param1)
|
||||||
targetSpecies = formChanges[i].targetSpecies;
|
targetSpecies = formChanges[i].targetSpecies;
|
||||||
break;
|
break;
|
||||||
case FORM_CHANGE_TIME_OF_DAY:
|
case FORM_CHANGE_TIME_OF_DAY:
|
||||||
|
|
@ -6804,7 +6804,7 @@ u32 GetFormChangeTargetSpeciesBoxMon(struct BoxPokemon *boxMon, enum FormChanges
|
||||||
void TrySetDayLimitToFormChange(struct Pokemon *mon)
|
void TrySetDayLimitToFormChange(struct Pokemon *mon)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
||||||
|
|
||||||
for (i = 0; formChanges != NULL && formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
|
for (i = 0; formChanges != NULL && formChanges[i].method != FORM_CHANGE_TERMINATOR; i++)
|
||||||
|
|
@ -6833,8 +6833,8 @@ bool32 DoesSpeciesHaveFormChangeMethod(u16 species, enum FormChanges method)
|
||||||
|
|
||||||
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove)
|
u16 MonTryLearningNewMoveEvolution(struct Pokemon *mon, bool8 firstMove)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u8 level = GetMonData(mon, MON_DATA_LEVEL, NULL);
|
u8 level = GetMonData(mon, MON_DATA_LEVEL);
|
||||||
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(species);
|
const struct LevelUpMove *learnset = GetSpeciesLevelUpLearnset(species);
|
||||||
|
|
||||||
// Since you can learn more than one move per level,
|
// Since you can learn more than one move per level,
|
||||||
|
|
@ -7010,7 +7010,7 @@ bool32 IsSpeciesEnabled(u16 species)
|
||||||
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, enum FormChanges method)
|
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, enum FormChanges method)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
const struct FormChange *formChanges = GetSpeciesFormChanges(species);
|
||||||
|
|
||||||
if (formChanges == NULL
|
if (formChanges == NULL
|
||||||
|
|
@ -7029,7 +7029,7 @@ void TryToSetBattleFormChangeMoves(struct Pokemon *mon, enum FormChanges method)
|
||||||
|
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
{
|
{
|
||||||
u16 currMove = GetMonData(mon, MON_DATA_MOVE1 + j, NULL);
|
u16 currMove = GetMonData(mon, MON_DATA_MOVE1 + j);
|
||||||
if (currMove == originalMove)
|
if (currMove == originalMove)
|
||||||
SetMonMoveSlot_KeepPP(mon, newMove, j);
|
SetMonMoveSlot_KeepPP(mon, newMove, j);
|
||||||
}
|
}
|
||||||
|
|
@ -7040,7 +7040,7 @@ void TryToSetBattleFormChangeMoves(struct Pokemon *mon, enum FormChanges method)
|
||||||
|
|
||||||
u32 GetMonFriendshipScore(struct Pokemon *pokemon)
|
u32 GetMonFriendshipScore(struct Pokemon *pokemon)
|
||||||
{
|
{
|
||||||
u32 friendshipScore = GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL);
|
u32 friendshipScore = GetMonData(pokemon, MON_DATA_FRIENDSHIP);
|
||||||
|
|
||||||
if (friendshipScore == MAX_FRIENDSHIP)
|
if (friendshipScore == MAX_FRIENDSHIP)
|
||||||
return FRIENDSHIP_MAX;
|
return FRIENDSHIP_MAX;
|
||||||
|
|
@ -7060,7 +7060,7 @@ u32 GetMonFriendshipScore(struct Pokemon *pokemon)
|
||||||
|
|
||||||
u32 GetMonAffectionHearts(struct Pokemon *pokemon)
|
u32 GetMonAffectionHearts(struct Pokemon *pokemon)
|
||||||
{
|
{
|
||||||
u32 friendship = GetMonData(pokemon, MON_DATA_FRIENDSHIP, NULL);
|
u32 friendship = GetMonData(pokemon, MON_DATA_FRIENDSHIP);
|
||||||
|
|
||||||
if (friendship == MAX_FRIENDSHIP)
|
if (friendship == MAX_FRIENDSHIP)
|
||||||
return AFFECTION_FIVE_HEARTS;
|
return AFFECTION_FIVE_HEARTS;
|
||||||
|
|
@ -7084,9 +7084,9 @@ void UpdateMonPersonality(struct BoxPokemon *boxMon, u32 personality)
|
||||||
struct PokemonSubstruct3 *old3, *new3;
|
struct PokemonSubstruct3 *old3, *new3;
|
||||||
struct BoxPokemon old;
|
struct BoxPokemon old;
|
||||||
|
|
||||||
bool32 isShiny = GetBoxMonData(boxMon, MON_DATA_IS_SHINY, NULL);
|
bool32 isShiny = GetBoxMonData(boxMon, MON_DATA_IS_SHINY);
|
||||||
u32 hiddenNature = GetBoxMonData(boxMon, MON_DATA_HIDDEN_NATURE, NULL);
|
u32 hiddenNature = GetBoxMonData(boxMon, MON_DATA_HIDDEN_NATURE);
|
||||||
enum Type teraType = GetBoxMonData(boxMon, MON_DATA_TERA_TYPE, NULL);
|
enum Type teraType = GetBoxMonData(boxMon, MON_DATA_TERA_TYPE);
|
||||||
|
|
||||||
old = *boxMon;
|
old = *boxMon;
|
||||||
old0 = &(GetSubstruct(&old, old.personality, SUBSTRUCT_TYPE_0)->type0);
|
old0 = &(GetSubstruct(&old, old.personality, SUBSTRUCT_TYPE_0)->type0);
|
||||||
|
|
@ -7329,7 +7329,7 @@ u32 GiveScriptedMonToPlayer(struct Pokemon *mon, u8 slot)
|
||||||
{
|
{
|
||||||
for (i = 0; i < PARTY_SIZE; i++)
|
for (i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL) == SPECIES_NONE)
|
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES) == SPECIES_NONE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i >= PARTY_SIZE)
|
if (i >= PARTY_SIZE)
|
||||||
|
|
|
||||||
|
|
@ -6939,7 +6939,7 @@ static void ReshowDisplayMon(void)
|
||||||
void SetMonFormPSS(struct BoxPokemon *boxMon, enum FormChanges method)
|
void SetMonFormPSS(struct BoxPokemon *boxMon, enum FormChanges method)
|
||||||
{
|
{
|
||||||
u16 targetSpecies = GetFormChangeTargetSpeciesBoxMon(boxMon, method, 0);
|
u16 targetSpecies = GetFormChangeTargetSpeciesBoxMon(boxMon, method, 0);
|
||||||
if (targetSpecies != GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL))
|
if (targetSpecies != GetBoxMonData(boxMon, MON_DATA_SPECIES))
|
||||||
{
|
{
|
||||||
SetBoxMonData(boxMon, MON_DATA_SPECIES, &targetSpecies);
|
SetBoxMonData(boxMon, MON_DATA_SPECIES, &targetSpecies);
|
||||||
sRefreshDisplayMonGfx = TRUE;
|
sRefreshDisplayMonGfx = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -4980,7 +4980,7 @@ static void CB2_PssChangePokemonNickname(void)
|
||||||
{
|
{
|
||||||
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
|
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
|
||||||
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
|
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
|
||||||
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL),
|
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES),
|
||||||
GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL),
|
GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY),
|
||||||
CB2_ReturnToSummaryScreenFromNamingScreen);
|
CB2_ReturnToSummaryScreenFromNamingScreen);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -757,12 +757,12 @@ void RecordedBattle_CheckMovesetChanges(u8 mode)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = GetBattlerMon(battler);
|
struct Pokemon *mon = GetBattlerMon(battler);
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
ppBonuses[j] = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & ((3 << (j << 1)))) >> (j << 1);
|
ppBonuses[j] = (GetMonData(mon, MON_DATA_PP_BONUSES) & ((3 << (j << 1)))) >> (j << 1);
|
||||||
|
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
{
|
{
|
||||||
movePp.moves[j] = GetMonData(mon, MON_DATA_MOVE1 + moveSlots[j], NULL);
|
movePp.moves[j] = GetMonData(mon, MON_DATA_MOVE1 + moveSlots[j]);
|
||||||
movePp.currentPp[j] = GetMonData(mon, MON_DATA_PP1 + moveSlots[j], NULL);
|
movePp.currentPp[j] = GetMonData(mon, MON_DATA_PP1 + moveSlots[j]);
|
||||||
movePp.maxPp[j] = ppBonuses[moveSlots[j]];
|
movePp.maxPp[j] = ppBonuses[moveSlots[j]];
|
||||||
}
|
}
|
||||||
for (j = 0; j < MAX_MON_MOVES; j++)
|
for (j = 0; j < MAX_MON_MOVES; j++)
|
||||||
|
|
|
||||||
|
|
@ -2129,7 +2129,7 @@ bool8 ScrCmd_bufferleadmonspeciesname(struct ScriptContext *ctx)
|
||||||
|
|
||||||
u8 *dest = sScriptStringVars[stringVarIndex];
|
u8 *dest = sScriptStringVars[stringVarIndex];
|
||||||
u8 partyIndex = GetLeadMonIndex();
|
u8 partyIndex = GetLeadMonIndex();
|
||||||
u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES, NULL);
|
u32 species = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPECIES);
|
||||||
StringCopy(dest, GetSpeciesName(species));
|
StringCopy(dest, GetSpeciesName(species));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -2317,7 +2317,7 @@ bool8 ScrCmd_checkfieldmove(struct ScriptContext *ctx)
|
||||||
move = FieldMove_GetMoveId(fieldMove);
|
move = FieldMove_GetMoveId(fieldMove);
|
||||||
for (u32 i = 0; i < PARTY_SIZE; i++)
|
for (u32 i = 0; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES);
|
||||||
if (!species)
|
if (!species)
|
||||||
break;
|
break;
|
||||||
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], move) == TRUE)
|
if (!GetMonData(&gPlayerParty[i], MON_DATA_IS_EGG) && MonKnowsMove(&gPlayerParty[i], move) == TRUE)
|
||||||
|
|
@ -2963,7 +2963,7 @@ bool8 ScrCmd_checkmodernfatefulencounter(struct ScriptContext *ctx)
|
||||||
|
|
||||||
Script_RequestEffects(SCREFF_V1);
|
Script_RequestEffects(SCREFF_V1);
|
||||||
|
|
||||||
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MODERN_FATEFUL_ENCOUNTER, NULL);
|
gSpecialVar_Result = GetMonData(&gPlayerParty[partyIndex], MON_DATA_MODERN_FATEFUL_ENCOUNTER);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
18
src/trade.c
18
src/trade.c
|
|
@ -575,7 +575,7 @@ static void CB2_CreateTradeMenu(void)
|
||||||
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PARTNER]; i++)
|
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PARTNER]; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gEnemyParty[i];
|
struct Pokemon *mon = &gEnemyParty[i];
|
||||||
sTradeMenu->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG, NULL),
|
sTradeMenu->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG),
|
||||||
SpriteCB_MonIcon,
|
SpriteCB_MonIcon,
|
||||||
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
|
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
|
||||||
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
|
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
|
||||||
|
|
@ -753,7 +753,7 @@ static void CB2_ReturnToTradeMenu(void)
|
||||||
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PLAYER]; i++)
|
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PLAYER]; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gPlayerParty[i];
|
struct Pokemon *mon = &gPlayerParty[i];
|
||||||
sTradeMenu->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG, NULL),
|
sTradeMenu->partySpriteIds[TRADE_PLAYER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG),
|
||||||
SpriteCB_MonIcon,
|
SpriteCB_MonIcon,
|
||||||
(sTradeMonSpriteCoords[i][0] * 8) + 14,
|
(sTradeMonSpriteCoords[i][0] * 8) + 14,
|
||||||
(sTradeMonSpriteCoords[i][1] * 8) - 12,
|
(sTradeMonSpriteCoords[i][1] * 8) - 12,
|
||||||
|
|
@ -764,7 +764,7 @@ static void CB2_ReturnToTradeMenu(void)
|
||||||
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PARTNER]; i++)
|
for (i = 0; i < sTradeMenu->partyCounts[TRADE_PARTNER]; i++)
|
||||||
{
|
{
|
||||||
struct Pokemon *mon = &gEnemyParty[i];
|
struct Pokemon *mon = &gEnemyParty[i];
|
||||||
sTradeMenu->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG, NULL),
|
sTradeMenu->partySpriteIds[TRADE_PARTNER][i] = CreateMonIcon(GetMonData(mon, MON_DATA_SPECIES_OR_EGG),
|
||||||
SpriteCB_MonIcon,
|
SpriteCB_MonIcon,
|
||||||
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
|
(sTradeMonSpriteCoords[i + PARTY_SIZE][0] * 8) + 14,
|
||||||
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
|
(sTradeMonSpriteCoords[i + PARTY_SIZE][1] * 8) - 12,
|
||||||
|
|
@ -1964,9 +1964,9 @@ static void BufferMovesString(u8 *str, u8 whichParty, u8 partyIdx)
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
if (whichParty == TRADE_PLAYER)
|
if (whichParty == TRADE_PLAYER)
|
||||||
moves[i] = GetMonData(&gPlayerParty[partyIdx], i + MON_DATA_MOVE1, NULL);
|
moves[i] = GetMonData(&gPlayerParty[partyIdx], i + MON_DATA_MOVE1);
|
||||||
else
|
else
|
||||||
moves[i] = GetMonData(&gEnemyParty[partyIdx], i + MON_DATA_MOVE1, NULL);
|
moves[i] = GetMonData(&gEnemyParty[partyIdx], i + MON_DATA_MOVE1);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringCopy(str, sText_EmptyString);
|
StringCopy(str, sText_EmptyString);
|
||||||
|
|
@ -2022,9 +2022,9 @@ static void PrintLevelAndGender(u8 whichParty, u8 monIdx, u8 x, u8 y, u8 width,
|
||||||
CopyBgTilemapBufferToVram(1);
|
CopyBgTilemapBufferToVram(1);
|
||||||
|
|
||||||
if (whichParty == TRADE_PLAYER)
|
if (whichParty == TRADE_PLAYER)
|
||||||
level = GetMonData(&gPlayerParty[monIdx], MON_DATA_LEVEL, NULL);
|
level = GetMonData(&gPlayerParty[monIdx], MON_DATA_LEVEL);
|
||||||
else
|
else
|
||||||
level = GetMonData(&gEnemyParty[monIdx], MON_DATA_LEVEL, NULL);
|
level = GetMonData(&gEnemyParty[monIdx], MON_DATA_LEVEL);
|
||||||
|
|
||||||
if (!sTradeMenu->isEgg[whichParty][monIdx])
|
if (!sTradeMenu->isEgg[whichParty][monIdx])
|
||||||
{
|
{
|
||||||
|
|
@ -3066,8 +3066,8 @@ static void UpdatePokedexForReceivedMon(u8 partyIdx)
|
||||||
|
|
||||||
if (!GetMonData(mon, MON_DATA_IS_EGG))
|
if (!GetMonData(mon, MON_DATA_IS_EGG))
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
|
u32 personality = GetMonData(mon, MON_DATA_PERSONALITY);
|
||||||
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
|
enum NationalDexOrder dexNum = SpeciesToNationalPokedexNum(species);
|
||||||
GetSetPokedexFlag(dexNum, FLAG_SET_SEEN);
|
GetSetPokedexFlag(dexNum, FLAG_SET_SEEN);
|
||||||
HandleSetPokedexFlag(dexNum, FLAG_SET_CAUGHT, personality);
|
HandleSetPokedexFlag(dexNum, FLAG_SET_CAUGHT, personality);
|
||||||
|
|
|
||||||
|
|
@ -962,7 +962,7 @@ u8 GetTrainerEncounterMusicIdInTrainerHill(u16 trainerId)
|
||||||
|
|
||||||
static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level)
|
static void SetTrainerHillMonLevel(struct Pokemon *mon, u8 level)
|
||||||
{
|
{
|
||||||
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u16 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
u32 exp = gExperienceTables[gSpeciesInfo[species].growthRate][level];
|
u32 exp = gExperienceTables[gSpeciesInfo[species].growthRate][level];
|
||||||
|
|
||||||
SetMonData(mon, MON_DATA_EXP, &exp);
|
SetMonData(mon, MON_DATA_EXP, &exp);
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,10 @@ static u32 GetPartyMonCount(u32 firstId, u32 lastId, u32 side, bool32 onlyAlive)
|
||||||
{
|
{
|
||||||
for (u32 i = firstId; i < lastId; i++)
|
for (u32 i = firstId; i < lastId; i++)
|
||||||
{
|
{
|
||||||
u32 species = GetMonData(&party[sMultiBattleOrder[i]], MON_DATA_SPECIES_OR_EGG, NULL);
|
u32 species = GetMonData(&party[sMultiBattleOrder[i]], MON_DATA_SPECIES_OR_EGG);
|
||||||
if (species != SPECIES_NONE
|
if (species != SPECIES_NONE
|
||||||
&& species != SPECIES_EGG
|
&& species != SPECIES_EGG
|
||||||
&& (!onlyAlive || GetMonData(&party[sMultiBattleOrder[i]], MON_DATA_HP, NULL)))
|
&& (!onlyAlive || GetMonData(&party[sMultiBattleOrder[i]], MON_DATA_HP)))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
@ -119,10 +119,10 @@ static u32 GetPartyMonCount(u32 firstId, u32 lastId, u32 side, bool32 onlyAlive)
|
||||||
{
|
{
|
||||||
for (u32 i = firstId; i < lastId; i++)
|
for (u32 i = firstId; i < lastId; i++)
|
||||||
{
|
{
|
||||||
u32 species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG, NULL);
|
u32 species = GetMonData(&party[i], MON_DATA_SPECIES_OR_EGG);
|
||||||
if (species != SPECIES_NONE
|
if (species != SPECIES_NONE
|
||||||
&& species != SPECIES_EGG
|
&& species != SPECIES_EGG
|
||||||
&& (!onlyAlive || GetMonData(&party[i], MON_DATA_HP, NULL)))
|
&& (!onlyAlive || GetMonData(&party[i], MON_DATA_HP)))
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
46
src/tv.c
46
src/tv.c
|
|
@ -1242,7 +1242,7 @@ static void InterviewAfter_ContestLiveUpdates(void)
|
||||||
show2->contestLiveUpdates.active = TRUE;
|
show2->contestLiveUpdates.active = TRUE;
|
||||||
StringCopy(show2->contestLiveUpdates.winningTrainerName, gSaveBlock2Ptr->playerName); // Show only begins running if player won, so always load players name
|
StringCopy(show2->contestLiveUpdates.winningTrainerName, gSaveBlock2Ptr->playerName); // Show only begins running if player won, so always load players name
|
||||||
show2->contestLiveUpdates.category = gSpecialVar_ContestCategory;
|
show2->contestLiveUpdates.category = gSpecialVar_ContestCategory;
|
||||||
show2->contestLiveUpdates.winningSpecies = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL);
|
show2->contestLiveUpdates.winningSpecies = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES);
|
||||||
show2->contestLiveUpdates.losingSpecies = show->contestLiveUpdates.losingSpecies;
|
show2->contestLiveUpdates.losingSpecies = show->contestLiveUpdates.losingSpecies;
|
||||||
show2->contestLiveUpdates.loserAppealFlag = show->contestLiveUpdates.loserAppealFlag;
|
show2->contestLiveUpdates.loserAppealFlag = show->contestLiveUpdates.loserAppealFlag;
|
||||||
show2->contestLiveUpdates.round1Placing = show->contestLiveUpdates.round1Placing;
|
show2->contestLiveUpdates.round1Placing = show->contestLiveUpdates.round1Placing;
|
||||||
|
|
@ -1467,7 +1467,7 @@ void BravoTrainerPokemonProfile_BeforeInterview2(u8 contestStandingPlace)
|
||||||
show->bravoTrainer.contestResult = contestStandingPlace;
|
show->bravoTrainer.contestResult = contestStandingPlace;
|
||||||
show->bravoTrainer.contestCategory = gSpecialVar_ContestCategory;
|
show->bravoTrainer.contestCategory = gSpecialVar_ContestCategory;
|
||||||
show->bravoTrainer.contestRank = gSpecialVar_ContestRank;
|
show->bravoTrainer.contestRank = gSpecialVar_ContestRank;
|
||||||
show->bravoTrainer.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES, NULL);
|
show->bravoTrainer.species = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_SPECIES);
|
||||||
GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_NICKNAME10, show->bravoTrainer.pokemonNickname);
|
GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_NICKNAME10, show->bravoTrainer.pokemonNickname);
|
||||||
StripExtCtrlCodes(show->bravoTrainer.pokemonNickname);
|
StripExtCtrlCodes(show->bravoTrainer.pokemonNickname);
|
||||||
show->bravoTrainer.pokemonNameLanguage = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_LANGUAGE);
|
show->bravoTrainer.pokemonNameLanguage = GetMonData(&gPlayerParty[gContestMonPartyIndex], MON_DATA_LANGUAGE);
|
||||||
|
|
@ -1544,7 +1544,7 @@ void PutNameRaterShowOnTheAir(void)
|
||||||
show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
||||||
show->nameRaterShow.kind = TVSHOW_NAME_RATER_SHOW;
|
show->nameRaterShow.kind = TVSHOW_NAME_RATER_SHOW;
|
||||||
show->nameRaterShow.active = TRUE;
|
show->nameRaterShow.active = TRUE;
|
||||||
show->nameRaterShow.species = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL);
|
show->nameRaterShow.species = GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES);
|
||||||
show->nameRaterShow.random = Random() % 3;
|
show->nameRaterShow.random = Random() % 3;
|
||||||
show->nameRaterShow.random2 = Random() % 2;
|
show->nameRaterShow.random2 = Random() % 2;
|
||||||
show->nameRaterShow.randomSpecies = GetRandomDifferentSpeciesSeenByPlayer(show->nameRaterShow.species);
|
show->nameRaterShow.randomSpecies = GetRandomDifferentSpeciesSeenByPlayer(show->nameRaterShow.species);
|
||||||
|
|
@ -1601,7 +1601,7 @@ static void InterviewAfter_FanClubLetter(void)
|
||||||
show->fanclubLetter.kind = TVSHOW_FAN_CLUB_LETTER;
|
show->fanclubLetter.kind = TVSHOW_FAN_CLUB_LETTER;
|
||||||
show->fanclubLetter.active = TRUE;
|
show->fanclubLetter.active = TRUE;
|
||||||
StringCopy(show->fanclubLetter.playerName, gSaveBlock2Ptr->playerName);
|
StringCopy(show->fanclubLetter.playerName, gSaveBlock2Ptr->playerName);
|
||||||
show->fanclubLetter.species = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL);
|
show->fanclubLetter.species = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES);
|
||||||
StorePlayerIdInNormalShow(show);
|
StorePlayerIdInNormalShow(show);
|
||||||
show->fanclubLetter.language = gGameLanguage;
|
show->fanclubLetter.language = gGameLanguage;
|
||||||
}
|
}
|
||||||
|
|
@ -1622,12 +1622,12 @@ static void InterviewAfter_PkmnFanClubOpinions(void)
|
||||||
TVShow *show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
TVShow *show = &gSaveBlock1Ptr->tvShows[sCurTVShowSlot];
|
||||||
show->fanclubOpinions.kind = TVSHOW_PKMN_FAN_CLUB_OPINIONS;
|
show->fanclubOpinions.kind = TVSHOW_PKMN_FAN_CLUB_OPINIONS;
|
||||||
show->fanclubOpinions.active = TRUE;
|
show->fanclubOpinions.active = TRUE;
|
||||||
show->fanclubOpinions.friendshipHighNybble = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_FRIENDSHIP, NULL) >> 4;
|
show->fanclubOpinions.friendshipHighNybble = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_FRIENDSHIP) >> 4;
|
||||||
show->fanclubOpinions.questionAsked = gSpecialVar_0x8007;
|
show->fanclubOpinions.questionAsked = gSpecialVar_0x8007;
|
||||||
StringCopy(show->fanclubOpinions.playerName, gSaveBlock2Ptr->playerName);
|
StringCopy(show->fanclubOpinions.playerName, gSaveBlock2Ptr->playerName);
|
||||||
GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME10, show->fanclubOpinions.nickname);
|
GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME10, show->fanclubOpinions.nickname);
|
||||||
StripExtCtrlCodes(show->fanclubOpinions.nickname);
|
StripExtCtrlCodes(show->fanclubOpinions.nickname);
|
||||||
show->fanclubOpinions.species = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL);
|
show->fanclubOpinions.species = GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES);
|
||||||
StorePlayerIdInNormalShow(show);
|
StorePlayerIdInNormalShow(show);
|
||||||
show->fanclubOpinions.language = gGameLanguage;
|
show->fanclubOpinions.language = gGameLanguage;
|
||||||
if (gGameLanguage == LANGUAGE_JAPANESE || GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE)
|
if (gGameLanguage == LANGUAGE_JAPANESE || GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_LANGUAGE) == LANGUAGE_JAPANESE)
|
||||||
|
|
@ -2390,23 +2390,23 @@ void TryPutFrontierTVShowOnAir(u16 winStreak, u8 facilityAndMode)
|
||||||
case FRONTIER_SHOW_PALACE_SINGLES:
|
case FRONTIER_SHOW_PALACE_SINGLES:
|
||||||
case FRONTIER_SHOW_PALACE_DOUBLES:
|
case FRONTIER_SHOW_PALACE_DOUBLES:
|
||||||
case FRONTIER_SHOW_PYRAMID:
|
case FRONTIER_SHOW_PYRAMID:
|
||||||
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
show->frontier.species3 = GetMonData(&gPlayerParty[2], MON_DATA_SPECIES, NULL);
|
show->frontier.species3 = GetMonData(&gPlayerParty[2], MON_DATA_SPECIES);
|
||||||
break;
|
break;
|
||||||
case FRONTIER_SHOW_TOWER_DOUBLES:
|
case FRONTIER_SHOW_TOWER_DOUBLES:
|
||||||
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
show->frontier.species3 = GetMonData(&gPlayerParty[2], MON_DATA_SPECIES, NULL);
|
show->frontier.species3 = GetMonData(&gPlayerParty[2], MON_DATA_SPECIES);
|
||||||
show->frontier.species4 = GetMonData(&gPlayerParty[3], MON_DATA_SPECIES, NULL);
|
show->frontier.species4 = GetMonData(&gPlayerParty[3], MON_DATA_SPECIES);
|
||||||
break;
|
break;
|
||||||
case FRONTIER_SHOW_TOWER_MULTIS:
|
case FRONTIER_SHOW_TOWER_MULTIS:
|
||||||
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES, NULL);
|
show->frontier.species1 = GetMonData(&gPlayerParty[0], MON_DATA_SPECIES);
|
||||||
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES, NULL);
|
show->frontier.species2 = GetMonData(&gPlayerParty[1], MON_DATA_SPECIES);
|
||||||
break;
|
break;
|
||||||
case FRONTIER_SHOW_TOWER_LINK_MULTIS:
|
case FRONTIER_SHOW_TOWER_LINK_MULTIS:
|
||||||
show->frontier.species1 = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[0] - 1), MON_DATA_SPECIES, NULL);
|
show->frontier.species1 = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[0] - 1), MON_DATA_SPECIES);
|
||||||
show->frontier.species2 = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[1] - 1), MON_DATA_SPECIES, NULL);
|
show->frontier.species2 = GetMonData(GetSavedPlayerPartyMon(gSaveBlock2Ptr->frontier.selectedPartyMons[1] - 1), MON_DATA_SPECIES);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
StorePlayerIdInRecordMixShow(show);
|
StorePlayerIdInRecordMixShow(show);
|
||||||
|
|
@ -2915,7 +2915,7 @@ static void InterviewBefore_FanClubLetter(void)
|
||||||
TryReplaceOldTVShowOfKind(TVSHOW_FAN_CLUB_LETTER);
|
TryReplaceOldTVShowOfKind(TVSHOW_FAN_CLUB_LETTER);
|
||||||
if (!gSpecialVar_Result)
|
if (!gSpecialVar_Result)
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL)));
|
StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES)));
|
||||||
InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words,
|
InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words,
|
||||||
ARRAY_COUNT(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words));
|
ARRAY_COUNT(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubLetter.words));
|
||||||
}
|
}
|
||||||
|
|
@ -2936,7 +2936,7 @@ static void InterviewBefore_PkmnFanClubOpinions(void)
|
||||||
TryReplaceOldTVShowOfKind(TVSHOW_PKMN_FAN_CLUB_OPINIONS);
|
TryReplaceOldTVShowOfKind(TVSHOW_PKMN_FAN_CLUB_OPINIONS);
|
||||||
if (!gSpecialVar_Result)
|
if (!gSpecialVar_Result)
|
||||||
{
|
{
|
||||||
StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES, NULL)));
|
StringCopy(gStringVar1, GetSpeciesName(GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_SPECIES)));
|
||||||
GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME, gStringVar2);
|
GetMonData(&gPlayerParty[GetLeadMonIndex()], MON_DATA_NICKNAME, gStringVar2);
|
||||||
StringGet_Nickname(gStringVar2);
|
StringGet_Nickname(gStringVar2);
|
||||||
InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubOpinions.words,
|
InitializeEasyChatWordArray(gSaveBlock1Ptr->tvShows[sCurTVShowSlot].fanclubOpinions.words,
|
||||||
|
|
@ -2996,7 +2996,7 @@ static bool8 IsPartyMonNicknamedOrNotEnglish(u8 monIdx)
|
||||||
pokemon = &gPlayerParty[monIdx];
|
pokemon = &gPlayerParty[monIdx];
|
||||||
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
|
GetMonData(pokemon, MON_DATA_NICKNAME, gStringVar1);
|
||||||
language = GetMonData(pokemon, MON_DATA_LANGUAGE, &language);
|
language = GetMonData(pokemon, MON_DATA_LANGUAGE, &language);
|
||||||
if (language == GAME_LANGUAGE && !StringCompare(GetSpeciesName(GetMonData(pokemon, MON_DATA_SPECIES, NULL)), gStringVar1))
|
if (language == GAME_LANGUAGE && !StringCompare(GetSpeciesName(GetMonData(pokemon, MON_DATA_SPECIES)), gStringVar1))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -3276,7 +3276,7 @@ void ChangePokemonNickname(void)
|
||||||
|
|
||||||
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
|
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
|
||||||
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
|
GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
|
||||||
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES, NULL), GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY, NULL), ChangePokemonNickname_CB);
|
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES), GetMonGender(&gPlayerParty[gSpecialVar_0x8004]), GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_PERSONALITY), ChangePokemonNickname_CB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChangePokemonNickname_CB(void)
|
void ChangePokemonNickname_CB(void)
|
||||||
|
|
@ -3292,7 +3292,7 @@ void ChangeBoxPokemonNickname(void)
|
||||||
boxMon = GetBoxedMonPtr(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos);
|
boxMon = GetBoxedMonPtr(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos);
|
||||||
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar3);
|
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar3);
|
||||||
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar2);
|
GetBoxMonData(boxMon, MON_DATA_NICKNAME, gStringVar2);
|
||||||
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetBoxMonData(boxMon, MON_DATA_SPECIES, NULL), GetBoxMonGender(boxMon), GetBoxMonData(boxMon, MON_DATA_PERSONALITY, NULL), ChangeBoxPokemonNickname_CB);
|
DoNamingScreen(NAMING_SCREEN_NICKNAME, gStringVar2, GetBoxMonData(boxMon, MON_DATA_SPECIES), GetBoxMonGender(boxMon), GetBoxMonData(boxMon, MON_DATA_PERSONALITY), ChangeBoxPokemonNickname_CB);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ChangeBoxPokemonNickname_CB(void)
|
static void ChangeBoxPokemonNickname_CB(void)
|
||||||
|
|
@ -3313,7 +3313,7 @@ void BufferMonNickname(void)
|
||||||
void IsMonOTIDNotPlayers(void)
|
void IsMonOTIDNotPlayers(void)
|
||||||
{
|
{
|
||||||
if(gSpecialVar_MonBoxId == 0xFF){
|
if(gSpecialVar_MonBoxId == 0xFF){
|
||||||
if (GetPlayerIDAsU32() == GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_OT_ID, NULL))
|
if (GetPlayerIDAsU32() == GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_OT_ID))
|
||||||
gSpecialVar_Result = FALSE;
|
gSpecialVar_Result = FALSE;
|
||||||
else
|
else
|
||||||
gSpecialVar_Result = TRUE;
|
gSpecialVar_Result = TRUE;
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ void LoadTypeIcons(u32 battler)
|
||||||
u32 position;
|
u32 position;
|
||||||
|
|
||||||
struct Pokemon* mon = GetBattlerMon(battler);
|
struct Pokemon* mon = GetBattlerMon(battler);
|
||||||
u32 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
|
u32 species = GetMonData(mon, MON_DATA_SPECIES);
|
||||||
|
|
||||||
if (B_SHOW_TYPES == SHOW_TYPES_NEVER
|
if (B_SHOW_TYPES == SHOW_TYPES_NEVER
|
||||||
|| (B_SHOW_TYPES == SHOW_TYPES_SEEN && !GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)))
|
|| (B_SHOW_TYPES == SHOW_TYPES_SEEN && !GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_SEEN)))
|
||||||
|
|
|
||||||
|
|
@ -1763,7 +1763,7 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||||
gLinkPlayers[0].id = 0;
|
gLinkPlayers[0].id = 0;
|
||||||
gLinkPlayers[1].id = 2;
|
gLinkPlayers[1].id = 2;
|
||||||
sendBuff[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
|
sendBuff[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES);
|
||||||
sendBuff[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
|
sendBuff[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES);
|
||||||
gMain.savedCallback = NULL;
|
gMain.savedCallback = NULL;
|
||||||
data[0] = 4;
|
data[0] = 4;
|
||||||
SaveLinkTrainerNames();
|
SaveLinkTrainerNames();
|
||||||
|
|
|
||||||
|
|
@ -498,12 +498,12 @@ static void BattleTest_Run(void *data)
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if(GetMonData(&DATA.recordedBattle.playerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if(GetMonData(&DATA.recordedBattle.playerParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
revisedPlayerExplicitSpeeds |= 1 << i;
|
revisedPlayerExplicitSpeeds |= 1 << i;
|
||||||
}
|
}
|
||||||
for (i = 3; i < PARTY_SIZE; i++)
|
for (i = 3; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if(GetMonData(&DATA.recordedBattle.playerParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if(GetMonData(&DATA.recordedBattle.playerParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
if(DATA.currentPosition == B_POSITION_PLAYER_LEFT)
|
if(DATA.currentPosition == B_POSITION_PLAYER_LEFT)
|
||||||
revisedPlayerExplicitSpeeds |= 1 << i;
|
revisedPlayerExplicitSpeeds |= 1 << i;
|
||||||
|
|
@ -514,12 +514,12 @@ static void BattleTest_Run(void *data)
|
||||||
|
|
||||||
for (i = 0; i < 3; i++)
|
for (i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
if(GetMonData(&DATA.recordedBattle.opponentParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if(GetMonData(&DATA.recordedBattle.opponentParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
revisedOpponentAExplicitSpeeds |= 1 << i;
|
revisedOpponentAExplicitSpeeds |= 1 << i;
|
||||||
}
|
}
|
||||||
for (i = 3; i < PARTY_SIZE; i++)
|
for (i = 3; i < PARTY_SIZE; i++)
|
||||||
{
|
{
|
||||||
if(GetMonData(&DATA.recordedBattle.opponentParty[i], MON_DATA_SPECIES, NULL) != SPECIES_NONE)
|
if(GetMonData(&DATA.recordedBattle.opponentParty[i], MON_DATA_SPECIES) != SPECIES_NONE)
|
||||||
{
|
{
|
||||||
if(DATA.currentPosition == B_POSITION_OPPONENT_LEFT)
|
if(DATA.currentPosition == B_POSITION_OPPONENT_LEFT)
|
||||||
revisedOpponentAExplicitSpeeds |= 1 << i;
|
revisedOpponentAExplicitSpeeds |= 1 << i;
|
||||||
|
|
@ -3113,7 +3113,7 @@ void UseItem(u32 sourceLine, struct BattlePokemon *battler, struct ItemContext c
|
||||||
INVALID_IF(!ctx.explicitMove, "%S requires an explicit move", GetItemName(ctx.itemId));
|
INVALID_IF(!ctx.explicitMove, "%S requires an explicit move", GetItemName(ctx.itemId));
|
||||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||||
{
|
{
|
||||||
if (GetMonData(CurrentMon(battlerId), MON_DATA_MOVE1 + i, NULL) == ctx.move)
|
if (GetMonData(CurrentMon(battlerId), MON_DATA_MOVE1 + i) == ctx.move)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
INVALID_IF(i == MAX_MON_MOVES, "USE_ITEM on invalid move: %d", ctx.move);
|
INVALID_IF(i == MAX_MON_MOVES, "USE_ITEM on invalid move: %d", ctx.move);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user