Merge pull request #1691 from AsparagusEduardo/item_sitrus

Sitrus Berry Gen4+ heal. Credit to SBird1337
This commit is contained in:
ultima-soul 2021-10-04 15:18:12 -07:00 committed by GitHub
commit 7f5204a09f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 5 deletions

View File

@ -17,6 +17,7 @@
#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.
// Ball config
#define I_LURE_BALL_MODIFIER GEN_7 // In Gen7+, Lure Ball's catch multiplier is x5 instead of x3.

View File

@ -58,6 +58,7 @@
#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

@ -1852,8 +1852,13 @@ const struct Item gItems[] =
.name = _("Sitrus Berry"),
.itemId = ITEM_SITRUS_BERRY,
.price = 20,
#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,

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

@ -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