Data for hidden abilities

This commit is contained in:
DizzyEggg 2019-05-14 13:20:10 +02:00
parent 00dcc05516
commit 38b320eaa5
23 changed files with 941 additions and 246 deletions

View File

@ -239,7 +239,7 @@ struct BattleTowerPokemon
u32 spAttackIV:5;
u32 spDefenseIV:5;
u32 gap:1;
u32 altAbility:1;
u32 abilityNum:1;
u32 personality;
u8 nickname[POKEMON_NAME_LENGTH + 1];
u8 friendship;

View File

@ -50,7 +50,7 @@
#define MON_DATA_SPATK_IV 43
#define MON_DATA_SPDEF_IV 44
#define MON_DATA_IS_EGG 45
#define MON_DATA_ALT_ABILITY 46
#define MON_DATA_ABILITY_NUM 46
#define MON_DATA_TOUGH 47
#define MON_DATA_SHEEN 48
#define MON_DATA_OT_GENDER 49
@ -182,7 +182,7 @@ struct PokemonSubstruct3
/* 0x05 */ u32 spAttackIV:5;
/* 0x06 */ u32 spDefenseIV:5;
/* 0x07 */ u32 isEgg:1;
/* 0x07 */ u32 altAbility:1;
/* 0x07 */ u32 abilityNum:1;
/* 0x08 */ u32 coolRibbon:3;
/* 0x08 */ u32 beautyRibbon:3;
@ -281,7 +281,7 @@ struct BattlePokemon
/*0x16*/ u32 spAttackIV:5;
/*0x17*/ u32 spDefenseIV:5;
/*0x17*/ u32 isEgg:1;
/*0x17*/ u32 altAbility:1;
/*0x17*/ u32 abilityNum:1;
/*0x18*/ s8 statStages[NUM_BATTLE_STATS];
/*0x20*/ u8 ability;
/*0x21*/ u8 type1;
@ -331,8 +331,9 @@ struct BaseStats
/* 0x15 */ u8 eggGroup2;
/* 0x16 */ u8 ability1;
/* 0x17 */ u8 ability2;
/* 0x18 */ u8 safariZoneFleeRate;
/* 0x19 */ u8 bodyColor : 7;
/* 0x18 */ u8 abilityHidden;
/* 0x19 */ u8 safariZoneFleeRate;
/* 0x1A */ u8 bodyColor : 7;
u8 noFlip : 1;
};
@ -524,7 +525,7 @@ u8 CalculatePlayerPartyCount(void);
u8 CalculateEnemyPartyCount(void);
u8 GetMonsStateToDoubles(void);
u8 GetMonsStateToDoubles_2(void);
u8 GetAbilityBySpecies(u16 species, bool8 altAbility);
u8 GetAbilityBySpecies(u16 species, bool8 abilityNum);
u8 GetMonAbility(struct Pokemon *mon);
void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord);
u8 GetSecretBaseTrainerPicIndex(void);

View File

@ -93,7 +93,7 @@ static bool8 ShouldSwitchIfWonderGuard(void)
continue;
GetMonData(&party[i], MON_DATA_SPECIES); // Unused return value.
GetMonData(&party[i], MON_DATA_ALT_ABILITY); // Unused return value.
GetMonData(&party[i], MON_DATA_ABILITY_NUM); // Unused return value.
for (opposingBattler = GetBattlerAtPosition(opposingPosition), j = 0; j < MAX_MON_MOVES; j++)
{
@ -197,7 +197,7 @@ static bool8 FindMonThatAbsorbsOpponentsMove(void)
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
if (GetMonData(&party[i], MON_DATA_ALT_ABILITY) != 0)
if (GetMonData(&party[i], MON_DATA_ABILITY_NUM) != 0)
monAbility = gBaseStats[species].ability2;
else
monAbility = gBaseStats[species].ability1;
@ -392,7 +392,7 @@ static bool8 FindMonWithFlagsAndSuperEffective(u8 flags, u8 moduloPercent)
continue;
species = GetMonData(&party[i], MON_DATA_SPECIES);
if (GetMonData(&party[i], MON_DATA_ALT_ABILITY) != 0)
if (GetMonData(&party[i], MON_DATA_ABILITY_NUM) != 0)
monAbility = gBaseStats[species].ability2;
else
monAbility = gBaseStats[species].ability1;

View File

@ -602,7 +602,7 @@ static u32 CopyLinkOpponentMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -487,7 +487,7 @@ static u32 CopyLinkPartnerMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -585,7 +585,7 @@ static u32 GetOpponentMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -1628,7 +1628,7 @@ static u32 CopyPlayerMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -672,7 +672,7 @@ static u32 CopyPlayerPartnerMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -584,7 +584,7 @@ static u32 CopyRecordedOpponentMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gEnemyParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gEnemyParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gEnemyParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gEnemyParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gEnemyParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gEnemyParty[monId], MON_DATA_OT_ID);
GetMonData(&gEnemyParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -567,7 +567,7 @@ static u32 CopyRecordedPlayerMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -485,7 +485,7 @@ static u32 CopyWallyMonData(u8 monId, u8 *dst)
battleMon.spAttack = GetMonData(&gPlayerParty[monId], MON_DATA_SPATK);
battleMon.spDefense = GetMonData(&gPlayerParty[monId], MON_DATA_SPDEF);
battleMon.isEgg = GetMonData(&gPlayerParty[monId], MON_DATA_IS_EGG);
battleMon.altAbility = GetMonData(&gPlayerParty[monId], MON_DATA_ALT_ABILITY);
battleMon.abilityNum = GetMonData(&gPlayerParty[monId], MON_DATA_ABILITY_NUM);
battleMon.otId = GetMonData(&gPlayerParty[monId], MON_DATA_OT_ID);
GetMonData(&gPlayerParty[monId], MON_DATA_NICKNAME, nickname);
StringCopy10(battleMon.nickname, nickname);

View File

@ -373,7 +373,7 @@ static void SetRentalsToOpponentParty(void)
gSaveBlock2Ptr->frontier.rentalMons[i + 3].monId = gUnknown_03006298[i];
gSaveBlock2Ptr->frontier.rentalMons[i + 3].ivs = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ATK_IV, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i + 3].personality = GetMonData(&gEnemyParty[i], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityBit = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ALT_ABILITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityBit = GetBoxMonData(&gEnemyParty[i].box, MON_DATA_ABILITY_NUM, NULL);
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[gUnknown_03006298[i]].itemTableId]);
}
}
@ -439,7 +439,7 @@ static void SetPlayerAndOpponentParties(void)
SetMonMoveAvoidReturn(&gPlayerParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
SetMonData(&gPlayerParty[i], MON_DATA_FRIENDSHIP, &friendship);
SetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
SetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY, &gSaveBlock2Ptr->frontier.rentalMons[i].abilityBit);
SetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM, &gSaveBlock2Ptr->frontier.rentalMons[i].abilityBit);
}
}
@ -478,7 +478,7 @@ static void SetPlayerAndOpponentParties(void)
for (k = 0; k < MAX_MON_MOVES; k++)
SetMonMoveAvoidReturn(&gEnemyParty[i], gFacilityTrainerMons[monSetId].moves[k], k);
SetMonData(&gEnemyParty[i], MON_DATA_HELD_ITEM, &gBattleFrontierHeldItems[gFacilityTrainerMons[monSetId].itemTableId]);
SetMonData(&gEnemyParty[i], MON_DATA_ALT_ABILITY, &gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityBit);
SetMonData(&gEnemyParty[i], MON_DATA_ABILITY_NUM, &gSaveBlock2Ptr->frontier.rentalMons[i + 3].abilityBit);
}
break;
}

View File

@ -1742,7 +1742,7 @@ static void Select_CopyMonsToPlayerParty(void)
gPlayerParty[i] = sFactorySelectScreen->mons[j].monData;
gSaveBlock2Ptr->frontier.rentalMons[i].monId = sFactorySelectScreen->mons[j].monSetId;
gSaveBlock2Ptr->frontier.rentalMons[i].personality = GetMonData(&gPlayerParty[i], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].abilityBit = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ALT_ABILITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].abilityBit = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ABILITY_NUM, NULL);
gSaveBlock2Ptr->frontier.rentalMons[i].ivs = GetBoxMonData(&gPlayerParty[i].box, MON_DATA_ATK_IV, NULL);
break;
}
@ -2266,7 +2266,7 @@ static void CopySwappedMonData(void)
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].monId = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + 3].monId;
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].ivs = gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->enemyMonId + 3].ivs;
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].personality = GetMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId], MON_DATA_PERSONALITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].abilityBit = GetBoxMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId].box, MON_DATA_ALT_ABILITY, NULL);
gSaveBlock2Ptr->frontier.rentalMons[sFactorySwapScreen->playerMonId].abilityBit = GetBoxMonData(&gEnemyParty[sFactorySwapScreen->enemyMonId].box, MON_DATA_ABILITY_NUM, NULL);
}
static void Task_FromSwapScreenToSummaryScreen(u8 taskId)

View File

@ -3383,7 +3383,7 @@ static void BattleIntroDrawTrainersOrMonsSprites(void)
gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1;
gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2;
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
hpOnSwitchout = &gBattleStruct->hpOnSwitchout[GetBattlerSide(gActiveBattler)];
*hpOnSwitchout = gBattleMons[gActiveBattler].hp;
for (i = 0; i < NUM_BATTLE_STATS; i++)

View File

@ -1156,7 +1156,7 @@ bool32 TryGenerateBattlePikeWildMon(bool8 checkKeenEyeIntimidate)
abilityBit = Random() % 2;
else
abilityBit = 0;
SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &abilityBit);
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &abilityBit);
for (i = 0; i < MAX_MON_MOVES; i++)
SetMonMoveSlot(&gEnemyParty[0], wildMons[headerId][pikeMonId].moves[i], i);

View File

@ -1405,19 +1405,19 @@ void GenerateBattlePyramidWildMon(void)
{
case 0:
case 1:
SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &wildMons[id].abilityBit);
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &wildMons[id].abilityBit);
break;
case 2:
default:
if (gBaseStats[wildMons[id].species].ability2)
{
i = GetMonData(&gEnemyParty[0], MON_DATA_PERSONALITY, NULL) % 2;
SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i);
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
}
else
{
i = 0;
SetMonData(&gEnemyParty[0], MON_DATA_ALT_ABILITY, &i);
SetMonData(&gEnemyParty[0], MON_DATA_ABILITY_NUM, &i);
}
break;
}

View File

@ -4906,7 +4906,7 @@ static void atk4D_switchindataupdate(void)
gBattleMons[gActiveBattler].type1 = gBaseStats[gBattleMons[gActiveBattler].species].type1;
gBattleMons[gActiveBattler].type2 = gBaseStats[gBattleMons[gActiveBattler].species].type2;
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].altAbility);
gBattleMons[gActiveBattler].ability = GetAbilityBySpecies(gBattleMons[gActiveBattler].species, gBattleMons[gActiveBattler].abilityNum);
// check knocked off item
i = GetBattlerSide(gActiveBattler);
@ -8622,7 +8622,7 @@ static void atkAE_healpartystatus(void)
for (i = 0; i < PARTY_SIZE; i++)
{
u16 species = GetMonData(&party[i], MON_DATA_SPECIES2);
u8 abilityBit = GetMonData(&party[i], MON_DATA_ALT_ABILITY);
u8 abilityBit = GetMonData(&party[i], MON_DATA_ABILITY_NUM);
if (species != SPECIES_NONE && species != SPECIES_EGG)
{
@ -9844,7 +9844,7 @@ static void atkE5_pickup(void)
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM))
ability = gBaseStats[species].ability2;
else
ability = gBaseStats[species].ability1;
@ -9867,7 +9867,7 @@ static void atkE5_pickup(void)
species = GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2);
heldItem = GetMonData(&gPlayerParty[i], MON_DATA_HELD_ITEM);
if (GetMonData(&gPlayerParty[i], MON_DATA_ALT_ABILITY))
if (GetMonData(&gPlayerParty[i], MON_DATA_ABILITY_NUM))
ability = gBaseStats[species].ability2;
else
ability = gBaseStats[species].ability1;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1433,7 +1433,7 @@ void PutZigzagoonInPlayerParty(void)
u16 monData;
CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, 0x20, FALSE, 0, FALSE, 0);
monData = TRUE;
SetMonData(&gPlayerParty[0], MON_DATA_ALT_ABILITY, &monData);
SetMonData(&gPlayerParty[0], MON_DATA_ABILITY_NUM, &monData);
monData = MOVE_TACKLE;
SetMonData(&gPlayerParty[0], MON_DATA_MOVE1, &monData);
monData = MOVE_NONE;

View File

@ -2516,7 +2516,7 @@ void CreateBoxMon(struct BoxPokemon *boxMon, u16 species, u8 level, u8 fixedIV,
if (gBaseStats[species].ability2)
{
value = personality & 1;
SetBoxMonData(boxMon, MON_DATA_ALT_ABILITY, &value);
SetBoxMonData(boxMon, MON_DATA_ABILITY_NUM, &value);
}
GiveBoxMonInitialMoveset(boxMon);
@ -2667,8 +2667,8 @@ void CreateBattleTowerMon(struct Pokemon *mon, struct BattleTowerPokemon *src)
SetMonData(mon, MON_DATA_SPEED_EV, &src->speedEV);
SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV);
SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV);
value = src->altAbility;
SetMonData(mon, MON_DATA_ALT_ABILITY, &value);
value = src->abilityNum;
SetMonData(mon, MON_DATA_ABILITY_NUM, &value);
value = src->hpIV;
SetMonData(mon, MON_DATA_HP_IV, &value);
value = src->attackIV;
@ -2729,8 +2729,8 @@ void CreateBattleTowerMon2(struct Pokemon *mon, struct BattleTowerPokemon *src,
SetMonData(mon, MON_DATA_SPEED_EV, &src->speedEV);
SetMonData(mon, MON_DATA_SPATK_EV, &src->spAttackEV);
SetMonData(mon, MON_DATA_SPDEF_EV, &src->spDefenseEV);
value = src->altAbility;
SetMonData(mon, MON_DATA_ALT_ABILITY, &value);
value = src->abilityNum;
SetMonData(mon, MON_DATA_ABILITY_NUM, &value);
value = src->hpIV;
SetMonData(mon, MON_DATA_HP_IV, &value);
value = src->attackIV;
@ -2845,7 +2845,7 @@ void sub_80686FC(struct Pokemon *mon, struct BattleTowerPokemon *dest)
dest->speedIV = GetMonData(mon, MON_DATA_SPEED_IV, NULL);
dest->spAttackIV = GetMonData(mon, MON_DATA_SPATK_IV, NULL);
dest->spDefenseIV = GetMonData(mon, MON_DATA_SPDEF_IV, NULL);
dest->altAbility = GetMonData(mon, MON_DATA_ALT_ABILITY, NULL);
dest->abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL);
dest->personality = GetMonData(mon, MON_DATA_PERSONALITY, NULL);
GetMonData(mon, MON_DATA_NICKNAME, dest->nickname);
}
@ -4112,8 +4112,8 @@ u32 GetBoxMonData(struct BoxPokemon *boxMon, s32 field, u8 *data)
case MON_DATA_IS_EGG:
retVal = substruct3->isEgg;
break;
case MON_DATA_ALT_ABILITY:
retVal = substruct3->altAbility;
case MON_DATA_ABILITY_NUM:
retVal = substruct3->abilityNum;
break;
case MON_DATA_COOL_RIBBON:
retVal = substruct3->coolRibbon;
@ -4491,8 +4491,8 @@ void SetBoxMonData(struct BoxPokemon *boxMon, s32 field, const void *dataArg)
else
boxMon->isEgg = 0;
break;
case MON_DATA_ALT_ABILITY:
SET8(substruct3->altAbility);
case MON_DATA_ABILITY_NUM:
SET8(substruct3->abilityNum);
break;
case MON_DATA_COOL_RIBBON:
SET8(substruct3->coolRibbon);
@ -4699,9 +4699,11 @@ u8 GetMonsStateToDoubles_2(void)
return (aliveCount > 1) ? PLAYER_HAS_TWO_USABLE_MONS : PLAYER_HAS_ONE_USABLE_MON;
}
u8 GetAbilityBySpecies(u16 species, bool8 altAbility)
u8 GetAbilityBySpecies(u16 species, u8 abilityNum)
{
if (altAbility)
if (abilityNum == 2)
gLastUsedAbility = gBaseStats[species].abilityHidden;
else if (abilityNum == 1)
gLastUsedAbility = gBaseStats[species].ability2;
else
gLastUsedAbility = gBaseStats[species].ability1;
@ -4712,8 +4714,8 @@ u8 GetAbilityBySpecies(u16 species, bool8 altAbility)
u8 GetMonAbility(struct Pokemon *mon)
{
u16 species = GetMonData(mon, MON_DATA_SPECIES, NULL);
u8 altAbility = GetMonData(mon, MON_DATA_ALT_ABILITY, NULL);
return GetAbilityBySpecies(species, altAbility);
u8 abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM, NULL);
return GetAbilityBySpecies(species, abilityNum);
}
void CreateSecretBaseEnemyParty(struct SecretBase *secretBaseRecord)
@ -4856,11 +4858,11 @@ void CopyPlayerPartyMonToBattleData(u8 battlerId, u8 partyIndex)
gBattleMons[battlerId].spAttack = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPATK, NULL);
gBattleMons[battlerId].spDefense = GetMonData(&gPlayerParty[partyIndex], MON_DATA_SPDEF, NULL);
gBattleMons[battlerId].isEgg = GetMonData(&gPlayerParty[partyIndex], MON_DATA_IS_EGG, NULL);
gBattleMons[battlerId].altAbility = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ALT_ABILITY, NULL);
gBattleMons[battlerId].abilityNum = GetMonData(&gPlayerParty[partyIndex], MON_DATA_ABILITY_NUM, NULL);
gBattleMons[battlerId].otId = GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_ID, NULL);
gBattleMons[battlerId].type1 = gBaseStats[gBattleMons[battlerId].species].type1;
gBattleMons[battlerId].type2 = gBaseStats[gBattleMons[battlerId].species].type2;
gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].altAbility);
gBattleMons[battlerId].ability = GetAbilityBySpecies(gBattleMons[battlerId].species, gBattleMons[battlerId].abilityNum);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_NICKNAME, nickname);
StringCopy10(gBattleMons[battlerId].nickname, nickname);
GetMonData(&gPlayerParty[partyIndex], MON_DATA_OT_NAME, gBattleMons[battlerId].otName);

View File

@ -115,7 +115,7 @@ static EWRAM_DATA struct PokemonSummaryScreenData
u8 level; // 0x5
u8 ribbonCount; // 0x6
u8 ailment; // 0x7
u8 altAbility; // 0x8
u8 abilityNum; // 0x8
u8 metLocation; // 0x9
u8 metLevel; // 0xA
u8 metGame; // 0xB
@ -1356,7 +1356,7 @@ static bool8 ExtractMonDataToSummaryStruct(struct Pokemon *mon)
sum->species2 = GetMonData(mon, MON_DATA_SPECIES2);
sum->exp = GetMonData(mon, MON_DATA_EXP);
sum->level = GetMonData(mon, MON_DATA_LEVEL);
sum->altAbility = GetMonData(mon, MON_DATA_ALT_ABILITY);
sum->abilityNum = GetMonData(mon, MON_DATA_ABILITY_NUM);
sum->item = GetMonData(mon, MON_DATA_HELD_ITEM);
sum->pid = GetMonData(mon, MON_DATA_PERSONALITY);
sum->sanity = GetMonData(mon, MON_DATA_SANITY_IS_BAD_EGG);
@ -3062,13 +3062,13 @@ static void PrintMonOTID(void)
static void PrintMonAbilityName(void)
{
u8 ability = GetAbilityBySpecies(sMonSummaryScreen->summary.species, sMonSummaryScreen->summary.altAbility);
u8 ability = GetAbilityBySpecies(sMonSummaryScreen->summary.species, sMonSummaryScreen->summary.abilityNum);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ABILITY), gAbilityNames[ability], 0, 1, 0, 1);
}
static void PrintMonAbilityDescription(void)
{
u8 ability = GetAbilityBySpecies(sMonSummaryScreen->summary.species, sMonSummaryScreen->summary.altAbility);
u8 ability = GetAbilityBySpecies(sMonSummaryScreen->summary.species, sMonSummaryScreen->summary.abilityNum);
SummaryScreen_PrintTextOnWindow(AddWindowFromTemplateList(sPageInfoTemplate, PSS_DATA_WINDOW_INFO_ABILITY), gAbilityDescriptionPointers[ability], 0, 17, 0, 0);
}

View File

@ -5840,7 +5840,7 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade)
SetMonData(pokemon, MON_DATA_NICKNAME, inGameTrade->name);
SetMonData(pokemon, MON_DATA_OT_NAME, inGameTrade->otName);
SetMonData(pokemon, MON_DATA_OT_GENDER, &inGameTrade->otGender);
SetMonData(pokemon, MON_DATA_ALT_ABILITY, &inGameTrade->secondAbility);
SetMonData(pokemon, MON_DATA_ABILITY_NUM, &inGameTrade->secondAbility);
SetMonData(pokemon, MON_DATA_BEAUTY, &inGameTrade->stats[1]);
SetMonData(pokemon, MON_DATA_CUTE, &inGameTrade->stats[2]);
SetMonData(pokemon, MON_DATA_COOL, &inGameTrade->stats[0]);