mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Ability Capsule
This commit is contained in:
parent
17be6766c7
commit
51bfdffac3
@ -49,7 +49,9 @@
|
||||
|
||||
#define ITEM5_FRIENDSHIP_ALL (ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID | ITEM5_FRIENDSHIP_HIGH)
|
||||
|
||||
// fields 6 and onwards are item-specific arguments
|
||||
// fields 6 - 9 are item-specific arguments
|
||||
|
||||
#define ITEM10_IS_VITAMIN 0x1
|
||||
|
||||
// Used for GetItemEffectType.
|
||||
#define ITEM_EFFECT_X_ITEM 0
|
||||
|
@ -25,6 +25,7 @@ void sub_80C9D00(u8);
|
||||
void ItemUseOutOfBattle_WailmerPail(u8);
|
||||
void sub_80C9D74(u8);
|
||||
void ItemUseOutOfBattle_Medicine(u8);
|
||||
void ItemUseOutOfBattle_AbilityCapsule(u8);
|
||||
void ItemUseOutOfBattle_ReduceEV(u8);
|
||||
void ItemUseOutOfBattle_SacredAsh(u8);
|
||||
void ItemUseOutOfBattle_PPRecovery(u8);
|
||||
|
@ -71,6 +71,7 @@ void LoadHeldItemIcons(void);
|
||||
void sub_81B5D4C(u8 *a, u8 *b, u8 c);
|
||||
void sub_81B617C(void);
|
||||
void ItemUseCB_Medicine(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task);
|
||||
void sub_81B67C8(u8 taskId, TaskFunc task);
|
||||
void dp05_ether(u8 taskId, TaskFunc task);
|
||||
void dp05_pp_up(u8 taskId, TaskFunc task);
|
||||
|
@ -1216,8 +1216,8 @@ const struct Item gItems[] =
|
||||
.holdEffectParam = 0,
|
||||
.description = sAbilityCapsuleDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = 4,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Placeholder
|
||||
.type = 1,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_AbilityCapsule,
|
||||
.secondaryId = 0,
|
||||
},
|
||||
|
||||
|
@ -180,7 +180,7 @@ const u8 gItemEffect_HPUp[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Protein[11] = {
|
||||
@ -190,7 +190,7 @@ const u8 gItemEffect_Protein[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Iron[11] = {
|
||||
@ -199,7 +199,7 @@ const u8 gItemEffect_Iron[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Carbos[11] = {
|
||||
@ -208,7 +208,7 @@ const u8 gItemEffect_Carbos[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Calcium[11] = {
|
||||
@ -217,7 +217,7 @@ const u8 gItemEffect_Calcium[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_Zinc[11] = {
|
||||
@ -226,7 +226,7 @@ const u8 gItemEffect_Zinc[11] = {
|
||||
[7] = 5,
|
||||
[8] = 3,
|
||||
[9] = 2,
|
||||
[10] = 1,
|
||||
[10] = ITEM10_IS_VITAMIN,
|
||||
};
|
||||
|
||||
const u8 gItemEffect_HpWing[11] = {
|
||||
|
@ -726,6 +726,12 @@ void ItemUseOutOfBattle_Medicine(u8 taskId)
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_AbilityCapsule(u8 taskId)
|
||||
{
|
||||
gUnknown_03006328 = ItemUseCB_AbilityCapsule;
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_ReduceEV(u8 taskId)
|
||||
{
|
||||
gUnknown_03006328 = sub_81B67C8;
|
||||
|
@ -5482,6 +5482,100 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task)
|
||||
}
|
||||
}
|
||||
|
||||
#define tState data[0]
|
||||
#define tSpecies data[1]
|
||||
#define tAbilityNum data[2]
|
||||
#define tMonId data[3]
|
||||
#define tOldFunc 4
|
||||
|
||||
void Task_AbilityCapsule(u8 taskId)
|
||||
{
|
||||
static const u8 askText[] = _("Would you like to change {STR_VAR_1}'s\nability to {STR_VAR_2}?");
|
||||
static const u8 doneText[] = _("{STR_VAR_1}'s ability became\n{STR_VAR_2}!{PAUSE_UNTIL_PRESS}");
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
switch (tState)
|
||||
{
|
||||
case 0:
|
||||
// Can't use.
|
||||
if (gBaseStats[tSpecies].abilities[0] == gBaseStats[tSpecies].abilities[1]
|
||||
|| gBaseStats[tSpecies].abilities[1] == 0
|
||||
|| tAbilityNum > 1
|
||||
|| !tSpecies)
|
||||
{
|
||||
gUnknown_0203CEE8 = 0;
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81B1B5C(gText_WontHaveEffect, 1);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
gTasks[taskId].func = sub_81B6794;
|
||||
return;
|
||||
}
|
||||
gUnknown_0203CEE8 = 1;
|
||||
GetMonNickname(&gPlayerParty[tMonId], gStringVar1);
|
||||
StringCopy(gStringVar2, gAbilityNames[GetAbilityBySpecies(tSpecies, tAbilityNum)]);
|
||||
StringExpandPlaceholders(gStringVar4, askText);
|
||||
PlaySE(SE_SELECT);
|
||||
sub_81B1B5C(gStringVar4, 1);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
if (!sub_81B1BD4())
|
||||
{
|
||||
sub_81B334C();
|
||||
tState++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
||||
{
|
||||
case 0:
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
case MENU_B_PRESSED:
|
||||
gUnknown_0203CEE8 = 0;
|
||||
PlaySE(SE_SELECT);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
// Don't exit party selections screen, return to choosing a mon.
|
||||
ClearStdWindowAndFrameToTransparent(6, 0);
|
||||
ClearWindowTilemap(6);
|
||||
display_pokemon_menu_message(5);
|
||||
gTasks[taskId].func = (void *)GetWordTaskArg(taskId, tOldFunc);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
PlaySE(SE_KAIFUKU);
|
||||
StringExpandPlaceholders(gStringVar4, doneText);
|
||||
sub_81B1B5C(gStringVar4, 1);
|
||||
schedule_bg_copy_tilemap_to_vram(2);
|
||||
tState++;
|
||||
break;
|
||||
case 4:
|
||||
if (!sub_81B1BD4())
|
||||
tState++;
|
||||
break;
|
||||
case 5:
|
||||
SetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, &tAbilityNum);
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
gTasks[taskId].func = sub_81B12C0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
tState = 0;
|
||||
tMonId = gUnknown_0203CEC8.slotId;
|
||||
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES, NULL);
|
||||
tAbilityNum = GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, NULL) ^ 1;
|
||||
SetWordTaskArg(taskId, tOldFunc, (uintptr_t)(gTasks[taskId].func));
|
||||
gTasks[taskId].func = Task_AbilityCapsule;
|
||||
}
|
||||
|
||||
static void sub_81B672C(u8 taskId)
|
||||
{
|
||||
GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1);
|
||||
|
@ -4818,7 +4818,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
if (evCount >= MAX_TOTAL_EVS)
|
||||
return TRUE;
|
||||
|
||||
if (itemEffect[10])
|
||||
if (itemEffect[10] & ITEM10_IS_VITAMIN)
|
||||
evCap = 100;
|
||||
else
|
||||
evCap = 252;
|
||||
@ -5028,7 +5028,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
|
||||
if (evCount >= MAX_TOTAL_EVS)
|
||||
return TRUE;
|
||||
|
||||
if (itemEffect[10])
|
||||
if (itemEffect[10] & ITEM10_IS_VITAMIN)
|
||||
evCap = 100;
|
||||
else
|
||||
evCap = 252;
|
||||
|
Loading…
Reference in New Issue
Block a user