From d6ded280a3c70766db98b22ae5b49be76ce76204 Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Thu, 23 Nov 2023 19:23:10 +0100 Subject: [PATCH] Reflect Ivy Cudgel type in interfaces (#3590) * Reflect Ivy Cudgel type in interfaces * Use GetSideParty --- src/battle_controller_player.c | 19 ++++++++++++++++++- src/pokemon_summary_screen.c | 8 +++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index 48ab691dfa93..43e84f1bffa7 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -31,6 +31,7 @@ #include "util.h" #include "window.h" #include "constants/battle_anim.h" +#include "constants/hold_effects.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/party_menu.h" @@ -1727,6 +1728,9 @@ static void MoveSelectionDisplayPpNumber(u32 battler) static void MoveSelectionDisplayMoveType(u32 battler) { u8 *txtPtr; + u8 type; + u32 itemId; + struct Pokemon *mon; struct ChooseMoveStruct *moveInfo = (struct ChooseMoveStruct *)(&gBattleResources->bufferA[battler][4]); txtPtr = StringCopy(gDisplayedStringBattle, gText_MoveInterfaceType); @@ -1734,7 +1738,20 @@ static void MoveSelectionDisplayMoveType(u32 battler) *(txtPtr)++ = EXT_CTRL_CODE_FONT; *(txtPtr)++ = FONT_NORMAL; - StringCopy(txtPtr, gTypeNames[gBattleMoves[moveInfo->moves[gMoveSelectionCursor[battler]]].type]); + if (moveInfo->moves[gMoveSelectionCursor[battler]] == MOVE_IVY_CUDGEL) + { + mon = &GetSideParty(GetBattlerSide(battler))[gBattlerPartyIndexes[battler]]; + itemId = GetMonData(mon, MON_DATA_HELD_ITEM); + + if (ItemId_GetHoldEffect(itemId) == HOLD_EFFECT_MASK) + type = ItemId_GetSecondaryId(itemId); + else + type = gBattleMoves[MOVE_IVY_CUDGEL].type; + } + else + type = gBattleMoves[moveInfo->moves[gMoveSelectionCursor[battler]]].type; + + StringCopy(txtPtr, gTypeNames[type]); BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MOVE_TYPE); } diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index b6efb82473e4..ef9b4f6a6945 100644 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -42,6 +42,7 @@ #include "tv.h" #include "window.h" #include "constants/battle_move_effects.h" +#include "constants/hold_effects.h" #include "constants/items.h" #include "constants/moves.h" #include "constants/party_menu.h" @@ -3947,7 +3948,12 @@ static void SetMoveTypeIcons(void) for (i = 0; i < MAX_MON_MOVES; i++) { if (summary->moves[i] != MOVE_NONE) - SetTypeSpritePosAndPal(gBattleMoves[summary->moves[i]].type, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + { + if (summary->moves[i] == MOVE_IVY_CUDGEL && ItemId_GetHoldEffect(summary->item) == HOLD_EFFECT_MASK) + SetTypeSpritePosAndPal(ItemId_GetSecondaryId(summary->item), 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + else + SetTypeSpritePosAndPal(gBattleMoves[summary->moves[i]].type, 85, 32 + (i * 16), i + SPRITE_ARR_ID_TYPE); + } else SetSpriteInvisibility(i + SPRITE_ARR_ID_TYPE, TRUE); }