Merge branch 'item_expansion' of github.com:rh-hideout/pokeemerald-expansion into item_id_revamp

This commit is contained in:
ultima-soul 2021-10-05 19:25:52 -07:00
commit 06f36595d6
8 changed files with 90 additions and 26 deletions

View File

@ -29,7 +29,7 @@
#define HOLD_EFFECT_EXP_SHARE 25
#define HOLD_EFFECT_QUICK_CLAW 26
#define HOLD_EFFECT_FRIENDSHIP_UP 27
#define HOLD_EFFECT_CURE_ATTRACT 28
#define HOLD_EFFECT_MENTAL_HERB 28
#define HOLD_EFFECT_CHOICE_BAND 29
#define HOLD_EFFECT_FLINCH 30
#define HOLD_EFFECT_BUG_POWER 31
@ -134,6 +134,7 @@
#define HOLD_EFFECT_LUMINOUS_MOSS 142
#define HOLD_EFFECT_SNOWBALL 143
#define HOLD_EFFECT_WEAKNESS_POLICY 144
#define HOLD_EFFECT_PRIMAL_ORB 145
// Gen7 hold effects
#define HOLD_EFFECT_PROTECTIVE_PADS 154
@ -153,4 +154,10 @@
#define HOLD_EFFECT_CHOICE(holdEffect)((holdEffect == HOLD_EFFECT_CHOICE_BAND || holdEffect == HOLD_EFFECT_CHOICE_SCARF || holdEffect == HOLD_EFFECT_CHOICE_SPECS))
// Terrain seed params
#define HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN 0
#define HOLD_EFFECT_PARAM_GRASSY_TERRAIN 1
#define HOLD_EFFECT_PARAM_MISTY_TERRAIN 2
#define HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN 3
#endif // GUARD_HOLD_EFFECTS_H

View File

@ -17,5 +17,6 @@
#define I_KEY_FOSSILS GEN_7 // In Gen4+, all Gen 3 fossils became regular items.
#define I_KEY_ESCAPE_ROPE GEN_7 // In Gen8, Escape Rope became a Key Item. Keep in mind, this will make it free to buy in marts.
#define I_LEGACY_HEALING_ITEMS GEN_7 // In Gen7+, certain healing items recover less HP than they used to.
#define I_SITRUS_BERRY_HEAL GEN_7 // In Gen4+, Sitrus Berry was changed from healing 30 HP to healing 25% of Max HP.
#endif // GUARD_CONSTANTS_ITEM_CONFIG_H

View File

@ -55,9 +55,10 @@
#define ITEM_EFFECT_ARG_START 6
// Special HP recovery amounts for ITEM4_HEAL_HP
#define ITEM6_HEAL_HP_FULL ((u8) -1)
#define ITEM6_HEAL_HP_HALF ((u8) -2)
#define ITEM6_HEAL_HP_LVL_UP ((u8) -3)
#define ITEM6_HEAL_HP_FULL ((u8) -1)
#define ITEM6_HEAL_HP_HALF ((u8) -2)
#define ITEM6_HEAL_HP_LVL_UP ((u8) -3)
#define ITEM6_HEAL_HP_QUARTER ((u8) -4)
// Special PP recovery amounts for ITEM4_HEAL_PP
#define ITEM6_HEAL_PP_FULL 0x7F

View File

@ -3665,7 +3665,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
effect = ITEM_STATUS_CHANGE;
}
break;
case HOLD_EFFECT_CURE_ATTRACT:
case HOLD_EFFECT_MENTAL_HERB:
if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION)
{
gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION);
@ -3768,7 +3768,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
effect = ITEM_EFFECT_OTHER;
}
break;
case HOLD_EFFECT_CURE_ATTRACT:
case HOLD_EFFECT_MENTAL_HERB:
if (gBattleMons[battlerId].status2 & STATUS2_INFATUATION)
{
gBattleMons[battlerId].status2 &= ~(STATUS2_INFATUATION);

View File

@ -1490,12 +1490,12 @@ const struct Item gItems[] =
.itemId = ITEM_ESCAPE_ROPE,
.description = sEscapeRopeDesc,
#if I_KEY_ESCAPE_ROPE >= GEN_8
.price = 0,
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
.price = 0,
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
#else
.price = 1000,
.pocket = POCKET_ITEMS,
.price = 1000,
.pocket = POCKET_ITEMS,
#endif
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_EscapeRope,
@ -2966,8 +2966,14 @@ const struct Item gItems[] =
.holdEffectParam = 0,
.description = sRedNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Placeholder
#ifdef POKEMON_EXPANSION
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.secondaryId = FORM_ITEM_USE,
#else
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
#endif
},
[ITEM_YELLOW_NECTAR] =
@ -2978,8 +2984,14 @@ const struct Item gItems[] =
.holdEffectParam = 0,
.description = sYellowNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Placeholder
#ifdef POKEMON_EXPANSION
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.secondaryId = FORM_ITEM_USE,
#else
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
#endif
},
[ITEM_PINK_NECTAR] =
@ -2990,8 +3002,14 @@ const struct Item gItems[] =
.holdEffectParam = 0,
.description = sPinkNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Placeholder
#ifdef POKEMON_EXPANSION
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.secondaryId = FORM_ITEM_USE,
#else
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
#endif
},
[ITEM_PURPLE_NECTAR] =
@ -3002,8 +3020,14 @@ const struct Item gItems[] =
.holdEffectParam = 0,
.description = sPurpleNectarDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Placeholder
#ifdef POKEMON_EXPANSION
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_FormChange_ConsumedOnUse,
.secondaryId = FORM_ITEM_USE,
#else
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
#endif
},
// Plates
@ -5640,6 +5664,7 @@ const struct Item gItems[] =
.itemId = ITEM_ELECTRIC_SEED,
.price = 4000,
.holdEffect = HOLD_EFFECT_SEEDS,
.holdEffectParam = HOLD_EFFECT_PARAM_ELECTRIC_TERRAIN,
.description = sElectricSeedDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
@ -5652,6 +5677,7 @@ const struct Item gItems[] =
.itemId = ITEM_PSYCHIC_SEED,
.price = 4000,
.holdEffect = HOLD_EFFECT_SEEDS,
.holdEffectParam = HOLD_EFFECT_PARAM_PSYCHIC_TERRAIN,
.description = sPsychicSeedDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
@ -5664,6 +5690,7 @@ const struct Item gItems[] =
.itemId = ITEM_MISTY_SEED,
.price = 4000,
.holdEffect = HOLD_EFFECT_SEEDS,
.holdEffectParam = HOLD_EFFECT_PARAM_MISTY_TERRAIN,
.description = sMistySeedDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
@ -5676,6 +5703,7 @@ const struct Item gItems[] =
.itemId = ITEM_GRASSY_SEED,
.price = 4000,
.holdEffect = HOLD_EFFECT_SEEDS,
.holdEffectParam = HOLD_EFFECT_PARAM_GRASSY_TERRAIN,
.description = sGrassySeedDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
@ -5805,7 +5833,7 @@ const struct Item gItems[] =
.name = _("Mental Herb"),
.itemId = ITEM_MENTAL_HERB,
.price = 4000,
.holdEffect = HOLD_EFFECT_CURE_ATTRACT,
.holdEffect = HOLD_EFFECT_MENTAL_HERB,
.description = sMentalHerbDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
@ -6550,8 +6578,13 @@ const struct Item gItems[] =
.name = _("Sitrus Berry"),
.itemId = ITEM_SITRUS_BERRY,
.price = 20,
.holdEffect = HOLD_EFFECT_RESTORE_HP,
.holdEffectParam = 30,
#if defined(BATTLE_ENGINE) && I_SITRUS_BERRY_HEAL >= GEN_4
.holdEffect = HOLD_EFFECT_RESTORE_PCT_HP,
.holdEffectParam = 25,
#else
.holdEffect = HOLD_EFFECT_RESTORE_HP,
.holdEffectParam = 30,
#endif
.description = sSitrusBerryDesc,
.pocket = POCKET_BERRIES,
.type = ITEM_USE_PARTY_MENU,
@ -6968,7 +7001,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,
@ -8535,9 +8568,15 @@ const struct Item gItems[] =
.price = 0,
.holdEffect = HOLD_EFFECT_GRACIDEA,
.description = sGracideaDesc,
.pocket = POCKET_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
.pocket = POCKET_KEY_ITEMS,
#ifdef POKEMON_EXPANSION
.type = ITEM_USE_PARTY_MENU,
.fieldUseFunc = ItemUseOutOfBattle_FormChange,
.secondaryId = FORM_ITEM_USE_TIME,
#else
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse,
#endif
},
[ITEM_REVEAL_GLASS] = // Todo

View File

@ -440,7 +440,11 @@ const u8 gItemEffect_LumBerry[6] = {
const u8 gItemEffect_SitrusBerry[7] = {
[4] = ITEM4_HEAL_HP,
#if I_SITRUS_BERRY_HEAL >= GEN_4
[6] = ITEM6_HEAL_HP_QUARTER,
#else
[6] = 30, // Amount of HP to recover
#endif
};
#define EV_BERRY_FRIENDSHIP_CHANGE \

View File

@ -2164,10 +2164,17 @@ static const u8 sSootheBellDesc[] = _(
"calms spirits and\n"
"fosters friendship.");
#if defined(BATTLE_ENGINE) && B_MENTAL_HERB >= GEN_5
static const u8 sMentalHerbDesc[] = _(
"Snaps Pokémon out\n"
"of move-binding\n"
"effects.");
#else
static const u8 sMentalHerbDesc[] = _(
"A hold item that\n"
"snaps Pokémon out\n"
"of infatuation.");
#endif
static const u8 sKingsRockDesc[] = _(
"A hold item that\n"

View File

@ -4989,6 +4989,11 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
case ITEM6_HEAL_HP_LVL_UP:
dataUnsigned = gBattleScripting.levelUpHP;
break;
case ITEM6_HEAL_HP_QUARTER:
dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 4;
if (dataUnsigned == 0)
dataUnsigned = 1;
break;
}
// Only restore HP if not at max health