mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-13 23:23:43 +01:00
Document remaining symbols in pokemon.c
This commit is contained in:
parent
739e7d3c31
commit
6e62c057f5
@ -28,6 +28,8 @@
|
||||
#define ABILITYEFFECT_COUNT_BATTLER_SIDE 0x11
|
||||
#define ABILITYEFFECT_COUNT_ON_FIELD 0x12
|
||||
#define ABILITYEFFECT_CHECK_ON_FIELD 0x13
|
||||
#define ABILITYEFFECT_MUD_SPORT 0xFD
|
||||
#define ABILITYEFFECT_WATER_SPORT 0xFE
|
||||
#define ABILITYEFFECT_SWITCH_IN_WEATHER 0xFF
|
||||
|
||||
#define ABILITY_ON_OPPOSING_FIELD(battlerId, abilityId)(AbilityBattleEffects(ABILITYEFFECT_CHECK_OTHER_SIDE, battlerId, abilityId, 0, 0))
|
||||
|
@ -339,4 +339,10 @@
|
||||
|
||||
#define MON_PIC_SIZE (64 * 64 / 2)
|
||||
|
||||
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
|
||||
#define BATTLE_ALIVE_ATK_SIDE 1
|
||||
#define BATTLE_ALIVE_DEF_SIDE 2
|
||||
|
||||
#define SKIP_FRONT_ANIM (1 << 7)
|
||||
|
||||
#endif // GUARD_CONSTANTS_POKEMON_H
|
||||
|
@ -110,6 +110,7 @@
|
||||
#define TRAINER_PIC_RS_BRENDAN 91
|
||||
#define TRAINER_PIC_RS_MAY 92
|
||||
|
||||
// The player back pics are assumed to alternate according to the gender values (MALE/FEMALE)
|
||||
#define TRAINER_BACK_PIC_BRENDAN 0
|
||||
#define TRAINER_BACK_PIC_MAY 1
|
||||
#define TRAINER_BACK_PIC_RED 2
|
||||
@ -334,7 +335,7 @@
|
||||
#define TRAINER_CLASS_SAILOR 0x2f
|
||||
#define TRAINER_CLASS_COOLTRAINER_2 0x30 // Used for only one trainer.
|
||||
#define TRAINER_CLASS_MAGMA_ADMIN 0x31
|
||||
#define TRAINER_CLASS_PKMN_TRAINER_3 0x32
|
||||
#define TRAINER_CLASS_RIVAL 0x32
|
||||
#define TRAINER_CLASS_BUG_CATCHER 0x33
|
||||
#define TRAINER_CLASS_PKMN_RANGER 0x34
|
||||
#define TRAINER_CLASS_MAGMA_LEADER 0x35
|
||||
|
@ -259,6 +259,8 @@ struct Evolution
|
||||
| (((personality) & 0x00000003) >> 0) \
|
||||
) % NUM_UNOWN_FORMS)
|
||||
|
||||
#define GET_SHINY_VALUE(otId, personality)HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality)
|
||||
|
||||
extern u8 gPlayerPartyCount;
|
||||
extern struct Pokemon gPlayerParty[PARTY_SIZE];
|
||||
extern u8 gEnemyPartyCount;
|
||||
@ -273,8 +275,8 @@ extern const u8 *const gItemEffectTable[];
|
||||
extern const u32 gExperienceTables[][MAX_LEVEL + 1];
|
||||
extern const u16 *const gLevelUpLearnsets[];
|
||||
extern const u8 gPPUpGetMask[];
|
||||
extern const u8 gPPUpSetMask[];
|
||||
extern const u8 gPPUpAddMask[];
|
||||
extern const u8 gPPUpClearMask[];
|
||||
extern const u8 gPPUpAddValues[];
|
||||
extern const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2];
|
||||
extern const u16 gLinkPlayerFacilityClasses[];
|
||||
extern const struct SpriteTemplate gBattlerSpriteTemplates[];
|
||||
@ -293,7 +295,7 @@ void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32
|
||||
void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId);
|
||||
void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 evSpread);
|
||||
void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src);
|
||||
void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
|
||||
void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50);
|
||||
void CreateApprenticeMon(struct Pokemon *mon, const struct Apprentice *src, u8 monId);
|
||||
void CreateMonWithEVSpreadNatureOTID(struct Pokemon *mon, u16 species, u8 level, u8 nature, u8 fixedIV, u8 evSpread, u32 otId);
|
||||
void ConvertPokemonToBattleTowerPokemon(struct Pokemon *mon, struct BattleTowerPokemon *dest);
|
||||
@ -317,12 +319,7 @@ u16 MonTryLearningNewMove(struct Pokemon *mon, bool8 firstMove);
|
||||
void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move);
|
||||
void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
||||
s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *defender, u32 move, u16 sideStatus, u16 powerOverride, u8 typeOverride, u8 bankAtk, u8 bankDef);
|
||||
|
||||
u8 CountAliveMonsInBattle(u8 caseId);
|
||||
#define BATTLE_ALIVE_EXCEPT_ACTIVE 0
|
||||
#define BATTLE_ALIVE_ATK_SIDE 1
|
||||
#define BATTLE_ALIVE_DEF_SIDE 2
|
||||
|
||||
u8 GetDefaultMoveTarget(u8 battlerId);
|
||||
u8 GetMonGender(struct Pokemon *mon);
|
||||
u8 GetBoxMonGender(struct BoxPokemon *boxMon);
|
||||
@ -342,7 +339,6 @@ void SetMonData(struct Pokemon *mon, s32 field, const void *dataArg);
|
||||
void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg);
|
||||
void CopyMon(void *dest, void *src, size_t size);
|
||||
u8 GiveMonToPlayer(struct Pokemon *mon);
|
||||
u8 SendMonToPC(struct Pokemon* mon);
|
||||
u8 CalculatePlayerPartyCount(void);
|
||||
u8 CalculateEnemyPartyCount(void);
|
||||
u8 GetMonsStateToDoubles(void);
|
||||
@ -374,7 +370,6 @@ u16 SpeciesToNationalPokedexNum(u16 species);
|
||||
u16 SpeciesToHoennPokedexNum(u16 species);
|
||||
u16 HoennToNationalOrder(u16 hoennNum);
|
||||
u16 SpeciesToCryId(u16 species);
|
||||
void sub_806D544(u16 species, u32 personality, u8 *dest);
|
||||
void DrawSpindaSpots(u16 species, u32 personality, u8 *dest, u8 a4);
|
||||
void EvolutionRenameMon(struct Pokemon *mon, u16 oldSpecies, u16 newSpecies);
|
||||
u8 GetPlayerFlankId(void);
|
||||
@ -425,9 +420,7 @@ void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry,
|
||||
void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneFrame);
|
||||
void StopPokemonAnimationDelayTask(void);
|
||||
void BattleAnimateBackSprite(struct Sprite* sprite, u16 species);
|
||||
u8 sub_806EF08(u8 arg0);
|
||||
u8 sub_806EF84(u8 arg0, u8 arg1);
|
||||
u16 sub_806EFF0(u16 arg0);
|
||||
u8 GetOpposingLinkMultiBattlerId(bool8 rightSide, u8 multiplayerId);
|
||||
u16 FacilityClassToPicIndex(u16 facilityClass);
|
||||
u16 PlayerGenderToFrontTrainerPicId(u8 playerGender);
|
||||
void HandleSetPokedexFlag(u16 nationalNum, u8 caseId, u32 personality);
|
||||
|
@ -2227,7 +2227,7 @@ void TryShinyAnimation(u8 battler, struct Pokemon *mon)
|
||||
|
||||
if (IsBattlerSpriteVisible(battler))
|
||||
{
|
||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
shinyValue = GET_SHINY_VALUE(otId, personality);
|
||||
if (shinyValue < SHINY_ODDS)
|
||||
isShiny = TRUE;
|
||||
|
||||
|
@ -501,7 +501,7 @@ const struct TrainerMoney gTrainerMoneyTable[] =
|
||||
{TRAINER_CLASS_TWINS, 3},
|
||||
{TRAINER_CLASS_SAILOR, 8},
|
||||
{TRAINER_CLASS_COLLECTOR, 15},
|
||||
{TRAINER_CLASS_PKMN_TRAINER_3, 15},
|
||||
{TRAINER_CLASS_RIVAL, 15},
|
||||
{TRAINER_CLASS_PKMN_BREEDER, 10},
|
||||
{TRAINER_CLASS_PKMN_RANGER, 12},
|
||||
{TRAINER_CLASS_TEAM_MAGMA, 5},
|
||||
|
@ -449,7 +449,7 @@ static const struct PyramidTrainerEncounterMusic sTrainerClassEncounterMusic[54]
|
||||
{TRAINER_CLASS_PKMN_BREEDER, TRAINER_ENCOUNTER_MUSIC_FEMALE},
|
||||
{TRAINER_CLASS_COLLECTOR, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
|
||||
{TRAINER_CLASS_PKMN_RANGER, TRAINER_ENCOUNTER_MUSIC_COOL},
|
||||
{TRAINER_CLASS_PKMN_TRAINER_3, TRAINER_ENCOUNTER_MUSIC_MALE},
|
||||
{TRAINER_CLASS_RIVAL, TRAINER_ENCOUNTER_MUSIC_MALE},
|
||||
{TRAINER_CLASS_YOUNG_COUPLE, TRAINER_ENCOUNTER_MUSIC_GIRL},
|
||||
{TRAINER_CLASS_PSYCHIC, TRAINER_ENCOUNTER_MUSIC_INTENSE},
|
||||
{TRAINER_CLASS_SR_AND_JR, TRAINER_ENCOUNTER_MUSIC_TWINS},
|
||||
|
@ -1668,7 +1668,7 @@ static void FillTrainerParty(u16 trainerId, u8 firstMonId, u8 monCount)
|
||||
if (gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].species != 0
|
||||
&& gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j].level <= level)
|
||||
{
|
||||
CreateBattleTowerMon2(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j], FALSE);
|
||||
CreateBattleTowerMon_HandleLevel(&gEnemyParty[i], &gSaveBlock2Ptr->frontier.towerRecords[trainerId - TRAINER_RECORD_MIXING_FRIEND].party[j], FALSE);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -3042,7 +3042,7 @@ static void FillPartnerParty(u16 trainerId)
|
||||
if (monData.nickname[0] == EXT_CTRL_CODE_BEGIN && monData.nickname[1] == EXT_CTRL_CODE_JPN)
|
||||
trainerName[5] = EOS;
|
||||
}
|
||||
CreateBattleTowerMon2(&gPlayerParty[MULTI_PARTY_SIZE + i], &monData, TRUE);
|
||||
CreateBattleTowerMon_HandleLevel(&gPlayerParty[MULTI_PARTY_SIZE + i], &monData, TRUE);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_NAME, trainerName);
|
||||
j = IsFrontierTrainerFemale(trainerId + TRAINER_RECORD_MIXING_FRIEND);
|
||||
SetMonData(&gPlayerParty[MULTI_PARTY_SIZE + i], MON_DATA_OT_GENDER, &j);
|
||||
|
@ -1130,11 +1130,11 @@ void TryPutLinkBattleTvShowOnAir(void)
|
||||
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_MULTI)
|
||||
{
|
||||
if ((playerBestMonId < 3 && !GetLinkTrainerFlankId(gBattleScripting.multiplayerId))
|
||||
|| (playerBestMonId >= 3 && GetLinkTrainerFlankId(gBattleScripting.multiplayerId)))
|
||||
if ((playerBestMonId < MULTI_PARTY_SIZE && !GetLinkTrainerFlankId(gBattleScripting.multiplayerId))
|
||||
|| (playerBestMonId >= MULTI_PARTY_SIZE && GetLinkTrainerFlankId(gBattleScripting.multiplayerId)))
|
||||
{
|
||||
j = (opponentBestMonId < 3) ? 0 : 1;
|
||||
PutBattleUpdateOnTheAir(sub_806EF84(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies);
|
||||
j = (opponentBestMonId < MULTI_PARTY_SIZE) ? FALSE : TRUE;
|
||||
PutBattleUpdateOnTheAir(GetOpposingLinkMultiBattlerId(j, gBattleScripting.multiplayerId), moveId, playerBestSpecies, opponentBestSpecies);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3095,14 +3095,14 @@ u8 AbilityBattleEffects(u8 caseID, u8 battler, u8 ability, u8 special, u16 moveA
|
||||
case ABILITYEFFECT_FIELD_SPORT: // 14
|
||||
switch (gLastUsedAbility)
|
||||
{
|
||||
case 0xFD:
|
||||
case ABILITYEFFECT_MUD_SPORT:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gStatuses3[i] & STATUS3_MUDSPORT)
|
||||
effect = i + 1;
|
||||
}
|
||||
break;
|
||||
case 0xFE:
|
||||
case ABILITYEFFECT_WATER_SPORT:
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
if (gStatuses3[i] & STATUS3_WATERSPORT)
|
||||
|
@ -145,13 +145,13 @@ const u8 gFacilityClassToTrainerClass[] =
|
||||
[FACILITY_CLASS_SWIMMER_F] = TRAINER_CLASS_SWIMMER_F,
|
||||
[FACILITY_CLASS_TWINS] = TRAINER_CLASS_TWINS,
|
||||
[FACILITY_CLASS_SAILOR] = TRAINER_CLASS_SAILOR,
|
||||
[FACILITY_CLASS_WALLY] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_BRENDAN] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_BRENDAN_2] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_BRENDAN_3] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_MAY] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_MAY_2] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_MAY_3] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_WALLY] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_BRENDAN] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_BRENDAN_2] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_BRENDAN_3] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_MAY] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_MAY_2] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_MAY_3] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_PKMN_BREEDER_M] = TRAINER_CLASS_PKMN_BREEDER,
|
||||
[FACILITY_CLASS_BUG_CATCHER] = TRAINER_CLASS_BUG_CATCHER,
|
||||
[FACILITY_CLASS_PKMN_RANGER_M] = TRAINER_CLASS_PKMN_RANGER,
|
||||
@ -161,11 +161,11 @@ const u8 gFacilityClassToTrainerClass[] =
|
||||
[FACILITY_CLASS_YOUNG_COUPLE] = TRAINER_CLASS_YOUNG_COUPLE,
|
||||
[FACILITY_CLASS_OLD_COUPLE] = TRAINER_CLASS_OLD_COUPLE,
|
||||
[FACILITY_CLASS_SIS_AND_BRO] = TRAINER_CLASS_SIS_AND_BRO,
|
||||
[FACILITY_CLASS_STEVEN] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_STEVEN] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_SALON_MAIDEN_ANABEL] = TRAINER_CLASS_SALON_MAIDEN,
|
||||
[FACILITY_CLASS_DOME_ACE_TUCKER] = TRAINER_CLASS_DOME_ACE,
|
||||
[FACILITY_CLASS_RED] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_LEAF] = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
[FACILITY_CLASS_RED] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_LEAF] = TRAINER_CLASS_RIVAL,
|
||||
[FACILITY_CLASS_RS_BRENDAN] = TRAINER_CLASS_RS_PROTAG,
|
||||
[FACILITY_CLASS_RS_MAY] = TRAINER_CLASS_RS_PROTAG,
|
||||
};
|
||||
|
@ -49,7 +49,7 @@ const u8 gTrainerClassNames[][13] = {
|
||||
[TRAINER_CLASS_SAILOR] = _("SAILOR"),
|
||||
[TRAINER_CLASS_COOLTRAINER_2] = _("COOLTRAINER"),
|
||||
[TRAINER_CLASS_MAGMA_ADMIN] = _("MAGMA ADMIN"),
|
||||
[TRAINER_CLASS_PKMN_TRAINER_3] = _("{PKMN} TRAINER"),
|
||||
[TRAINER_CLASS_RIVAL] = _("{PKMN} TRAINER"),
|
||||
[TRAINER_CLASS_BUG_CATCHER] = _("BUG CATCHER"),
|
||||
[TRAINER_CLASS_PKMN_RANGER] = _("{PKMN} RANGER"),
|
||||
[TRAINER_CLASS_MAGMA_LEADER] = _("MAGMA LEADER"),
|
||||
|
@ -7268,7 +7268,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_VR_1] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -7282,7 +7282,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_103_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7296,7 +7296,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_110_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7310,7 +7310,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_119_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7324,7 +7324,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_103_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7338,7 +7338,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_110_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7352,7 +7352,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_119_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7366,7 +7366,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_103_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7380,7 +7380,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_110_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7394,7 +7394,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_ROUTE_119_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -7408,7 +7408,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_103_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7422,7 +7422,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_110_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7436,7 +7436,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_119_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7450,7 +7450,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_103_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7464,7 +7464,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_110_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7478,7 +7478,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_119_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7492,7 +7492,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_103_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7506,7 +7506,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_110_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -7520,7 +7520,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_ROUTE_119_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -8290,7 +8290,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_RUSTBORO_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -8304,7 +8304,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_RUSTBORO_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -8388,7 +8388,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_RUSTBORO_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -8402,7 +8402,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_RUSTBORO_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -9186,7 +9186,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_MAUVILLE] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -9200,7 +9200,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_VR_2] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -9214,7 +9214,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_VR_3] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -9228,7 +9228,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_VR_4] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -9242,7 +9242,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_WALLY_VR_5] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_WALLY,
|
||||
.trainerName = _("WALLY"),
|
||||
@ -9256,7 +9256,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_LILYCOVE_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -9270,7 +9270,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_LILYCOVE_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -9284,7 +9284,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_BRENDAN_LILYCOVE_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_BRENDAN,
|
||||
.trainerName = _("BRENDAN"),
|
||||
@ -9298,7 +9298,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_LILYCOVE_MUDKIP] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -9312,7 +9312,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_LILYCOVE_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -9326,7 +9326,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_LILYCOVE_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -10754,7 +10754,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_RUSTBORO_TREECKO] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -10768,7 +10768,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_MAY_RUSTBORO_TORCHIC] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_FEMALE,
|
||||
.trainerPic = TRAINER_PIC_MAY,
|
||||
.trainerName = _("MAY"),
|
||||
@ -11258,7 +11258,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_STEVEN] =
|
||||
{
|
||||
.partyFlags = F_TRAINER_PARTY_HELD_ITEM | F_TRAINER_PARTY_CUSTOM_MOVESET,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_STEVEN,
|
||||
.trainerName = _("STEVEN"),
|
||||
@ -11916,7 +11916,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_RED] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_RED,
|
||||
.trainerName = _("RED"),
|
||||
@ -11930,7 +11930,7 @@ const struct Trainer gTrainers[] = {
|
||||
[TRAINER_LEAF] =
|
||||
{
|
||||
.partyFlags = 0,
|
||||
.trainerClass = TRAINER_CLASS_PKMN_TRAINER_3,
|
||||
.trainerClass = TRAINER_CLASS_RIVAL,
|
||||
.encounterMusic_gender = F_TRAINER_FEMALE | TRAINER_ENCOUNTER_MUSIC_MALE,
|
||||
.trainerPic = TRAINER_PIC_LEAF,
|
||||
.trainerName = _("LEAF"),
|
||||
|
345
src/pokemon.c
345
src/pokemon.c
@ -52,7 +52,6 @@ struct SpeciesItem
|
||||
u16 item;
|
||||
};
|
||||
|
||||
// this file's functions
|
||||
static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon);
|
||||
static union PokemonSubstruct *GetSubstruct(struct BoxPokemon *boxMon, u32 personality, u8 substructType);
|
||||
static void EncryptBoxMon(struct BoxPokemon *boxMon);
|
||||
@ -61,8 +60,8 @@ static void Task_PlayMapChosenOrBattleBGM(u8 taskId);
|
||||
static bool8 ShouldGetStatBadgeBoost(u16 flagId, u8 battlerId);
|
||||
static u16 GiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move);
|
||||
static bool8 ShouldSkipFriendshipChange(void);
|
||||
static u8 SendMonToPC(struct Pokemon* mon);
|
||||
|
||||
// EWRAM vars
|
||||
EWRAM_DATA static u8 sLearningMoveTableID = 0;
|
||||
EWRAM_DATA u8 gPlayerPartyCount = 0;
|
||||
EWRAM_DATA u8 gEnemyPartyCount = 0;
|
||||
@ -71,7 +70,6 @@ EWRAM_DATA struct Pokemon gEnemyParty[PARTY_SIZE] = {0};
|
||||
EWRAM_DATA struct SpriteTemplate gMultiuseSpriteTemplate = {0};
|
||||
EWRAM_DATA static struct MonSpritesGfxManager *sMonSpritesGfxManagers[MON_SPR_GFX_MANAGERS_COUNT] = {NULL};
|
||||
|
||||
// const rom data
|
||||
#include "data/battle_moves.h"
|
||||
|
||||
// Used in an unreferenced function in RS.
|
||||
@ -93,7 +91,8 @@ static const struct CombinedMove sCombinedMoves[2] =
|
||||
#define SPECIES_TO_NATIONAL(name) [SPECIES_##name - 1] = NATIONAL_DEX_##name
|
||||
#define HOENN_TO_NATIONAL(name) [HOENN_DEX_##name - 1] = NATIONAL_DEX_##name
|
||||
|
||||
const u16 gSpeciesToHoennPokedexNum[] = // Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex)
|
||||
// Assigns all species to the Hoenn Dex Index (Summary No. for Hoenn Dex)
|
||||
static const u16 sSpeciesToHoennPokedexNum[NUM_SPECIES - 1] =
|
||||
{
|
||||
SPECIES_TO_HOENN(BULBASAUR),
|
||||
SPECIES_TO_HOENN(IVYSAUR),
|
||||
@ -508,7 +507,8 @@ const u16 gSpeciesToHoennPokedexNum[] = // Assigns all species to the Hoenn Dex
|
||||
SPECIES_TO_HOENN(CHIMECHO),
|
||||
};
|
||||
|
||||
const u16 gSpeciesToNationalPokedexNum[] = // Assigns all species to the National Dex Index (Summary No. for National Dex)
|
||||
// Assigns all species to the National Dex Index (Summary No. for National Dex)
|
||||
static const u16 sSpeciesToNationalPokedexNum[NUM_SPECIES - 1] =
|
||||
{
|
||||
SPECIES_TO_NATIONAL(BULBASAUR),
|
||||
SPECIES_TO_NATIONAL(IVYSAUR),
|
||||
@ -923,7 +923,8 @@ const u16 gSpeciesToNationalPokedexNum[] = // Assigns all species to the Nationa
|
||||
SPECIES_TO_NATIONAL(CHIMECHO),
|
||||
};
|
||||
|
||||
const u16 gHoennToNationalOrder[] = // Assigns Hoenn Dex Pokémon (Using National Dex Index)
|
||||
// Assigns all Hoenn Dex Indexes to a National Dex Index
|
||||
static const u16 sHoennToNationalOrder[NUM_SPECIES - 1] =
|
||||
{
|
||||
HOENN_TO_NATIONAL(TREECKO),
|
||||
HOENN_TO_NATIONAL(GROVYLE),
|
||||
@ -1389,7 +1390,7 @@ const s8 gNatureStatTable[NUM_NATURES][NUM_NATURE_STATS] =
|
||||
|
||||
// SPECIES_NONE are ignored in the following two tables, so decrement before accessing these arrays to get the right result
|
||||
|
||||
static const u8 sMonFrontAnimIdsTable[] =
|
||||
static const u8 sMonFrontAnimIdsTable[NUM_SPECIES - 1] =
|
||||
{
|
||||
[SPECIES_BULBASAUR - 1] = ANIM_V_JUMPS_H_JUMPS,
|
||||
[SPECIES_IVYSAUR - 1] = ANIM_V_STRETCH,
|
||||
@ -1838,9 +1839,19 @@ static const u8 sMonAnimationDelayTable[NUM_SPECIES - 1] =
|
||||
[SPECIES_RAYQUAZA - 1] = 60,
|
||||
};
|
||||
|
||||
const u8 gPPUpGetMask[] = {0x03, 0x0c, 0x30, 0xc0}; // Masks for getting PP Up count, also PP Max values
|
||||
const u8 gPPUpSetMask[] = {0xfc, 0xf3, 0xcf, 0x3f}; // Masks for setting PP Up count
|
||||
const u8 gPPUpAddMask[] = {0x01, 0x04, 0x10, 0x40}; // Values added to PP Up count
|
||||
#define PP_UP_SHIFTS(val) val, (val) << 2, (val) << 4, (val) << 6
|
||||
#define PP_UP_SHIFTS_INV(val) (u8)~(val), (u8)~((val) << 2), (u8)~((val) << 4), (u8)~((val) << 6)
|
||||
|
||||
// PP Up bonuses are stored for a Pokémon as a single byte.
|
||||
// There are 2 bits (a value 0-3) for each move slot that
|
||||
// represent how many PP Ups have been applied.
|
||||
// The following arrays take a move slot id and return:
|
||||
// gPPUpGetMask - A mask to get the number of PP Ups applied to that move slot
|
||||
// gPPUpClearMask - A mask to clear the number of PP Ups applied to that move slot
|
||||
// gPPUpAddValues - A value to add to the PP Bonuses byte to apply 1 PP Up to that move slot
|
||||
const u8 gPPUpGetMask[MAX_MON_MOVES] = {PP_UP_SHIFTS(3)};
|
||||
const u8 gPPUpClearMask[MAX_MON_MOVES] = {PP_UP_SHIFTS_INV(3)};
|
||||
const u8 gPPUpAddValues[MAX_MON_MOVES] = {PP_UP_SHIFTS(1)};
|
||||
|
||||
const u8 gStatStageRatios[MAX_STAT_STAGE + 1][2] =
|
||||
{
|
||||
@ -2028,10 +2039,23 @@ static const struct SpriteTemplate sTrainerBackSpriteTemplates[] =
|
||||
},
|
||||
};
|
||||
|
||||
static const u8 sSecretBaseFacilityClasses[2][5] =
|
||||
#define NUM_SECRET_BASE_CLASSES 5
|
||||
static const u8 sSecretBaseFacilityClasses[GENDER_COUNT][NUM_SECRET_BASE_CLASSES] =
|
||||
{
|
||||
{FACILITY_CLASS_YOUNGSTER, FACILITY_CLASS_BUG_CATCHER, FACILITY_CLASS_RICH_BOY, FACILITY_CLASS_CAMPER, FACILITY_CLASS_COOLTRAINER_M},
|
||||
{FACILITY_CLASS_LASS, FACILITY_CLASS_SCHOOL_KID_F, FACILITY_CLASS_LADY, FACILITY_CLASS_PICNICKER, FACILITY_CLASS_COOLTRAINER_F}
|
||||
[MALE] = {
|
||||
FACILITY_CLASS_YOUNGSTER,
|
||||
FACILITY_CLASS_BUG_CATCHER,
|
||||
FACILITY_CLASS_RICH_BOY,
|
||||
FACILITY_CLASS_CAMPER,
|
||||
FACILITY_CLASS_COOLTRAINER_M
|
||||
},
|
||||
[FEMALE] = {
|
||||
FACILITY_CLASS_LASS,
|
||||
FACILITY_CLASS_SCHOOL_KID_F,
|
||||
FACILITY_CLASS_LADY,
|
||||
FACILITY_CLASS_PICNICKER,
|
||||
FACILITY_CLASS_COOLTRAINER_F
|
||||
}
|
||||
};
|
||||
|
||||
static const u8 sGetMonDataEVConstants[] =
|
||||
@ -2112,7 +2136,6 @@ static const struct SpriteTemplate sSpriteTemplate_64x64 =
|
||||
.callback = SpriteCallbackDummy,
|
||||
};
|
||||
|
||||
// code
|
||||
void ZeroBoxMonData(struct BoxPokemon *boxMon)
|
||||
{
|
||||
u8 *raw = (u8 *)boxMon;
|
||||
@ -2135,7 +2158,7 @@ void ZeroMonData(struct Pokemon *mon)
|
||||
SetMonData(mon, MON_DATA_SPEED, &arg);
|
||||
SetMonData(mon, MON_DATA_SPATK, &arg);
|
||||
SetMonData(mon, MON_DATA_SPDEF, &arg);
|
||||
arg = 255;
|
||||
arg = MAIL_NONE;
|
||||
SetMonData(mon, MON_DATA_MAIL, &arg);
|
||||
}
|
||||
|
||||
@ -2155,12 +2178,12 @@ void ZeroEnemyPartyMons(void)
|
||||
|
||||
void CreateMon(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 hasFixedPersonality, u32 fixedPersonality, u8 otIdType, u32 fixedOtId)
|
||||
{
|
||||
u32 arg;
|
||||
u32 mail;
|
||||
ZeroMonData(mon);
|
||||
CreateBoxMon(&mon->box, species, level, fixedIV, hasFixedPersonality, fixedPersonality, otIdType, fixedOtId);
|
||||
SetMonData(mon, MON_DATA_LEVEL, &level);
|
||||
arg = 255;
|
||||
SetMonData(mon, MON_DATA_MAIL, &arg);
|
||||
mail = MAIL_NONE;
|
||||
SetMonData(mon, MON_DATA_MAIL, &mail);
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
@ -2181,16 +2204,17 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
|
||||
SetBoxMonData(boxMon, MON_DATA_PERSONALITY, &personality);
|
||||
|
||||
// Determine original trainer ID
|
||||
if (otIdType == OT_ID_RANDOM_NO_SHINY) //Pokemon cannot be shiny
|
||||
if (otIdType == OT_ID_RANDOM_NO_SHINY)
|
||||
{
|
||||
u32 shinyValue;
|
||||
do
|
||||
{
|
||||
// Choose random OT IDs until one that results in a non-shiny Pokémon
|
||||
value = Random32();
|
||||
shinyValue = HIHALF(value) ^ LOHALF(value) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
shinyValue = GET_SHINY_VALUE(value, personality);
|
||||
} while (shinyValue < SHINY_ODDS);
|
||||
}
|
||||
else if (otIdType == OT_ID_PRESET) //Pokemon has a preset OT ID
|
||||
else if (otIdType == OT_ID_PRESET)
|
||||
{
|
||||
value = fixedOtId;
|
||||
}
|
||||
@ -2272,7 +2296,7 @@ void CreateMonWithNature(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV,
|
||||
}
|
||||
while (nature != GetNatureFromPersonality(personality));
|
||||
|
||||
CreateMon(mon, species, level, fixedIV, 1, personality, OT_ID_PLAYER_ID, 0);
|
||||
CreateMon(mon, species, level, fixedIV, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
}
|
||||
|
||||
void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level, u8 fixedIV, u8 gender, u8 nature, u8 unownLetter)
|
||||
@ -2302,7 +2326,7 @@ void CreateMonWithGenderNatureLetter(struct Pokemon *mon, u16 species, u8 level,
|
||||
|| gender != GetGenderFromSpeciesAndPersonality(species, personality));
|
||||
}
|
||||
|
||||
CreateMon(mon, species, level, fixedIV, 1, personality, OT_ID_PLAYER_ID, 0);
|
||||
CreateMon(mon, species, level, fixedIV, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
}
|
||||
|
||||
// This is only used to create Wally's Ralts.
|
||||
@ -2317,25 +2341,25 @@ void CreateMaleMon(struct Pokemon *mon, u16 species, u8 level)
|
||||
personality = Random32();
|
||||
}
|
||||
while (GetGenderFromSpeciesAndPersonality(species, personality) != MON_MALE);
|
||||
CreateMon(mon, species, level, USE_RANDOM_IVS, 1, personality, OT_ID_PRESET, otId);
|
||||
CreateMon(mon, species, level, USE_RANDOM_IVS, TRUE, personality, OT_ID_PRESET, otId);
|
||||
}
|
||||
|
||||
void CreateMonWithIVsPersonality(struct Pokemon *mon, u16 species, u8 level, u32 ivs, u32 personality)
|
||||
{
|
||||
CreateMon(mon, species, level, 0, 1, personality, OT_ID_PLAYER_ID, 0);
|
||||
CreateMon(mon, species, level, 0, TRUE, personality, OT_ID_PLAYER_ID, 0);
|
||||
SetMonData(mon, MON_DATA_IVS, &ivs);
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
void CreateMonWithIVsOTID(struct Pokemon *mon, u16 species, u8 level, u8 *ivs, u32 otId)
|
||||
{
|
||||
CreateMon(mon, species, level, 0, 0, 0, OT_ID_PRESET, otId);
|
||||
SetMonData(mon, MON_DATA_HP_IV, &ivs[0]);
|
||||
SetMonData(mon, MON_DATA_ATK_IV, &ivs[1]);
|
||||
SetMonData(mon, MON_DATA_DEF_IV, &ivs[2]);
|
||||
SetMonData(mon, MON_DATA_SPEED_IV, &ivs[3]);
|
||||
SetMonData(mon, MON_DATA_SPATK_IV, &ivs[4]);
|
||||
SetMonData(mon, MON_DATA_SPDEF_IV, &ivs[5]);
|
||||
CreateMon(mon, species, level, 0, FALSE, 0, OT_ID_PRESET, otId);
|
||||
SetMonData(mon, MON_DATA_HP_IV, &ivs[STAT_HP]);
|
||||
SetMonData(mon, MON_DATA_ATK_IV, &ivs[STAT_ATK]);
|
||||
SetMonData(mon, MON_DATA_DEF_IV, &ivs[STAT_DEF]);
|
||||
SetMonData(mon, MON_DATA_SPEED_IV, &ivs[STAT_SPEED]);
|
||||
SetMonData(mon, MON_DATA_SPATK_IV, &ivs[STAT_SPATK]);
|
||||
SetMonData(mon, MON_DATA_SPDEF_IV, &ivs[STAT_SPDEF]);
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
@ -2346,7 +2370,7 @@ void CreateMonWithEVSpread(struct Pokemon *mon, u16 species, u8 level, u8 fixedI
|
||||
u16 evAmount;
|
||||
u8 evsBits;
|
||||
|
||||
CreateMon(mon, species, level, fixedIV, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
CreateMon(mon, species, level, fixedIV, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
|
||||
evsBits = evSpread;
|
||||
|
||||
@ -2378,7 +2402,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
|
||||
u8 language;
|
||||
u8 value;
|
||||
|
||||
CreateMon(mon, src->species, src->level, 0, 1, src->personality, OT_ID_PRESET, src->otId);
|
||||
CreateMon(mon, src->species, src->level, 0, TRUE, src->personality, OT_ID_PRESET, src->otId);
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(mon, src->moves[i], i);
|
||||
@ -2425,7 +2449,7 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
|
||||
CalculateMonStats(mon);
|
||||
}
|
||||
|
||||
void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50)
|
||||
void CreateBattleTowerMon_HandleLevel(struct Pokemon *mon, struct BattleTowerPokemon *src, bool8 lvl50)
|
||||
{
|
||||
s32 i;
|
||||
u8 nickname[30];
|
||||
@ -2440,7 +2464,7 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src,
|
||||
else
|
||||
level = src->level;
|
||||
|
||||
CreateMon(mon, src->species, level, 0, 1, src->personality, OT_ID_PRESET, src->otId);
|
||||
CreateMon(mon, src->species, level, 0, TRUE, src->personality, OT_ID_PRESET, src->otId);
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
SetMonMoveSlot(mon, src->moves[i], i);
|
||||
@ -2737,7 +2761,7 @@ void CreateEventLegalEnemyMon(void)
|
||||
s32 itemId = gSpecialVar_0x8006;
|
||||
|
||||
ZeroEnemyPartyMons();
|
||||
CreateEventLegalMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, 0, 0, 0, 0);
|
||||
CreateEventLegalMon(&gEnemyParty[0], species, level, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
if (itemId)
|
||||
{
|
||||
u8 heldItem[2];
|
||||
@ -2756,16 +2780,16 @@ static u16 CalculateBoxMonChecksum(struct BoxPokemon *boxMon)
|
||||
union PokemonSubstruct *substruct3 = GetSubstruct(boxMon, boxMon->personality, 3);
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(substruct0->raw); i++)
|
||||
checksum += substruct0->raw[i];
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(substruct1->raw); i++)
|
||||
checksum += substruct1->raw[i];
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(substruct2->raw); i++)
|
||||
checksum += substruct2->raw[i];
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (i = 0; i < (s32)ARRAY_COUNT(substruct3->raw); i++)
|
||||
checksum += substruct3->raw[i];
|
||||
|
||||
return checksum;
|
||||
@ -2857,7 +2881,7 @@ void BoxMonToMon(const struct BoxPokemon *src, struct Pokemon *dest)
|
||||
SetMonData(dest, MON_DATA_STATUS, &value);
|
||||
SetMonData(dest, MON_DATA_HP, &value);
|
||||
SetMonData(dest, MON_DATA_MAX_HP, &value);
|
||||
value = 255;
|
||||
value = MAIL_NONE;
|
||||
SetMonData(dest, MON_DATA_MAIL, &value);
|
||||
CalculateMonStats(dest);
|
||||
}
|
||||
@ -2915,7 +2939,7 @@ u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
if (!mon->moves[i])
|
||||
if (mon->moves[i] == MOVE_NONE)
|
||||
{
|
||||
mon->moves[i] = move;
|
||||
mon->pp[i] = gBattleMoves[move].pp;
|
||||
@ -2923,7 +2947,7 @@ u16 GiveMoveToBattleMon(struct BattlePokemon *mon, u16 move)
|
||||
}
|
||||
}
|
||||
|
||||
return 0xFFFF;
|
||||
return MON_HAS_MAX_MOVES;
|
||||
}
|
||||
|
||||
void SetMonMoveSlot(struct Pokemon *mon, u16 move, u8 slot)
|
||||
@ -3013,8 +3037,8 @@ void DeleteFirstMoveAndGiveMoveToMon(struct Pokemon *mon, u16 move)
|
||||
|
||||
ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
||||
ppBonuses >>= 2;
|
||||
moves[3] = move;
|
||||
pp[3] = gBattleMoves[move].pp;
|
||||
moves[MAX_MON_MOVES - 1] = move;
|
||||
pp[MAX_MON_MOVES - 1] = gBattleMoves[move].pp;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
@ -3040,8 +3064,8 @@ void DeleteFirstMoveAndGiveMoveToBoxMon(struct BoxPokemon *boxMon, u16 move)
|
||||
|
||||
ppBonuses = GetBoxMonData(boxMon, MON_DATA_PP_BONUSES, NULL);
|
||||
ppBonuses >>= 2;
|
||||
moves[3] = move;
|
||||
pp[3] = gBattleMoves[move].pp;
|
||||
moves[MAX_MON_MOVES - 1] = move;
|
||||
pp[MAX_MON_MOVES - 1] = gBattleMoves[move].pp;
|
||||
|
||||
for (i = 0; i < MAX_MON_MOVES; i++)
|
||||
{
|
||||
@ -3086,6 +3110,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
spAttack = attacker->spAttack;
|
||||
spDefense = defender->spDefense;
|
||||
|
||||
// Get attacker hold item info
|
||||
if (attacker->item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
attackerHoldEffect = gEnigmaBerries[battlerIdAtk].holdEffect;
|
||||
@ -3097,6 +3122,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
attackerHoldEffectParam = ItemId_GetHoldEffectParam(attacker->item);
|
||||
}
|
||||
|
||||
// Get defender hold item info
|
||||
if (defender->item == ITEM_ENIGMA_BERRY)
|
||||
{
|
||||
defenderHoldEffect = gEnigmaBerries[battlerIdDef].holdEffect;
|
||||
@ -3120,6 +3146,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
if (ShouldGetStatBadgeBoost(FLAG_BADGE07_GET, battlerIdDef))
|
||||
spDefense = (110 * spDefense) / 100;
|
||||
|
||||
// Apply type-bonus hold item
|
||||
for (i = 0; i < ARRAY_COUNT(sHoldEffectToType); i++)
|
||||
{
|
||||
if (attackerHoldEffect == sHoldEffectToType[i][0]
|
||||
@ -3133,6 +3160,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
}
|
||||
}
|
||||
|
||||
// Apply boosts from hold items
|
||||
if (attackerHoldEffect == HOLD_EFFECT_CHOICE_BAND)
|
||||
attack = (150 * attack) / 100;
|
||||
if (attackerHoldEffect == HOLD_EFFECT_SOUL_DEW && !(gBattleTypeFlags & (BATTLE_TYPE_FRONTIER)) && (attacker->species == SPECIES_LATIAS || attacker->species == SPECIES_LATIOS))
|
||||
@ -3149,6 +3177,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
defense *= 2;
|
||||
if (attackerHoldEffect == HOLD_EFFECT_THICK_CLUB && (attacker->species == SPECIES_CUBONE || attacker->species == SPECIES_MAROWAK))
|
||||
attack *= 2;
|
||||
|
||||
// Apply abilities / field sports
|
||||
if (defender->ability == ABILITY_THICK_FAT && (type == TYPE_FIRE || type == TYPE_ICE))
|
||||
spAttack /= 2;
|
||||
if (attacker->ability == ABILITY_HUSTLE)
|
||||
@ -3161,9 +3191,9 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
attack = (150 * attack) / 100;
|
||||
if (defender->ability == ABILITY_MARVEL_SCALE && defender->status1)
|
||||
defense = (150 * defense) / 100;
|
||||
if (type == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, 0xFD, 0))
|
||||
if (type == TYPE_ELECTRIC && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_MUD_SPORT, 0))
|
||||
gBattleMovePower /= 2;
|
||||
if (type == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, 0xFE, 0))
|
||||
if (type == TYPE_FIRE && AbilityBattleEffects(ABILITYEFFECT_FIELD_SPORT, 0, 0, ABILITYEFFECT_WATER_SPORT, 0))
|
||||
gBattleMovePower /= 2;
|
||||
if (type == TYPE_GRASS && attacker->ability == ABILITY_OVERGROW && attacker->hp <= (attacker->maxHP / 3))
|
||||
gBattleMovePower = (150 * gBattleMovePower) / 100;
|
||||
@ -3173,6 +3203,8 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
gBattleMovePower = (150 * gBattleMovePower) / 100;
|
||||
if (type == TYPE_BUG && attacker->ability == ABILITY_SWARM && attacker->hp <= (attacker->maxHP / 3))
|
||||
gBattleMovePower = (150 * gBattleMovePower) / 100;
|
||||
|
||||
// Self-destruct / Explosion cut defense in half
|
||||
if (gBattleMoves[gCurrentMove].effect == EFFECT_EXPLOSION)
|
||||
defense /= 2;
|
||||
|
||||
@ -3180,6 +3212,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
// Critical hit, if attacker has lost attack stat stages then ignore stat drop
|
||||
if (attacker->statStages[STAT_ATK] > DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damage, attacker, attack, STAT_ATK)
|
||||
else
|
||||
@ -3193,6 +3226,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
// Critical hit, if defender has gained defense stat stages then ignore stat increase
|
||||
if (defender->statStages[STAT_DEF] < DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damageHelper, defender, defense, STAT_DEF)
|
||||
else
|
||||
@ -3204,9 +3238,11 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage = damage / damageHelper;
|
||||
damage /= 50;
|
||||
|
||||
// Burn cuts attack in half
|
||||
if ((attacker->status1 & STATUS1_BURN) && attacker->ability != ABILITY_GUTS)
|
||||
damage /= 2;
|
||||
|
||||
// Apply Reflect
|
||||
if ((sideStatus & SIDE_STATUS_REFLECT) && gCritMultiplier == 1)
|
||||
{
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
|
||||
@ -3215,10 +3251,11 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage /= 2;
|
||||
}
|
||||
|
||||
// Moves hitting both targets do half damage in double battles
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
|
||||
damage /= 2;
|
||||
|
||||
// moves always do at least 1 damage.
|
||||
// Moves always do at least 1 damage.
|
||||
if (damage == 0)
|
||||
damage = 1;
|
||||
}
|
||||
@ -3230,6 +3267,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
{
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
// Critical hit, if attacker has lost sp. attack stat stages then ignore stat drop
|
||||
if (attacker->statStages[STAT_SPATK] > DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damage, attacker, spAttack, STAT_SPATK)
|
||||
else
|
||||
@ -3243,6 +3281,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
|
||||
if (gCritMultiplier == 2)
|
||||
{
|
||||
// Critical hit, if defender has gained sp. defense stat stages then ignore stat increase
|
||||
if (defender->statStages[STAT_SPDEF] < DEFAULT_STAT_STAGE)
|
||||
APPLY_STAT_MOD(damageHelper, defender, spDefense, STAT_SPDEF)
|
||||
else
|
||||
@ -3254,6 +3293,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage = (damage / damageHelper);
|
||||
damage /= 50;
|
||||
|
||||
// Apply Lightscreen
|
||||
if ((sideStatus & SIDE_STATUS_LIGHTSCREEN) && gCritMultiplier == 1)
|
||||
{
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
|
||||
@ -3262,12 +3302,14 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
damage /= 2;
|
||||
}
|
||||
|
||||
// Moves hitting both targets do half damage in double battles
|
||||
if ((gBattleTypeFlags & BATTLE_TYPE_DOUBLE) && gBattleMoves[move].target == MOVE_TARGET_BOTH && CountAliveMonsInBattle(BATTLE_ALIVE_DEF_SIDE) == 2)
|
||||
damage /= 2;
|
||||
|
||||
// are effects of weather negated with cloud nine or air lock
|
||||
// Are effects of weather negated with cloud nine or air lock
|
||||
if (WEATHER_HAS_EFFECT2)
|
||||
{
|
||||
// Rain weakens Fire, boosts Water
|
||||
if (gBattleWeather & B_WEATHER_RAIN_TEMPORARY)
|
||||
{
|
||||
switch (type)
|
||||
@ -3281,11 +3323,11 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
}
|
||||
}
|
||||
|
||||
// any weather except sun weakens solar beam
|
||||
// Any weather except sun weakens solar beam
|
||||
if ((gBattleWeather & (B_WEATHER_RAIN | B_WEATHER_SANDSTORM | B_WEATHER_HAIL)) && gCurrentMove == MOVE_SOLAR_BEAM)
|
||||
damage /= 2;
|
||||
|
||||
// sunny
|
||||
// Sun boosts Fire, weakens Water
|
||||
if (gBattleWeather & B_WEATHER_SUN)
|
||||
{
|
||||
switch (type)
|
||||
@ -3300,7 +3342,7 @@ s32 CalculateBaseDamage(struct BattlePokemon *attacker, struct BattlePokemon *de
|
||||
}
|
||||
}
|
||||
|
||||
// flash fire triggered
|
||||
// Flash fire triggered
|
||||
if ((gBattleResources->flags->flags[battlerIdAtk] & RESOURCE_FLAG_FLASH_FIRE) && type == TYPE_FIRE)
|
||||
damage = (15 * damage) / 10;
|
||||
}
|
||||
@ -3441,13 +3483,13 @@ void SetMultiuseSpriteTemplateToPokemon(u16 speciesTag, u8 battlerPosition)
|
||||
gMultiuseSpriteTemplate.anims = gMonFrontAnimsPtrTable[speciesTag];
|
||||
}
|
||||
|
||||
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosition)
|
||||
void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerPicId, u8 battlerPosition)
|
||||
{
|
||||
gMultiuseSpriteTemplate.paletteTag = trainerSpriteId;
|
||||
gMultiuseSpriteTemplate.paletteTag = trainerPicId;
|
||||
if (battlerPosition == B_POSITION_PLAYER_LEFT || battlerPosition == B_POSITION_PLAYER_RIGHT)
|
||||
{
|
||||
gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerSpriteId];
|
||||
gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerSpriteId];
|
||||
gMultiuseSpriteTemplate = sTrainerBackSpriteTemplates[trainerPicId];
|
||||
gMultiuseSpriteTemplate.anims = gTrainerBackAnimsPtrTable[trainerPicId];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3455,25 +3497,25 @@ void SetMultiuseSpriteTemplateToTrainerBack(u16 trainerSpriteId, u8 battlerPosit
|
||||
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
|
||||
else
|
||||
gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition];
|
||||
gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerSpriteId];
|
||||
gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerPicId];
|
||||
}
|
||||
}
|
||||
|
||||
void SetMultiuseSpriteTemplateToTrainerFront(u16 arg0, u8 battlerPosition)
|
||||
void SetMultiuseSpriteTemplateToTrainerFront(u16 trainerPicId, u8 battlerPosition)
|
||||
{
|
||||
if (gMonSpritesGfxPtr != NULL)
|
||||
gMultiuseSpriteTemplate = gMonSpritesGfxPtr->templates[battlerPosition];
|
||||
else
|
||||
gMultiuseSpriteTemplate = gBattlerSpriteTemplates[battlerPosition];
|
||||
|
||||
gMultiuseSpriteTemplate.paletteTag = arg0;
|
||||
gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[arg0];
|
||||
gMultiuseSpriteTemplate.paletteTag = trainerPicId;
|
||||
gMultiuseSpriteTemplate.anims = gTrainerFrontAnimsPtrTable[trainerPicId];
|
||||
}
|
||||
|
||||
static void EncryptBoxMon(struct BoxPokemon *boxMon)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < 12; i++)
|
||||
for (i = 0; i < ARRAY_COUNT(boxMon->secure.raw); i++)
|
||||
{
|
||||
boxMon->secure.raw[i] ^= boxMon->personality;
|
||||
boxMon->secure.raw[i] ^= boxMon->otId;
|
||||
@ -3483,7 +3525,7 @@ static void EncryptBoxMon(struct BoxPokemon *boxMon)
|
||||
static void DecryptBoxMon(struct BoxPokemon *boxMon)
|
||||
{
|
||||
u32 i;
|
||||
for (i = 0; i < 12; i++)
|
||||
for (i = 0; i < ARRAY_COUNT(boxMon->secure.raw); i++)
|
||||
{
|
||||
boxMon->secure.raw[i] ^= boxMon->otId;
|
||||
boxMon->secure.raw[i] ^= boxMon->personality;
|
||||
@ -3661,9 +3703,9 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
|
||||
if (CalculateBoxMonChecksum(boxMon) != boxMon->checksum)
|
||||
{
|
||||
boxMon->isBadEgg = 1;
|
||||
boxMon->isEgg = 1;
|
||||
substruct3->isEgg = 1;
|
||||
boxMon->isBadEgg = TRUE;
|
||||
boxMon->isEgg = TRUE;
|
||||
substruct3->isEgg = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3915,7 +3957,12 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
|
||||
retVal = SPECIES_EGG;
|
||||
break;
|
||||
case MON_DATA_IVS:
|
||||
retVal = substruct3->hpIV | (substruct3->attackIV << 5) | (substruct3->defenseIV << 10) | (substruct3->speedIV << 15) | (substruct3->spAttackIV << 20) | (substruct3->spDefenseIV << 25);
|
||||
retVal = substruct3->hpIV
|
||||
| (substruct3->attackIV << 5)
|
||||
| (substruct3->defenseIV << 10)
|
||||
| (substruct3->speedIV << 15)
|
||||
| (substruct3->spAttackIV << 20)
|
||||
| (substruct3->spDefenseIV << 25);
|
||||
break;
|
||||
case MON_DATA_KNOWN_MOVES:
|
||||
if (substruct0->species && !substruct3->isEgg)
|
||||
@ -4059,9 +4106,9 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
|
||||
|
||||
if (CalculateBoxMonChecksum(boxMon) != boxMon->checksum)
|
||||
{
|
||||
boxMon->isBadEgg = 1;
|
||||
boxMon->isEgg = 1;
|
||||
substruct3->isEgg = 1;
|
||||
boxMon->isBadEgg = TRUE;
|
||||
boxMon->isEgg = TRUE;
|
||||
substruct3->isEgg = TRUE;
|
||||
EncryptBoxMon(boxMon);
|
||||
return;
|
||||
}
|
||||
@ -4114,9 +4161,9 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
|
||||
{
|
||||
SET16(substruct0->species);
|
||||
if (substruct0->species)
|
||||
boxMon->hasSpecies = 1;
|
||||
boxMon->hasSpecies = TRUE;
|
||||
else
|
||||
boxMon->hasSpecies = 0;
|
||||
boxMon->hasSpecies = FALSE;
|
||||
break;
|
||||
}
|
||||
case MON_DATA_HELD_ITEM:
|
||||
@ -4224,9 +4271,9 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
|
||||
case MON_DATA_IS_EGG:
|
||||
SET8(substruct3->isEgg);
|
||||
if (substruct3->isEgg)
|
||||
boxMon->isEgg = 1;
|
||||
boxMon->isEgg = TRUE;
|
||||
else
|
||||
boxMon->isEgg = 0;
|
||||
boxMon->isEgg = FALSE;
|
||||
break;
|
||||
case MON_DATA_ABILITY_NUM:
|
||||
SET8(substruct3->abilityNum);
|
||||
@ -4337,7 +4384,7 @@ u8 GiveMonToPlayer(struct Pokemon *mon)
|
||||
return MON_GIVEN_TO_PARTY;
|
||||
}
|
||||
|
||||
u8 SendMonToPC(struct Pokemon* mon)
|
||||
static u8 SendMonToPC(struct Pokemon* mon)
|
||||
{
|
||||
s32 boxNo, boxPos;
|
||||
|
||||
@ -4468,7 +4515,7 @@ void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
|
||||
gBattleResources->secretBase->party.species[i],
|
||||
gBattleResources->secretBase->party.levels[i],
|
||||
15,
|
||||
1,
|
||||
TRUE,
|
||||
gBattleResources->secretBase->party.personality[i],
|
||||
OT_ID_RANDOM_NO_SHINY,
|
||||
0);
|
||||
@ -4489,13 +4536,13 @@ void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
|
||||
|
||||
u8 GetSecretBaseTrainerPicIndex(void)
|
||||
{
|
||||
u8 facilityClass = sSecretBaseFacilityClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
|
||||
u8 facilityClass = sSecretBaseFacilityClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % NUM_SECRET_BASE_CLASSES];
|
||||
return gFacilityClassToPicIndex[facilityClass];
|
||||
}
|
||||
|
||||
u8 GetSecretBaseTrainerClass(void)
|
||||
{
|
||||
u8 facilityClass = sSecretBaseFacilityClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % 5];
|
||||
u8 facilityClass = sSecretBaseFacilityClasses[gBattleResources->secretBase->gender][gBattleResources->secretBase->trainerId[0] % NUM_SECRET_BASE_CLASSES];
|
||||
return gFacilityClassToTrainerClass[facilityClass];
|
||||
}
|
||||
|
||||
@ -4529,7 +4576,7 @@ void GetSpeciesName(u8 *name, u16 species)
|
||||
for (i = 0; i <= POKEMON_NAME_LENGTH; i++)
|
||||
{
|
||||
if (species > NUM_SPECIES)
|
||||
name[i] = gSpeciesNames[0][i];
|
||||
name[i] = gSpeciesNames[SPECIES_NONE][i];
|
||||
else
|
||||
name[i] = gSpeciesNames[species][i];
|
||||
|
||||
@ -4549,13 +4596,13 @@ u8 CalculatePPWithBonus(u16 move, u8 ppBonuses, u8 moveIndex)
|
||||
void RemoveMonPPBonus(struct Pokemon *mon, u8 moveIndex)
|
||||
{
|
||||
u8 ppBonuses = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
||||
ppBonuses &= gPPUpSetMask[moveIndex];
|
||||
ppBonuses &= gPPUpClearMask[moveIndex];
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &ppBonuses);
|
||||
}
|
||||
|
||||
void RemoveBattleMonPPBonus(struct BattlePokemon *mon, u8 moveIndex)
|
||||
{
|
||||
mon->ppBonuses &= gPPUpSetMask[moveIndex];
|
||||
mon->ppBonuses &= gPPUpClearMask[moveIndex];
|
||||
}
|
||||
|
||||
void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
|
||||
@ -4618,7 +4665,7 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
|
||||
return PokemonUseItemEffects(mon, item, partyIndex, moveIndex, FALSE);
|
||||
}
|
||||
|
||||
#define UPDATE_FRIENDSHIP_FROM_ITEM \
|
||||
#define UPDATE_FRIENDSHIP_FROM_ITEM() \
|
||||
{ \
|
||||
if ((retVal == 0 || friendshipOnly) && !ShouldSkipFriendshipChange() && friendshipChange == 0) \
|
||||
{ \
|
||||
@ -4855,7 +4902,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
temp1 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
|
||||
if (dataUnsigned <= 2 && temp1 > 4)
|
||||
{
|
||||
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddMask[moveIndex];
|
||||
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL) + gPPUpAddValues[moveIndex];
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
||||
|
||||
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp1;
|
||||
@ -5152,11 +5199,13 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
case 4: // ITEM5_PP_MAX
|
||||
dataUnsigned = (GetMonData(mon, MON_DATA_PP_BONUSES, NULL) & gPPUpGetMask[moveIndex]) >> (moveIndex * 2);
|
||||
temp2 = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), GetMonData(mon, MON_DATA_PP_BONUSES, NULL), moveIndex);
|
||||
if (dataUnsigned < 3 && temp2 > 4)
|
||||
|
||||
// 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)
|
||||
{
|
||||
dataUnsigned = GetMonData(mon, MON_DATA_PP_BONUSES, NULL);
|
||||
dataUnsigned &= gPPUpSetMask[moveIndex];
|
||||
dataUnsigned += gPPUpAddMask[moveIndex] * 3;
|
||||
dataUnsigned &= gPPUpClearMask[moveIndex];
|
||||
dataUnsigned += gPPUpAddValues[moveIndex] * 3; // Apply 3 PP Ups (max)
|
||||
|
||||
SetMonData(mon, MON_DATA_PP_BONUSES, &dataUnsigned);
|
||||
dataUnsigned = CalculatePPWithBonus(GetMonData(mon, MON_DATA_MOVE1 + moveIndex, NULL), dataUnsigned, moveIndex) - temp2;
|
||||
@ -5172,25 +5221,19 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
// In general, Pokémon with lower friendship receive more,
|
||||
// and Pokémon with higher friendship receive less.
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 100)
|
||||
{
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM;
|
||||
}
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||
itemEffectParam++;
|
||||
break;
|
||||
|
||||
case 6: // ITEM5_FRIENDSHIP_MID
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 100 && GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) < 200)
|
||||
{
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM;
|
||||
}
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||
itemEffectParam++;
|
||||
break;
|
||||
|
||||
case 7: // ITEM5_FRIENDSHIP_HIGH
|
||||
if (GetMonData(mon, MON_DATA_FRIENDSHIP, NULL) >= 200)
|
||||
{
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM;
|
||||
}
|
||||
UPDATE_FRIENDSHIP_FROM_ITEM();
|
||||
itemEffectParam++;
|
||||
break;
|
||||
}
|
||||
@ -5496,7 +5539,7 @@ u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 mode, u16 evolutionItem)
|
||||
case EVO_TRADE_ITEM:
|
||||
if (gEvolutionTable[species][i].param == heldItem)
|
||||
{
|
||||
heldItem = 0;
|
||||
heldItem = ITEM_NONE;
|
||||
SetMonData(mon, MON_DATA_HELD_ITEM, &heldItem);
|
||||
targetSpecies = gEvolutionTable[species][i].targetSpecies;
|
||||
}
|
||||
@ -5530,7 +5573,7 @@ u16 HoennPokedexNumToSpecies(u16 hoennNum)
|
||||
|
||||
species = 0;
|
||||
|
||||
while (species < (NUM_SPECIES - 1) && gSpeciesToHoennPokedexNum[species] != hoennNum)
|
||||
while (species < (NUM_SPECIES - 1) && sSpeciesToHoennPokedexNum[species] != hoennNum)
|
||||
species++;
|
||||
|
||||
if (species == NUM_SPECIES - 1)
|
||||
@ -5548,7 +5591,7 @@ u16 NationalPokedexNumToSpecies(u16 nationalNum)
|
||||
|
||||
species = 0;
|
||||
|
||||
while (species < (NUM_SPECIES - 1) && gSpeciesToNationalPokedexNum[species] != nationalNum)
|
||||
while (species < (NUM_SPECIES - 1) && sSpeciesToNationalPokedexNum[species] != nationalNum)
|
||||
species++;
|
||||
|
||||
if (species == NUM_SPECIES - 1)
|
||||
@ -5566,7 +5609,7 @@ u16 NationalToHoennOrder(u16 nationalNum)
|
||||
|
||||
hoennNum = 0;
|
||||
|
||||
while (hoennNum < (NUM_SPECIES - 1) && gHoennToNationalOrder[hoennNum] != nationalNum)
|
||||
while (hoennNum < (NUM_SPECIES - 1) && sHoennToNationalOrder[hoennNum] != nationalNum)
|
||||
hoennNum++;
|
||||
|
||||
if (hoennNum == NUM_SPECIES - 1)
|
||||
@ -5580,7 +5623,7 @@ u16 SpeciesToNationalPokedexNum(u16 species)
|
||||
if (!species)
|
||||
return 0;
|
||||
|
||||
return gSpeciesToNationalPokedexNum[species - 1];
|
||||
return sSpeciesToNationalPokedexNum[species - 1];
|
||||
}
|
||||
|
||||
u16 SpeciesToHoennPokedexNum(u16 species)
|
||||
@ -5588,7 +5631,7 @@ u16 SpeciesToHoennPokedexNum(u16 species)
|
||||
if (!species)
|
||||
return 0;
|
||||
|
||||
return gSpeciesToHoennPokedexNum[species - 1];
|
||||
return sSpeciesToHoennPokedexNum[species - 1];
|
||||
}
|
||||
|
||||
u16 HoennToNationalOrder(u16 hoennNum)
|
||||
@ -5596,7 +5639,7 @@ u16 HoennToNationalOrder(u16 hoennNum)
|
||||
if (!hoennNum)
|
||||
return 0;
|
||||
|
||||
return gHoennToNationalOrder[hoennNum - 1];
|
||||
return sHoennToNationalOrder[hoennNum - 1];
|
||||
}
|
||||
|
||||
u16 SpeciesToCryId(u16 species)
|
||||
@ -6278,7 +6321,7 @@ u16 GetBattleBGM(void)
|
||||
return MUS_VS_GYM_LEADER;
|
||||
case TRAINER_CLASS_CHAMPION:
|
||||
return MUS_VS_CHAMPION;
|
||||
case TRAINER_CLASS_PKMN_TRAINER_3:
|
||||
case TRAINER_CLASS_RIVAL:
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_FRONTIER)
|
||||
return MUS_VS_RIVAL;
|
||||
if (!StringCompare(gTrainers[gTrainerBattleOpponent_A].trainerName, gText_BattleWallyName))
|
||||
@ -6357,9 +6400,9 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, u32 otId, u32 p
|
||||
u32 shinyValue;
|
||||
|
||||
if (species > NUM_SPECIES)
|
||||
return gMonPaletteTable[0].data;
|
||||
return gMonPaletteTable[SPECIES_NONE].data;
|
||||
|
||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
shinyValue = GET_SHINY_VALUE(otId, personality);
|
||||
if (shinyValue < SHINY_ODDS)
|
||||
return gMonShinyPaletteTable[species].data;
|
||||
else
|
||||
@ -6378,7 +6421,7 @@ const struct CompressedSpritePalette *GetMonSpritePalStructFromOtIdPersonality(u
|
||||
{
|
||||
u32 shinyValue;
|
||||
|
||||
shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
shinyValue = GET_SHINY_VALUE(otId, personality);
|
||||
if (shinyValue < SHINY_ODDS)
|
||||
return &gMonShinyPaletteTable[species];
|
||||
else
|
||||
@ -6431,7 +6474,6 @@ bool8 IsOtherTrainer(u32 otId, u8 *otName)
|
||||
| (gSaveBlock2Ptr->playerTrainerId[3] << 24)))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; otName[i] != EOS; i++)
|
||||
if (otName[i] != gSaveBlock2Ptr->playerName[i])
|
||||
return TRUE;
|
||||
@ -6496,28 +6538,30 @@ void SetWildMonHeldItem(void)
|
||||
{
|
||||
u16 rnd = Random() % 100;
|
||||
u16 species = GetMonData(&gEnemyParty[0], MON_DATA_SPECIES, 0);
|
||||
u16 var1 = 45;
|
||||
u16 var2 = 95;
|
||||
u16 chanceNoItem = 45;
|
||||
u16 chanceCommon = 95;
|
||||
if (!GetMonData(&gPlayerParty[0], MON_DATA_SANITY_IS_EGG, 0)
|
||||
&& GetMonAbility(&gPlayerParty[0]) == ABILITY_COMPOUND_EYES)
|
||||
{
|
||||
var1 = 20;
|
||||
var2 = 80;
|
||||
chanceNoItem = 20;
|
||||
chanceCommon = 80;
|
||||
}
|
||||
if (gMapHeader.mapLayoutId == LAYOUT_ALTERING_CAVE)
|
||||
{
|
||||
s32 alteringCaveId = GetWildMonTableIdInAlteringCave(species);
|
||||
if (alteringCaveId != 0)
|
||||
{
|
||||
if (rnd < var2)
|
||||
// In active Altering Cave, use special item list
|
||||
if (rnd < chanceCommon)
|
||||
return;
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &sAlteringCaveWildMonHeldItems[alteringCaveId].item);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < var1)
|
||||
// In inactive Altering Cave, use normal items
|
||||
if (rnd < chanceNoItem)
|
||||
return;
|
||||
if (rnd < var2)
|
||||
if (rnd < chanceCommon)
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
@ -6525,15 +6569,16 @@ void SetWildMonHeldItem(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != 0)
|
||||
if (gBaseStats[species].item1 == gBaseStats[species].item2 && gBaseStats[species].item1 != ITEM_NONE)
|
||||
{
|
||||
// Both held items are the same, 100% chance to hold item
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (rnd < var1)
|
||||
if (rnd < chanceNoItem)
|
||||
return;
|
||||
if (rnd < var2)
|
||||
if (rnd < chanceCommon)
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item1);
|
||||
else
|
||||
SetMonData(&gEnemyParty[0], MON_DATA_HELD_ITEM, &gBaseStats[species].item2);
|
||||
@ -6552,7 +6597,7 @@ bool8 IsMonShiny(struct Pokemon *mon)
|
||||
bool8 IsShinyOtIdPersonality(u32 otId, u32 personality)
|
||||
{
|
||||
bool8 retVal = FALSE;
|
||||
u32 shinyValue = HIHALF(otId) ^ LOHALF(otId) ^ HIHALF(personality) ^ LOHALF(personality);
|
||||
u32 shinyValue = GET_SHINY_VALUE(otId, personality);
|
||||
if (shinyValue < SHINY_ODDS)
|
||||
retVal = TRUE;
|
||||
return retVal;
|
||||
@ -6590,37 +6635,40 @@ const u8 *GetTrainerPartnerName(void)
|
||||
gTasks[taskId].data[dataId + 1] = (u32)(ptr) >> 16; \
|
||||
}
|
||||
|
||||
#define sAnimId data[2]
|
||||
#define sAnimDelay data[3]
|
||||
|
||||
static void Task_AnimateAfterDelay(u8 taskId)
|
||||
{
|
||||
if (--gTasks[taskId].data[3] == 0)
|
||||
if (--gTasks[taskId].sAnimDelay == 0)
|
||||
{
|
||||
LaunchAnimationTaskForFrontSprite(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]);
|
||||
LaunchAnimationTaskForFrontSprite(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].sAnimId);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_PokemonSummaryAnimateAfterDelay(u8 taskId)
|
||||
{
|
||||
if (--gTasks[taskId].data[3] == 0)
|
||||
if (--gTasks[taskId].sAnimDelay == 0)
|
||||
{
|
||||
StartMonSummaryAnimation(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].data[2]);
|
||||
StartMonSummaryAnimation(READ_PTR_FROM_TASK(taskId, 0), gTasks[taskId].sAnimId);
|
||||
SummaryScreen_SetAnimDelayTaskId(TASK_NONE);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3)
|
||||
void BattleAnimateFrontSprite(struct Sprite* sprite, u16 species, bool8 noCry, u8 panMode)
|
||||
{
|
||||
if (gHitMarker & HITMARKER_NO_ANIMATIONS && !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_RECORDED_LINK)))
|
||||
DoMonFrontSpriteAnimation(sprite, species, noCry, arg3 | 0x80);
|
||||
DoMonFrontSpriteAnimation(sprite, species, noCry, panMode | SKIP_FRONT_ANIM);
|
||||
else
|
||||
DoMonFrontSpriteAnimation(sprite, species, noCry, arg3);
|
||||
DoMonFrontSpriteAnimation(sprite, species, noCry, panMode);
|
||||
}
|
||||
|
||||
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 arg3)
|
||||
void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry, u8 panModeAnimFlag)
|
||||
{
|
||||
s8 pan;
|
||||
switch (arg3 & 0x7F)
|
||||
switch (panModeAnimFlag & (u8)~SKIP_FRONT_ANIM) // Exclude anim flag to get pan mode
|
||||
{
|
||||
case 0:
|
||||
pan = -25;
|
||||
@ -6632,8 +6680,9 @@ void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry,
|
||||
pan = 0;
|
||||
break;
|
||||
}
|
||||
if (arg3 & 0x80)
|
||||
if (panModeAnimFlag & SKIP_FRONT_ANIM)
|
||||
{
|
||||
// No animation, only check if cry needs to be played
|
||||
if (!noCry)
|
||||
PlayCry1(species, pan);
|
||||
sprite->callback = SpriteCallbackDummy;
|
||||
@ -6648,13 +6697,15 @@ void DoMonFrontSpriteAnimation(struct Sprite* sprite, u16 species, bool8 noCry,
|
||||
}
|
||||
if (sMonAnimationDelayTable[species - 1] != 0)
|
||||
{
|
||||
// Animation has delay, start delay task
|
||||
u8 taskId = CreateTask(Task_AnimateAfterDelay, 0);
|
||||
STORE_PTR_IN_TASK(sprite, taskId, 0);
|
||||
gTasks[taskId].data[2] = sMonFrontAnimIdsTable[species - 1];
|
||||
gTasks[taskId].data[3] = sMonAnimationDelayTable[species - 1];
|
||||
gTasks[taskId].sAnimId = sMonFrontAnimIdsTable[species - 1];
|
||||
gTasks[taskId].sAnimDelay = sMonAnimationDelayTable[species - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
// No delay, start animation
|
||||
LaunchAnimationTaskForFrontSprite(sprite, sMonFrontAnimIdsTable[species - 1]);
|
||||
}
|
||||
sprite->callback = SpriteCallbackDummy_2;
|
||||
@ -6667,15 +6718,17 @@ void PokemonSummaryDoMonAnimation(struct Sprite* sprite, u16 species, bool8 oneF
|
||||
StartSpriteAnim(sprite, 1);
|
||||
if (sMonAnimationDelayTable[species - 1] != 0)
|
||||
{
|
||||
// Animation has delay, start delay task
|
||||
u8 taskId = CreateTask(Task_PokemonSummaryAnimateAfterDelay, 0);
|
||||
STORE_PTR_IN_TASK(sprite, taskId, 0);
|
||||
gTasks[taskId].data[2] = sMonFrontAnimIdsTable[species - 1];
|
||||
gTasks[taskId].data[3] = sMonAnimationDelayTable[species - 1];
|
||||
gTasks[taskId].sAnimId = sMonFrontAnimIdsTable[species - 1];
|
||||
gTasks[taskId].sAnimDelay = sMonAnimationDelayTable[species - 1];
|
||||
SummaryScreen_SetAnimDelayTaskId(taskId);
|
||||
SetSpriteCB_MonAnimDummy(sprite);
|
||||
}
|
||||
else
|
||||
{
|
||||
// No delay, start animation
|
||||
StartMonSummaryAnimation(sprite, sMonFrontAnimIdsTable[species - 1]);
|
||||
}
|
||||
}
|
||||
@ -6700,48 +6753,50 @@ void BattleAnimateBackSprite(struct Sprite* sprite, u16 species)
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_806EF08(u8 arg0)
|
||||
// Unused, identical to GetOpposingLinkMultiBattlerId but for the player
|
||||
// "rightSide" from that team's perspective, i.e. B_POSITION_*_RIGHT
|
||||
static u8 GetOwnOpposingLinkMultiBattlerId(bool8 rightSide)
|
||||
{
|
||||
s32 i;
|
||||
s32 var = 0;
|
||||
s32 battlerId = 0;
|
||||
u8 multiplayerId = GetMultiplayerId();
|
||||
switch (gLinkPlayers[multiplayerId].id)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
var = (arg0 != 0) ? 1 : 3;
|
||||
battlerId = rightSide ? 1 : 3;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
var = (arg0 != 0) ? 2 : 0;
|
||||
battlerId = rightSide ? 2 : 0;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
if (gLinkPlayers[i].id == (s16)(var))
|
||||
if (gLinkPlayers[i].id == (s16)battlerId)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
u8 sub_806EF84(u8 arg0, u8 arg1)
|
||||
u8 GetOpposingLinkMultiBattlerId(bool8 rightSide, u8 multiplayerId)
|
||||
{
|
||||
s32 i;
|
||||
s32 var = 0;
|
||||
switch (gLinkPlayers[arg1].id)
|
||||
s32 battlerId = 0;
|
||||
switch (gLinkPlayers[multiplayerId].id)
|
||||
{
|
||||
case 0:
|
||||
case 2:
|
||||
var = (arg0 != 0) ? 1 : 3;
|
||||
battlerId = rightSide ? 1 : 3;
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
var = (arg0 != 0) ? 2 : 0;
|
||||
battlerId = rightSide ? 2 : 0;
|
||||
break;
|
||||
}
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
if (gLinkPlayers[i].id == (s16)(var))
|
||||
if (gLinkPlayers[i].id == (s16)battlerId)
|
||||
break;
|
||||
}
|
||||
return i;
|
||||
|
@ -65,17 +65,18 @@ u8 ScriptGiveMon(u16 species, u8 level, u16 item, u32 unused1, u32 unused2, u8 u
|
||||
u8 heldItem[2];
|
||||
struct Pokemon mon;
|
||||
|
||||
CreateMon(&mon, species, level, USE_RANDOM_IVS, 0, 0, OT_ID_PLAYER_ID, 0);
|
||||
CreateMon(&mon, species, level, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
heldItem[0] = item;
|
||||
heldItem[1] = item >> 8;
|
||||
SetMonData(&mon, MON_DATA_HELD_ITEM, heldItem);
|
||||
sentToPc = GiveMonToPlayer(&mon);
|
||||
nationalDexNum = SpeciesToNationalPokedexNum(species);
|
||||
|
||||
// Don't set Pokédex flag for MON_CANT_GIVE
|
||||
switch(sentToPc)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case MON_GIVEN_TO_PARTY:
|
||||
case MON_GIVEN_TO_PC:
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_SEEN);
|
||||
GetSetPokedexFlag(nationalDexNum, FLAG_SET_CAUGHT);
|
||||
break;
|
||||
|
@ -126,7 +126,7 @@ struct
|
||||
{TRAINER_CLASS_PKMN_BREEDER, TRAINER_ENCOUNTER_MUSIC_FEMALE},
|
||||
{TRAINER_CLASS_COLLECTOR, TRAINER_ENCOUNTER_MUSIC_SUSPICIOUS},
|
||||
{TRAINER_CLASS_PKMN_RANGER, TRAINER_ENCOUNTER_MUSIC_COOL},
|
||||
{TRAINER_CLASS_PKMN_TRAINER_3, TRAINER_ENCOUNTER_MUSIC_MALE},
|
||||
{TRAINER_CLASS_RIVAL, TRAINER_ENCOUNTER_MUSIC_MALE},
|
||||
{TRAINER_CLASS_YOUNG_COUPLE, TRAINER_ENCOUNTER_MUSIC_GIRL},
|
||||
{TRAINER_CLASS_PSYCHIC, TRAINER_ENCOUNTER_MUSIC_INTENSE},
|
||||
{TRAINER_CLASS_SR_AND_JR, TRAINER_ENCOUNTER_MUSIC_TWINS},
|
||||
|
Loading…
x
Reference in New Issue
Block a user