summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreatthepear <65027979+eatthepear@users.noreply.github.com>2020-10-29 16:01:37 -0400
committereatthepear <65027979+eatthepear@users.noreply.github.com>2020-10-29 16:01:37 -0400
commite3fd2d724c4bf861e8eb1c0edaa2457f3d7d59ed (patch)
tree3dd171cb625a4abd2cd4d6ca4d9448b01267f236
parent33d4e06f93070fd2e842a12658a474a3e97be6b2 (diff)
This tutorial did not include the held item effect changes, so I've added those.
-rw-r--r--Update-Sitrus-Berry's-effect-to-Gen-4-standard.md53
1 files changed, 53 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
index 3665f61..e998ed3 100644
--- a/Update-Sitrus-Berry's-effect-to-Gen-4-standard.md
+++ b/Update-Sitrus-Berry's-effect-to-Gen-4-standard.md
@@ -5,6 +5,8 @@ In Generation III the Sitrus Berry healed only 30 HP, an effect inherited from t
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)
+4. [Edit the held item effect](#4-edit-the-held-item-effect)
+5. [Add hold effect define and usage for non-battle engine users](#5-add-hold-effect-define-and-usage)
## 1. Define a new constant
@@ -59,4 +61,55 @@ Edit `src\pokemon.c` (inside the intimidatingly large function `PokemonUseItemEf
}
```
+## 4. Edit the held item effect
+
+So far, we've only edited the outside of battle effects of the Sitrus Berry. Go to `src\data\items.h` and look for the Sitrus Berry. There are two important lines here:
+```diff
+ .holdEffect = HOLD_EFFECT_RESTORE_HP,
+ .holdEffectParam = 30,
+```
+We'll want to change these to:
+```diff
+ .holdEffect = HOLD_EFFECT_RESTORE_PCT_HP,
+ .holdEffectParam = 25, //restores 25% of the max HP
+```
+
+If you're using the battle engine by Dizzyegg/rhh, you're all done! Otherwise, you'll need to do step 5.
+
+## 5. Add hold effect define and usage
+
+Go to `include\constants\hold_effects.h` and define a new hold effect:
+```diff
+ #define HOLD_EFFECT_RESTORE_PCT_HP 67
+```
+
+Now go to `src/battle_util.c` and look for this section in the function `ItemBattleEffects`
+```diff
+ case HOLD_EFFECT_RESTORE_HP:
+ if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
+ {
+ gBattleMoveDamage = battlerHoldEffectParam;
+ if (gBattleMons[battlerId].hp + battlerHoldEffectParam > gBattleMons[battlerId].maxHP)
+ gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
+ gBattleMoveDamage *= -1;
+ BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
+ effect = 4;
+ }
+ break;
+```
+You're going to want to add another case directly below this case. Copy paste this in:
+```diff
+ case HOLD_EFFECT_RESTORE_PCT_HP:
+ if (gBattleMons[battlerId].hp <= gBattleMons[battlerId].maxHP / 2 && !moveTurn)
+ {
+ gBattleMoveDamage = (gBattleMons[battlerId].maxHP * battlerHoldEffectParam) / 100;
+ if (gBattleMons[battlerId].hp + battlerHoldEffectParam > gBattleMons[battlerId].maxHP)
+ gBattleMoveDamage = gBattleMons[battlerId].maxHP - gBattleMons[battlerId].hp;
+ gBattleMoveDamage *= -1;
+ BattleScriptExecute(BattleScript_ItemHealHP_RemoveItem);
+ effect = 4;
+ }
+ break;
+```
+
That's all! \ No newline at end of file