diff options
author | Thomas Winwood <twwinwood@gmail.com> | 2020-10-10 09:02:20 +0100 |
---|---|---|
committer | Thomas Winwood <twwinwood@gmail.com> | 2020-10-10 09:02:20 +0100 |
commit | 8aed5d1406f7545ca4d1f30a0bd773212dfa4364 (patch) | |
tree | 7ec7c9b37c6b8a63768caabcc688395656734f4b | |
parent | 11fe152b56d441bed3f15dea08a61c8f34b53b80 (diff) |
Created Update Sitrus Berry's effect to Gen 4 standard (markdown)
-rw-r--r-- | Update-Sitrus-Berry's-effect-to-Gen-4-standard.md | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/Update-Sitrus-Berry's-effect-to-Gen-4-standard.md b/Update-Sitrus-Berry's-effect-to-Gen-4-standard.md new file mode 100644 index 0000000..3665f61 --- /dev/null +++ b/Update-Sitrus-Berry's-effect-to-Gen-4-standard.md @@ -0,0 +1,62 @@ +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. + +## Contents + +1. [Define a constant](#1-define-a-constant) +2. [Use the constant](#2-use-the-constant) +3. [Teach the game what to do with it](#3-teach-the-game-what-to-do-with-it) + +## 1. Define a new constant + +Edit `include/constants/item_effects.h`: + +```diff + // 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) +``` + +## 2. Use the constant + +Edit `src/data/pokemon/item_effects.h`: + +```diff + const u8 gItemEffect_SitrusBerry[7] = { + [4] = ITEM4_HEAL_HP, +- [6] = 30, ++ [6] = ITEM6_HEAL_QUARTER, + }; +``` + +## 3. Teach the game what to do with it + +Edit `src\pokemon.c` (inside the intimidatingly large function `PokemonUseItemEffects`): + +```diff + // 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!
\ No newline at end of file |