forked from DizzyEggg/pokeemerald
-
Notifications
You must be signed in to change notification settings - Fork 3
Update Sitrus Berry's effect to Gen 4 standard
Thomas Winwood edited this page Oct 10, 2020
·
4 revisions
In Generation III the Sitrus Berry healed only 30 HP, an effect inherited from the Gold Berry in Generation II. In Generation IV it was improved to heal one quarter of the user's max HP.
Edit include/constants/item_effects.h
:
// Special HP recovery amounts for ITEM4_HEAL_HP
#define ITEM6_HEAL_FULL ((u8) -1)
#define ITEM6_HEAL_HALF ((u8) -2)
-#define ITEM6_HEAL_LVL_UP ((u8) -3)
+#define ITEM6_HEAL_QUARTER ((u8) -3)
+#define ITEM6_HEAL_LVL_UP ((u8) -4)
Edit src/data/pokemon/item_effects.h
:
const u8 gItemEffect_SitrusBerry[7] = {
[4] = ITEM4_HEAL_HP,
- [6] = 30,
+ [6] = ITEM6_HEAL_QUARTER,
};
Edit src\pokemon.c
(inside the intimidatingly large function PokemonUseItemEffects
):
// Get amount of HP to restore
dataUnsigned = itemEffect[var_3C++];
switch (dataUnsigned)
{
case ITEM6_HEAL_FULL:
dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) - GetMonData(mon, MON_DATA_HP, NULL);
break;
case ITEM6_HEAL_HALF:
dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 2;
if (dataUnsigned == 0)
dataUnsigned = 1;
break;
+case ITEM6_HEAL_QUARTER:
+ dataUnsigned = GetMonData(mon, MON_DATA_MAX_HP, NULL) / 4;
+ if (dataUnsigned == 0)
+ dataUnsigned = 1;
+ break;
case ITEM6_HEAL_LVL_UP:
dataUnsigned = gBattleScripting.levelUpHP;
break;
}
That's all!