Merge remote-tracking branch 'RHH/item_expansion' into RHH_masterMerge
# Conflicts: # src/battle_script_commands.c # src/data/pokemon/base_stats.h
This commit is contained in:
commit
e96c9c87fa
8 changed files with 134 additions and 10 deletions
|
@ -12,6 +12,7 @@ void ItemUseOutOfBattle_SSTicket(u8);
|
|||
void ItemUseOutOfBattle_WailmerPail(u8);
|
||||
void ItemUseOutOfBattle_Medicine(u8);
|
||||
void ItemUseOutOfBattle_AbilityCapsule(u8);
|
||||
void ItemUseOutOfBattle_AbilityPatch(u8);
|
||||
void ItemUseOutOfBattle_ReduceEV(u8);
|
||||
void ItemUseOutOfBattle_SacredAsh(u8);
|
||||
void ItemUseOutOfBattle_PPRecovery(u8);
|
||||
|
|
|
@ -50,6 +50,7 @@ void DrawHeldItemIconsForTrade(u8 *partyCounts, u8 *partySpriteIds, u8 whichPart
|
|||
void CB2_ShowPartyMenuForItemUse(void);
|
||||
void ItemUseCB_Medicine(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_AbilityPatch(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_ReduceEV(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_PPRecovery(u8 taskId, TaskFunc task);
|
||||
void ItemUseCB_PPUp(u8 taskId, TaskFunc task);
|
||||
|
|
|
@ -596,6 +596,18 @@ $(OBJEVENTGFXDIR)/berry_trees/colbur.4bpp: %.4bpp: %.png
|
|||
$(OBJEVENTGFXDIR)/berry_trees/roseli.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 4
|
||||
|
||||
$(OBJEVENTGFXDIR)/berry_trees/custap.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 4
|
||||
|
||||
$(OBJEVENTGFXDIR)/berry_trees/jaboca.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 4
|
||||
|
||||
$(OBJEVENTGFXDIR)/berry_trees/rowap.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 4
|
||||
|
||||
$(OBJEVENTGFXDIR)/berry_trees/micle.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 4
|
||||
|
||||
|
||||
$(OBJEVENTGFXDIR)/misc/breakable_rock.4bpp: %.4bpp: %.png
|
||||
$(GFX) $< $@ -mwidth 2 -mheight 2
|
||||
|
|
|
@ -9595,7 +9595,7 @@ bool32 CanBattlerGetOrLoseItem(u8 battlerId, u16 itemId)
|
|||
u16 holdEffect = ItemId_GetHoldEffect(itemId);
|
||||
|
||||
// Mail can be stolen now
|
||||
if (itemId == ITEM_ENIGMA_BERRY)
|
||||
if (itemId == ITEM_ENIGMA_BERRY_E_READER)
|
||||
return FALSE;
|
||||
// Primal Reversion inducing items cannot be lost if pokemon's base species can undergo primal reversion with it.
|
||||
else if (holdEffect == HOLD_EFFECT_PRIMAL_ORB && (GetPrimalReversionSpecies(GET_BASE_SPECIES_ID(species), itemId) != SPECIES_NONE))
|
||||
|
|
|
@ -846,7 +846,7 @@ const struct Item gItems[] =
|
|||
|
||||
[ITEM_CASTELIACONE] =
|
||||
{
|
||||
.name = _("CasteliaCone"),
|
||||
.name = _("Casteliacone"),
|
||||
.itemId = ITEM_CASTELIACONE,
|
||||
.price = 350,
|
||||
.description = sCasteliaconeDesc,
|
||||
|
@ -1095,7 +1095,7 @@ const struct Item gItems[] =
|
|||
.description = sAbilityPatchDesc,
|
||||
.pocket = POCKET_ITEMS,
|
||||
.type = ITEM_USE_PARTY_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
|
||||
.fieldUseFunc = ItemUseOutOfBattle_AbilityPatch,
|
||||
},
|
||||
|
||||
// Mints
|
||||
|
@ -7037,13 +7037,21 @@ const struct Item gItems[] =
|
|||
.flingPower = 10,
|
||||
},
|
||||
|
||||
#if defined(BATTLE_ENGINE) && B_CONFUSE_BERRIES_HEAL >= GEN_8
|
||||
#define CONFUSE_BERRY_HEAL_FRACTION 3
|
||||
#elif defined(BATTLE_ENGINE) && B_CONFUSE_BERRIES_HEAL == GEN_7
|
||||
#define CONFUSE_BERRY_HEAL_FRACTION 2
|
||||
#else
|
||||
#define CONFUSE_BERRY_HEAL_FRACTION 8
|
||||
#endif
|
||||
|
||||
[ITEM_FIGY_BERRY] =
|
||||
{
|
||||
.name = _("Figy Berry"),
|
||||
.itemId = ITEM_FIGY_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_CONFUSE_SPICY,
|
||||
.holdEffectParam = 8,
|
||||
.holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION,
|
||||
.description = sFigyBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
@ -7057,7 +7065,7 @@ const struct Item gItems[] =
|
|||
.itemId = ITEM_WIKI_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_CONFUSE_DRY,
|
||||
.holdEffectParam = 8,
|
||||
.holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION,
|
||||
.description = sWikiBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
@ -7071,7 +7079,7 @@ const struct Item gItems[] =
|
|||
.itemId = ITEM_MAGO_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_CONFUSE_SWEET,
|
||||
.holdEffectParam = 8,
|
||||
.holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION,
|
||||
.description = sMagoBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
@ -7085,7 +7093,7 @@ const struct Item gItems[] =
|
|||
.itemId = ITEM_AGUAV_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_CONFUSE_BITTER,
|
||||
.holdEffectParam = 8,
|
||||
.holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION,
|
||||
.description = sAguavBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
@ -7099,7 +7107,7 @@ const struct Item gItems[] =
|
|||
.itemId = ITEM_IAPAPA_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_CONFUSE_SOUR,
|
||||
.holdEffectParam = 8,
|
||||
.holdEffectParam = CONFUSE_BERRY_HEAL_FRACTION,
|
||||
.description = sIapapaBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
@ -7107,6 +7115,8 @@ const struct Item gItems[] =
|
|||
.flingPower = 10,
|
||||
},
|
||||
|
||||
#undef CONFUSE_BERRY_HEAL_FRACTION
|
||||
|
||||
[ITEM_RAZZ_BERRY] =
|
||||
{
|
||||
.name = _("Razz Berry"),
|
||||
|
@ -7479,7 +7489,7 @@ const struct Item gItems[] =
|
|||
.itemId = ITEM_COBA_BERRY,
|
||||
.price = 20,
|
||||
.holdEffect = HOLD_EFFECT_RESIST_BERRY,
|
||||
.holdEffectParam = TYPE_FIGHTING,
|
||||
.holdEffectParam = TYPE_FLYING,
|
||||
.description = sCobaBerryDesc,
|
||||
.pocket = POCKET_BERRIES,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
|
|
|
@ -3615,7 +3615,7 @@ static const u8 sPokeRadarDesc[] = _(
|
|||
|
||||
static const u8 sPokeblockCaseDesc[] = _(
|
||||
"A case for holding\n"
|
||||
"Pokéblocks made with\n"
|
||||
"{POKEBLOCK}s made with\n"
|
||||
"a Berry Blender.");
|
||||
|
||||
static const u8 sSootSackDesc[] = _(
|
||||
|
|
|
@ -756,6 +756,12 @@ void ItemUseOutOfBattle_AbilityCapsule(u8 taskId)
|
|||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_AbilityPatch(u8 taskId)
|
||||
{
|
||||
gItemUseCB = ItemUseCB_AbilityPatch;
|
||||
SetUpItemUseCallback(taskId);
|
||||
}
|
||||
|
||||
void ItemUseOutOfBattle_ReduceEV(u8 taskId)
|
||||
{
|
||||
gItemUseCB = ItemUseCB_ReduceEV;
|
||||
|
|
|
@ -4479,6 +4479,100 @@ void ItemUseCB_AbilityCapsule(u8 taskId, TaskFunc task)
|
|||
gTasks[taskId].func = Task_AbilityCapsule;
|
||||
}
|
||||
|
||||
void Task_AbilityPatch(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:
|
||||
|
||||
// If Hidden Abilities have been implemented without the use of Pokémon Expansion and added to the `abilities` field
|
||||
// as ability no. 3 (eg. {ABILITY_OVERGROW, ABILITY_NONE, ABILITY_CHLOROPHYLL} )
|
||||
// you can remove this #ifdef.
|
||||
#ifdef POKEMON_EXPANSION
|
||||
// Can't use.
|
||||
if (gBaseStats[tSpecies].abilities[tAbilityNum] == 0
|
||||
|| !tSpecies
|
||||
|| GetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, NULL) > 1
|
||||
)
|
||||
#endif
|
||||
{
|
||||
gPartyMenuUseExitCallback = FALSE;
|
||||
PlaySE(SE_SELECT);
|
||||
DisplayPartyMenuMessage(gText_WontHaveEffect, 1);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
|
||||
return;
|
||||
}
|
||||
gPartyMenuUseExitCallback = TRUE;
|
||||
GetMonNickname(&gPlayerParty[tMonId], gStringVar1);
|
||||
StringCopy(gStringVar2, gAbilityNames[GetAbilityBySpecies(tSpecies, tAbilityNum)]);
|
||||
StringExpandPlaceholders(gStringVar4, askText);
|
||||
PlaySE(SE_SELECT);
|
||||
DisplayPartyMenuMessage(gStringVar4, 1);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
if (!IsPartyMenuTextPrinterActive())
|
||||
{
|
||||
PartyMenuDisplayYesNoMenu();
|
||||
tState++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (Menu_ProcessInputNoWrapClearOnChoose())
|
||||
{
|
||||
case 0:
|
||||
tState++;
|
||||
break;
|
||||
case 1:
|
||||
case MENU_B_PRESSED:
|
||||
gPartyMenuUseExitCallback = FALSE;
|
||||
PlaySE(SE_SELECT);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
// Don't exit party selections screen, return to choosing a mon.
|
||||
ClearStdWindowAndFrameToTransparent(6, 0);
|
||||
ClearWindowTilemap(6);
|
||||
DisplayPartyMenuStdMessage(5);
|
||||
gTasks[taskId].func = (void *)GetWordTaskArg(taskId, tOldFunc);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
PlaySE(SE_USE_ITEM);
|
||||
StringExpandPlaceholders(gStringVar4, doneText);
|
||||
DisplayPartyMenuMessage(gStringVar4, 1);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
tState++;
|
||||
break;
|
||||
case 4:
|
||||
if (!IsPartyMenuTextPrinterActive())
|
||||
tState++;
|
||||
break;
|
||||
case 5:
|
||||
SetMonData(&gPlayerParty[tMonId], MON_DATA_ABILITY_NUM, &tAbilityNum);
|
||||
RemoveBagItem(gSpecialVar_ItemId, 1);
|
||||
gTasks[taskId].func = Task_ClosePartyMenu;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemUseCB_AbilityPatch(u8 taskId, TaskFunc task)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
tState = 0;
|
||||
tMonId = gPartyMenu.slotId;
|
||||
tSpecies = GetMonData(&gPlayerParty[tMonId], MON_DATA_SPECIES, NULL);
|
||||
tAbilityNum = 2;
|
||||
SetWordTaskArg(taskId, tOldFunc, (uintptr_t)(gTasks[taskId].func));
|
||||
gTasks[taskId].func = Task_AbilityPatch;
|
||||
}
|
||||
|
||||
#undef tState
|
||||
#undef tSpecies
|
||||
#undef tAbilityNum
|
||||
|
|
Loading…
Reference in a new issue