From 4fbe4da7d02ccf5c266cf648805f5f5be46f84ca Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Sun, 26 Sep 2021 18:46:34 -0300 Subject: [PATCH] Sitrus Berry Gen4+ heal. Credit to SBird1337 --- include/constants/item_config.h | 1 + include/constants/item_effects.h | 7 ++++--- src/data/pokemon/item_effects.h | 4 ++++ src/pokemon.c | 5 +++++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/constants/item_config.h b/include/constants/item_config.h index 4df5fab18a..59f3ceb39a 100644 --- a/include/constants/item_config.h +++ b/include/constants/item_config.h @@ -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. diff --git a/include/constants/item_effects.h b/include/constants/item_effects.h index 0a96b9e440..ee7461c4f1 100644 --- a/include/constants/item_effects.h +++ b/include/constants/item_effects.h @@ -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 diff --git a/src/data/pokemon/item_effects.h b/src/data/pokemon/item_effects.h index 9fc10dbd0a..60e577238a 100644 --- a/src/data/pokemon/item_effects.h +++ b/src/data/pokemon/item_effects.h @@ -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 \ diff --git a/src/pokemon.c b/src/pokemon.c index ae9f02500e..e9c50fb666 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -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