Sitrus Berry Gen4+ heal. Credit to SBird1337

This commit is contained in:
Eduardo Quezada D'Ottone 2021-09-26 18:46:34 -03:00
parent 3ab909f165
commit 4fbe4da7d0
4 changed files with 14 additions and 3 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

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

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