diff --git a/include/config/pokemon.h b/include/config/pokemon.h index 7bf9450cbbbe..b54f1437fd29 100644 --- a/include/config/pokemon.h +++ b/include/config/pokemon.h @@ -51,6 +51,7 @@ #define P_TWO_FRAME_FRONT_SPRITES TRUE // In Pokémon Emerald, Pokémon front sprites always consist of two frames. This config can revert it to only use the first frame, as is the case in the other Gen 3 games. #define P_ONLY_OBTAINABLE_SHINIES FALSE // If TRUE, Pokémon encountered in the Battle Pyramid won't be shiny. #define P_NO_SHINIES_WITHOUT_POKEBALLS FALSE // If TRUE, Pokémon encountered when the player is out of Poké Balls won't be shiny +#define P_DYNAMIC_HIDDEN_POWER_TYPES FALSE // If TRUE, Pokémon will display their Hidden Power type in summary screens and in battle. // Learnset helper toggles #define P_LEARNSET_HELPER_TEACHABLE TRUE // If TRUE, teachable_learnsets.h will be populated by tools/learnset_helpers/teachable.py using the included JSON files based on available TMs and tutors. diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 6dcea9eb98c1..5eb6eb7f7c90 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -1725,7 +1725,9 @@ static void MoveSelectionDisplayMoveType(u32 battler) { if (IsGimmickSelected(battler, GIMMICK_TERA) || GetActiveGimmick(battler) == GIMMICK_TERA) type = GetBattlerTeraType(battler); + end = StringCopy(txtPtr, gTypesInfo[type].name); } + else if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_IVY_CUDGEL) { speciesId = gBattleMons[battler].species; @@ -1734,21 +1736,46 @@ static void MoveSelectionDisplayMoveType(u32 battler) || speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK || speciesId == SPECIES_OGERPON_HEARTHFLAME_MASK_TERA || speciesId == SPECIES_OGERPON_CORNERSTONE_MASK || speciesId == SPECIES_OGERPON_CORNERSTONE_MASK_TERA) type = gBattleMons[battler].type2; + end = StringCopy(txtPtr, gTypesInfo[type].name); } // Max Guard is a Normal-type move else if (gMovesInfo[moveInfo->moves[gMoveSelectionCursor[battler]]].category == DAMAGE_CATEGORY_STATUS && (GetActiveGimmick(battler) == GIMMICK_DYNAMAX || IsGimmickSelected(battler, GIMMICK_DYNAMAX))) { type = TYPE_NORMAL; + end = StringCopy(txtPtr, gTypesInfo[type].name); } + else if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_TERA_STARSTORM) { if (gBattleMons[battler].species == SPECIES_TERAPAGOS_STELLAR || (IsGimmickSelected(battler, GIMMICK_TERA) && gBattleMons[battler].species == SPECIES_TERAPAGOS_TERASTAL)) type = TYPE_STELLAR; + end = StringCopy(txtPtr, gTypesInfo[type].name); + } + + //Dynamic Hidden Power types + else if (P_DYNAMIC_HIDDEN_POWER_TYPES && moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_HIDDEN_POWER) + { + u8 typeBits = ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_HP_IV) & 1) << 0) + | ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_ATK_IV) & 1) << 1) + | ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_DEF_IV) & 1) << 2) + | ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPEED_IV) & 1) << 3) + | ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPATK_IV) & 1) << 4) + | ((GetMonData(&gPlayerParty[gBattlerPartyIndexes[battler]], MON_DATA_SPDEF_IV) & 1) << 5); + + u8 type = (15 * typeBits) / 63 + 2; + if (type >= TYPE_MYSTERY) + type++; + type |= 0xC0; + end = StringCopy(txtPtr, gTypesInfo[type & 0x3F].name); + } + + else + { + end = StringCopy(txtPtr, gTypesInfo[type].name); } - end = StringCopy(txtPtr, gTypesInfo[type].name); PrependFontIdToFit(txtPtr, end, FONT_NORMAL, WindowWidthPx(B_WIN_MOVE_TYPE) - 25); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e81ef0b0669f..8cfe94c896e3 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -3959,12 +3959,34 @@ static void SetMoveTypeIcons(void) { u8 i; struct PokeSummary *summary = &sMonSummaryScreen->summary; + struct Pokemon *mon = &sMonSummaryScreen->currentMon; for (i = 0; i < MAX_MON_MOVES; i++) { - if (summary->moves[i] != MOVE_NONE) + if (summary->moves[i] != MOVE_NONE) { - SetTypeSpritePosAndPal(gMovesInfo[summary->moves[i]].type, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + + if (P_DYNAMIC_HIDDEN_POWER_TYPES && summary->moves[i] == MOVE_HIDDEN_POWER) + { + u8 typeBits = ((GetMonData(mon, MON_DATA_HP_IV) & 1) << 0) + | ((GetMonData(mon, MON_DATA_ATK_IV) & 1) << 1) + | ((GetMonData(mon, MON_DATA_DEF_IV) & 1) << 2) + | ((GetMonData(mon, MON_DATA_SPEED_IV) & 1) << 3) + | ((GetMonData(mon, MON_DATA_SPATK_IV) & 1) << 4) + | ((GetMonData(mon, MON_DATA_SPDEF_IV) & 1) << 5); + + u8 type = (15 * typeBits) / 63 + 2; + if (type >= TYPE_MYSTERY) + type++; + type |= 0xC0; + SetTypeSpritePosAndPal(type & 0x3F, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + } + + else + { + SetTypeSpritePosAndPal(gMovesInfo[summary->moves[i]].type, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + } } + else SetSpriteInvisibility(i + SPRITE_ARR_ID_TYPE, TRUE); } @@ -3985,6 +4007,8 @@ static void SetContestMoveTypeIcons(void) static void SetNewMoveTypeIcon(void) { + struct Pokemon *mon = &sMonSummaryScreen->currentMon; + if (sMonSummaryScreen->newMove == MOVE_NONE) { SetSpriteInvisibility(SPRITE_ARR_ID_TYPE + 4, TRUE); @@ -3992,7 +4016,25 @@ static void SetNewMoveTypeIcon(void) else { if (sMonSummaryScreen->currPageIndex == PSS_PAGE_BATTLE_MOVES) - SetTypeSpritePosAndPal(gMovesInfo[sMonSummaryScreen->newMove].type, 85, 96, SPRITE_ARR_ID_TYPE + 4); + if (P_DYNAMIC_HIDDEN_POWER_TYPES && sMonSummaryScreen->newMove == MOVE_HIDDEN_POWER) + { + u8 typeBits = ((GetMonData(mon, MON_DATA_HP_IV) & 1) << 0) + | ((GetMonData(mon, MON_DATA_ATK_IV) & 1) << 1) + | ((GetMonData(mon, MON_DATA_DEF_IV) & 1) << 2) + | ((GetMonData(mon, MON_DATA_SPEED_IV) & 1) << 3) + | ((GetMonData(mon, MON_DATA_SPATK_IV) & 1) << 4) + | ((GetMonData(mon, MON_DATA_SPDEF_IV) & 1) << 5); + + u8 type = (15 * typeBits) / 63 + 2; + if (type >= TYPE_MYSTERY) + type++; + type |= 0xC0; + SetTypeSpritePosAndPal(type & 0x3F, 85, 96, SPRITE_ARR_ID_TYPE + 4); + } + else + { + SetTypeSpritePosAndPal(gMovesInfo[sMonSummaryScreen->newMove].type, 85, 96, SPRITE_ARR_ID_TYPE + 4); + } else SetTypeSpritePosAndPal(NUMBER_OF_MON_TYPES + gMovesInfo[sMonSummaryScreen->newMove].contestCategory, 85, 96, SPRITE_ARR_ID_TYPE + 4); }