Reflect Ivy Cudgel type in interfaces (#3590)

* Reflect Ivy Cudgel type in interfaces

* Use GetSideParty
This commit is contained in:
Bassoonian 2023-11-23 19:23:10 +01:00 committed by GitHub
parent a7beed5b25
commit d6ded280a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 2 deletions

View file

@ -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);
}

View file

@ -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);
}