From b903d02c064b2b3dcf8efe9c1c507cb5b32e88a1 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Sat, 7 Aug 2021 12:38:10 -0400 Subject: [PATCH] handle battle engine hidden ability change --- include/pokemon.h | 8 +++++++- src/dexnav.c | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/pokemon.h b/include/pokemon.h index 0abeb49c7f..ef5816965e 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -200,11 +200,17 @@ struct BaseStats /* 0x13 */ u8 growthRate; /* 0x14 */ u8 eggGroup1; /* 0x15 */ u8 eggGroup2; - /* 0x16 */ u8 abilities[2]; + #ifdef BATTLE_ENGINE + /* 0x16 */ u8 abilities[NUM_ABILITY_SLOTS]; + #else + u8 abilities[2]; + #endif /* 0x18 */ u8 safariZoneFleeRate; /* 0x19 */ u8 bodyColor : 7; u8 noFlip : 1; + #ifndef BATTLE_ENGINE /* 0x1A */ u8 abilityHidden; + #endif }; /* size = 28 */ struct BattleMove diff --git a/src/dexnav.c b/src/dexnav.c index c500cdcb14..f4774a1215 100644 --- a/src/dexnav.c +++ b/src/dexnav.c @@ -1409,7 +1409,11 @@ static u8 DexNavGetAbilityNum(u16 species, u8 searchLevel) #endif } + #ifdef BATTLE_ENGINE // if using RHH, the base stats abilities field is expanded + if (genAbility && gBaseStats[species].abilities[2] != ABILITY_NONE && GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT)) + #else if (genAbility && gBaseStats[species].abilityHidden != ABILITY_NONE && GetSetPokedexFlag(SpeciesToNationalPokedexNum(species), FLAG_GET_CAUGHT)) + #endif { //Only give hidden ability if Pokemon has been caught before abilityNum = 2; @@ -2176,8 +2180,13 @@ static void PrintCurrentSpeciesInfo(void) } else if (GetSetPokedexFlag(dexNum, FLAG_GET_CAUGHT)) { - if (gBaseStats[species].abilityHidden != ABILITY_NONE) + #ifdef BATTLE_ENGINE + if (gBaseStats[species].abilities[2] != ABILITY_NONE) + AddTextPrinterParameterized3(WINDOW_INFO, 0, 0, HA_INFO_Y, sFontColor_Black, 0, gAbilityNames[gBaseStats[species].abilities[2]]); + #else + if (gBaseStats[species].abilityHidden != ABILITY_NONE) AddTextPrinterParameterized3(WINDOW_INFO, 0, 0, HA_INFO_Y, sFontColor_Black, 0, gAbilityNames[gBaseStats[species].abilityHidden]); + #endif else AddTextPrinterParameterized3(WINDOW_INFO, 0, 0, HA_INFO_Y, sFontColor_Black, 0, gText_None); }