summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemy Oukaour <remy.oukaour@gmail.com>2018-05-05 20:04:31 -0400
committerRemy Oukaour <remy.oukaour@gmail.com>2018-05-05 20:04:31 -0400
commit8089256c8f62dc25f266da7a6e3650fa7d91bd73 (patch)
treeedd59275ac36aa697cf3163d381d21162b229e9b
parentd21cf56f65892dcbe5d3820f4807d7d89c74a7bc (diff)
Lava Cookie
-rw-r--r--Add-different-kinds-of-new-items.md70
-rw-r--r--screenshots/lava-cookie.pngbin0 -> 2930 bytes
2 files changed, 67 insertions, 3 deletions
diff --git a/Add-different-kinds-of-new-items.md b/Add-different-kinds-of-new-items.md
index 6ed8213..d1377e0 100644
--- a/Add-different-kinds-of-new-items.md
+++ b/Add-different-kinds-of-new-items.md
@@ -144,7 +144,7 @@ Anyway, that's all you need to add a basic item:
### `RestoreHPEffect`: Sweet Heart
-A Sweet Heart, from Gen 5, restores 20 HP. It can be used on the field or during battle, and enemy trainer AI should know how to use one too.
+A Sweet Heart, from Gen 5, restores 20 HP, just like RageCandyBar. It can be used on the field or during battle, and enemy trainer AI should know how to use one too.
First, add the essential data. Replace `ITEM_2D` with `SWEET_HEART`; give it a name, description, and attributes (`item_attribute 100, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_PARTY`); give it the `RestoreHPEffect`; and remove `ITEM_2D` from `TimeCapsule_CatchRateItems`.
@@ -164,7 +164,7 @@ Edit [data/items/heal_hp.asm](../blob/master/data/items/heal_hp.asm):
`HealingHPAmounts` is used by `GetHealingItemAmount`, which is called by `ItemRestoreHP`, which is called by `RestoreHPEffect`, which is the effect we already assigned to Sweet Heart; so now it will successfully heal 20 HP when used by the player.
-Edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm):
+Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm):
```diff
AI_Items: ; 39196
@@ -212,7 +212,71 @@ Now if a trainer has a Sweet Heart (as defined in [data/trainers/attributes.asm]
### `StatusHealingEffect`: Lava Cookie
-TODO
+A Lava Cookie, from Gen 3, heals any status condition, just like Full Heal. It can be used on the field or during battle, and enemy trainer AI should know how to use one too.
+
+First, add the essential data. Replace `ITEM_32` with `LAVA_COOKIE`; give it a name, description, and attributes (`item_attribute 200, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_PARTY, ITEMMENU_PARTY`); give it the `StatusHealingEffect`; and remove `ITEM_32` from `TimeCapsule_CatchRateItems`.
+
+Then it's time to implement the specific status-healing effect.
+
+Edit [data/items/heal_status.asm](../blob/master/data/items/heal_status.asm):
+
+```diff
+ StatusHealingActions: ; f071
+ ; item, party menu action text, status
+ db ANTIDOTE, PARTYMENUTEXT_HEAL_PSN, 1 << PSN
+ ...
+ db MIRACLEBERRY, PARTYMENUTEXT_HEAL_ALL, %11111111
++ db LAVA_COOKIE, PARTYMENUTEXT_HEAL_ALL, %11111111
+ db -1, 0, 0 ; end
+ ; f09e
+```
+
+`%11111111` is a bit mask for all status conditions, but that particular value is checked for by `HealStatus` to allow healing confusion as well. A different value, like `1 << PSN` or `(1 << BRN) | (1 << FRZ)`, could be used to heal only certain conditions.
+
+`StatusHealingActions` is used by `GetItemHealingAction`, which is called by `UseStatusHealer`, which is called by `StatusHealingEffect`, which is the effect we already assigned to Lava Cookie; so now it will successfully heal all status conditions when used by the player.
+
+Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm):
+
+```diff
+ AI_Items: ; 39196
+ dbw FULL_RESTORE, .FullRestore
+ ...
+ dbw X_SPECIAL, .XSpecial
++ dbw LAVA_COOKIE, .LavaCookie
+ db -1 ; end
+ ; 381be
+
+ .FullHeal: ; 381be
+ call .Status
+ jp c, .DontUse
+ call EnemyUsedFullHeal
+ jp .Use
+ ; 381ca
+
++.LavaCookie:
++ call .Status
++ jp c, .DontUse
++ call EnemyUsedLavaCookie
++ jp .Use
+
+ ...
+
+ EnemyUsedFullHeal: ; 383a3 (e:43a3)
+ call AIUsedItemSound
+ call AI_HealStatus
+ ld a, FULL_HEAL
+ jp PrintText_UsedItemOn_AND_AIUpdateHUD
+
++EnemyUsedLavaCookie:
++ call AIUsedItemSound
++ call AI_HealStatus
++ ld a, LAVA_COOKIE
++ jp PrintText_UsedItemOn_AND_AIUpdateHUD
+```
+
+Now if a trainer has a Lava Cookie (as defined in [data/trainers/attributes.asm](../blob/master/data/trainers/attributes.asm)) they'll be able to use it. The `.Status` subroutine called by `.LavaCookie` determines whether the healing item will be used, with different random chances depending on the enemy AI and the battle situation; and the `EnemyUsedLavaCookie` routine does the whole process of healing status, playing the sound effect, etc.
+
+![Screenshot](screenshots/lava-cookie.png)
### `PokeBallEffect`: Dusk Ball
diff --git a/screenshots/lava-cookie.png b/screenshots/lava-cookie.png
new file mode 100644
index 0000000..a26afec
--- /dev/null
+++ b/screenshots/lava-cookie.png
Binary files differ