Skip to content

Commit

Permalink
Reflect Ivy Cudgel type in interfaces (#3590)
Browse files Browse the repository at this point in the history
* Reflect Ivy Cudgel type in interfaces

* Use GetSideParty
  • Loading branch information
Bassoonian committed Nov 23, 2023
1 parent a7beed5 commit d6ded28
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
19 changes: 18 additions & 1 deletion src/battle_controller_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1727,14 +1728,30 @@ 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);
*(txtPtr)++ = EXT_CTRL_CODE_BEGIN;
*(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);
}

Expand Down
8 changes: 7 additions & 1 deletion src/pokemon_summary_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit d6ded28

Please sign in to comment.