Skip to content

Commit

Permalink
EV Caps Fix part 2
Browse files Browse the repository at this point in the history
Set the items back to ItemUseOutOfBattle_Medicine, got rid of ItemUseOutOfBattle_EVItem and ItemUseCB_EVItem, and reverted CB2_ReturnToPartyMenuUsingItem to CB2_ReturnToPartyMenuUsingRareCandy
  • Loading branch information
Flash1Lucky committed Aug 28, 2024
1 parent a6bd978 commit 867e8db
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 89 deletions.
1 change: 0 additions & 1 deletion include/item_use.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ void ItemUseOutOfBattle_SacredAsh(u8);
void ItemUseOutOfBattle_PPRecovery(u8);
void ItemUseOutOfBattle_PPUp(u8);
void ItemUseOutOfBattle_RareCandy(u8);
void ItemUseOutOfBattle_EVItem(u8);
void ItemUseOutOfBattle_DynamaxCandy(u8);
void ItemUseOutOfBattle_TMHM(u8);
void ItemUseOutOfBattle_Repel(u8);
Expand Down
1 change: 0 additions & 1 deletion include/party_menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bool8 MonKnowsMove(struct Pokemon *mon, u16 move);
bool8 BoxMonKnowsMove(struct BoxPokemon *boxMon, u16 move);
void ItemUseCB_TMHM(u8 taskId, TaskFunc task);
void ItemUseCB_RareCandy(u8 taskId, TaskFunc task);
void ItemUseCB_EVItem(u8 taskId, TaskFunc task);
void ItemUseCB_DynamaxCandy(u8 taskId, TaskFunc task);
void ItemUseCB_SacredAsh(u8 taskId, TaskFunc task);
void ItemUseCB_EvolutionStone(u8 taskId, TaskFunc task);
Expand Down
24 changes: 12 additions & 12 deletions src/data/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -1293,7 +1293,7 @@ const struct Item gItemsInfo[] =
"of one Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_HPUp,
.flingPower = 30,
.iconPic = gItemIcon_HPUp,
Expand All @@ -1310,7 +1310,7 @@ const struct Item gItemsInfo[] =
"Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_Protein,
.flingPower = 30,
.iconPic = gItemIcon_Vitamin,
Expand All @@ -1327,7 +1327,7 @@ const struct Item gItemsInfo[] =
"one Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_Iron,
.flingPower = 30,
.iconPic = gItemIcon_Vitamin,
Expand All @@ -1344,7 +1344,7 @@ const struct Item gItemsInfo[] =
"Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_Calcium,
.flingPower = 30,
.iconPic = gItemIcon_Vitamin,
Expand All @@ -1361,7 +1361,7 @@ const struct Item gItemsInfo[] =
"Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_Zinc,
.flingPower = 30,
.iconPic = gItemIcon_Vitamin,
Expand All @@ -1379,7 +1379,7 @@ const struct Item gItemsInfo[] =
"Pokémon."),
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_Carbos,
.flingPower = 30,
.iconPic = gItemIcon_Vitamin,
Expand Down Expand Up @@ -1430,7 +1430,7 @@ const struct Item gItemsInfo[] =
.description = sHealthFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_HpFeather,
.flingPower = 20,
.iconPic = gItemIcon_HealthFeather,
Expand All @@ -1444,7 +1444,7 @@ const struct Item gItemsInfo[] =
.description = sMuscleFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_AtkFeather,
.flingPower = 20,
.iconPic = gItemIcon_MuscleFeather,
Expand All @@ -1458,7 +1458,7 @@ const struct Item gItemsInfo[] =
.description = sResistFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_DefFeather,
.flingPower = 20,
.iconPic = gItemIcon_ResistFeather,
Expand All @@ -1472,7 +1472,7 @@ const struct Item gItemsInfo[] =
.description = sGeniusFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_SpatkFeather,
.flingPower = 20,
.iconPic = gItemIcon_GeniusFeather,
Expand All @@ -1486,7 +1486,7 @@ const struct Item gItemsInfo[] =
.description = sCleverFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_SpdefFeather,
.flingPower = 20,
.iconPic = gItemIcon_CleverFeather,
Expand All @@ -1500,7 +1500,7 @@ const struct Item gItemsInfo[] =
.description = sSwiftFeatherDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_EVItem,
.fieldUseFunc = ItemUseOutOfBattle_Medicine,
.effect = gItemEffect_SpeedFeather,
.flingPower = 20,
.iconPic = gItemIcon_SwiftFeather,
Expand Down
10 changes: 1 addition & 9 deletions src/item_use.c
Original file line number Diff line number Diff line change
Expand Up @@ -849,12 +849,6 @@ void ItemUseOutOfBattle_RareCandy(u8 taskId)
SetUpItemUseCallback(taskId);
}

void ItemUseOutOfBattle_EVItem(u8 taskId)
{
gItemUseCB = ItemUseCB_EVItem;
SetUpItemUseCallback(taskId);
}

void ItemUseOutOfBattle_DynamaxCandy(u8 taskId)
{
gItemUseCB = ItemUseCB_DynamaxCandy;
Expand Down Expand Up @@ -1311,16 +1305,14 @@ void ItemUseOutOfBattle_EnigmaBerry(u8 taskId)
case ITEM_EFFECT_CURE_FREEZE_FROSTBITE:
case ITEM_EFFECT_CURE_PARALYSIS:
case ITEM_EFFECT_CURE_ALL_STATUS:
gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU;
ItemUseOutOfBattle_Medicine(taskId);
case ITEM_EFFECT_ATK_EV:
case ITEM_EFFECT_HP_EV:
case ITEM_EFFECT_SPATK_EV:
case ITEM_EFFECT_SPDEF_EV:
case ITEM_EFFECT_SPEED_EV:
case ITEM_EFFECT_DEF_EV:
gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU;
ItemUseOutOfBattle_EVItem(taskId);
ItemUseOutOfBattle_Medicine(taskId);
break;
case ITEM_EFFECT_SACRED_ASH:
gTasks[taskId].tEnigmaBerryType = ITEM_USE_PARTY_MENU;
Expand Down
69 changes: 3 additions & 66 deletions src/party_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
#include "constants/party_menu.h"
#include "constants/rgb.h"
#include "constants/songs.h"
#include "ev_caps.h"

enum {
MENU_SUMMARY,
Expand Down Expand Up @@ -5743,71 +5742,9 @@ static void Task_TryLearningNextMove(u8 taskId)
}
}

void ItemUseCB_EVItem(u8 taskId, TaskFunc task)
static void CB2_ReturnToPartyMenuUsingRareCandy(void)
{
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
u16 *itemPtr = &gSpecialVar_ItemId;
bool8 cannotUseEffect;

// Apply the item effect using ExecuteTableBasedItemEffect, which calls PokemonUseItemEffects
cannotUseEffect = ExecuteTableBasedItemEffect(mon, *itemPtr, gPartyMenu.slotId, 0);

PlaySE(SE_SELECT);
if (cannotUseEffect)
{
gPartyMenuUseExitCallback = FALSE;
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
else
{
gPartyMenuUseExitCallback = TRUE;
RemoveBagItem(gSpecialVar_ItemId, 1);
GetMonNickname(mon, gStringVar1);
PlaySE(SE_USE_ITEM);
gPartyMenuUseExitCallback = FALSE;

// Determine the stat name based on the item used
switch (GetItemEffectType(*itemPtr))
{
case ITEM_EFFECT_HP_EV:
StringCopy(gStringVar2, gText_HP3);
break;
case ITEM_EFFECT_ATK_EV:
StringCopy(gStringVar2, gText_Attack3);
break;
case ITEM_EFFECT_DEF_EV:
StringCopy(gStringVar2, gText_Defense3);
break;
case ITEM_EFFECT_SPEED_EV:
StringCopy(gStringVar2, gText_Speed2);
break;
case ITEM_EFFECT_SPATK_EV:
StringCopy(gStringVar2, gText_SpAtk3);
break;
case ITEM_EFFECT_SPDEF_EV:
StringCopy(gStringVar2, gText_SpDef3);
break;
default:
// Handle unexpected item effect types if necessary
break;
}

// Generate the message
StringExpandPlaceholders(gStringVar4, gText_PkmnBaseVar2StatIncreased);
DisplayPartyMenuMessage(gStringVar4, FALSE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
}

static void CB2_ReturnToPartyMenuUsingItem(void)
{
if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy)
gItemUseCB = ItemUseCB_RareCandy;
else if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_EVItem)
gItemUseCB = ItemUseCB_EVItem;
gItemUseCB = ItemUseCB_RareCandy;
SetMainCallback2(CB2_ShowPartyMenuForItemUse);
}

Expand All @@ -5832,7 +5769,7 @@ static void PartyMenuTryEvolution(u8 taskId)
{
FreePartyPointers();
if (ItemId_GetFieldFunc(gSpecialVar_ItemId) == ItemUseOutOfBattle_RareCandy && gPartyMenu.menuType == PARTY_MENU_TYPE_FIELD && CheckBagHasItem(gSpecialVar_ItemId, 1))
gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingItem;
gCB2_AfterEvolution = CB2_ReturnToPartyMenuUsingRareCandy;
else
gCB2_AfterEvolution = gPartyMenu.exitCallback;
BeginEvolutionScene(mon, targetSpecies, evoModeNormal, gPartyMenu.slotId);
Expand Down

0 comments on commit 867e8db

Please sign in to comment.