summaryrefslogtreecommitdiff
path: root/Add-different-kinds-of-new-items.md
diff options
context:
space:
mode:
authorRangi <remy.oukaour+rangi42@gmail.com>2018-06-24 22:48:58 -0400
committerRangi <remy.oukaour+rangi42@gmail.com>2018-06-24 22:48:58 -0400
commitcd7e915b044213918291bc9d26ce6f6682405737 (patch)
tree9d8d958b719591e37209bba292b2e2b80bec187b /Add-different-kinds-of-new-items.md
parent662cd29ce7cd56e419cde80480b656799ed47780 (diff)
Remove address comments
Diffstat (limited to 'Add-different-kinds-of-new-items.md')
-rw-r--r--Add-different-kinds-of-new-items.md50
1 files changed, 18 insertions, 32 deletions
diff --git a/Add-different-kinds-of-new-items.md b/Add-different-kinds-of-new-items.md
index 26264b0..d179c11 100644
--- a/Add-different-kinds-of-new-items.md
+++ b/Add-different-kinds-of-new-items.md
@@ -130,7 +130,7 @@ Edit [data/items/item_effects.asm](../blob/master/data/items/item_effects.asm):
And last, edit [data/items/catch_rate_items.asm](../blob/master/data/items/catch_rate_items.asm):
```diff
- TimeCapsule_CatchRateItems: ; 28785
+ TimeCapsule_CatchRateItems:
- db ITEM_19, LEFTOVERS
```
@@ -154,13 +154,12 @@ Then it's time to implement the specific HP healing amount for Sweet Heart. Noti
Edit [data/items/heal_hp.asm](../blob/master/data/items/heal_hp.asm):
```diff
- HealingHPAmounts: ; f3af
+ HealingHPAmounts:
dbw FRESH_WATER, 50
...
dbw BERRY_JUICE, 20
+ dbw SWEET_HEART, 20
dbw -1, 0 ; end
-; f3df
```
`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.
@@ -168,24 +167,22 @@ Edit [data/items/heal_hp.asm](../blob/master/data/items/heal_hp.asm):
Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm):
```diff
- AI_Items: ; 39196
+ AI_Items:
dbw FULL_RESTORE, .FullRestore
...
dbw X_SPECIAL, .XSpecial
+ dbw SWEET_HEART, .SweetHeart
db -1 ; end
- ; 381be
...
- .Potion: ; 382a0
+ .Potion:
call .HealItem
jp c, .DontUse
ld b, 20
call EnemyUsedPotion
jp .Use
- ; 382ae
-
++
+.SweetHeart:
+ call .HealItem
+ jp c, .DontUse
@@ -195,11 +192,11 @@ Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm)
...
- EnemyUsedPotion: ; 383e8
+ EnemyUsedPotion:
ld a, POTION
ld b, 20
jr EnemyPotionContinue
-
++
+EnemyUsedSweetHeart:
+ ld a, SWEET_HEART
+ ld b, 20
@@ -220,14 +217,13 @@ First, add the essential data. Replace `ITEM_32` with `LAVA_COOKIE`; give it a n
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
+ StatusHealingActions:
; 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.
@@ -237,21 +233,19 @@ Then it's time to implement the specific status-healing effect. Edit [data/items
Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm):
```diff
- AI_Items: ; 39196
+ AI_Items:
dbw FULL_RESTORE, .FullRestore
...
dbw X_SPECIAL, .XSpecial
+ dbw LAVA_COOKIE, .LavaCookie
db -1 ; end
- ; 381be
- .FullHeal: ; 381be
+ .FullHeal:
call .Status
jp c, .DontUse
call EnemyUsedFullHeal
jp .Use
- ; 381ca
-
++
+.LavaCookie:
+ call .Status
+ jp c, .DontUse
@@ -260,12 +254,12 @@ Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm)
...
- EnemyUsedFullHeal: ; 383a3 (e:43a3)
+ EnemyUsedFullHeal:
call AIUsedItemSound
call AI_HealStatus
ld a, FULL_HEAL
jp PrintText_UsedItemOn_AND_AIUpdateHUD
-
++
+EnemyUsedLavaCookie:
+ call AIUsedItemSound
+ call AI_HealStatus
@@ -287,13 +281,12 @@ First, add the essential data. Replace `ITEM_5A` with `DUSK_BALL`; give it a nam
A piece of data specific to Poké Balls is what color they are when thrown in battle. Edit [data/battle_anims/ball_colors.asm](../blob/master/data/battle_anims/ball_colors.asm):
```diff
- BallColors: ; cd26c (33:526c)
+ BallColors:
db MASTER_BALL, PAL_BATTLE_OB_GREEN
...
db LOVE_BALL, PAL_BATTLE_OB_RED
+ db DUSK_BALL, PAL_BATTLE_OB_GREEN
db -1, PAL_BATTLE_OB_GRAY
- ; cd284
```
Then it's time to implement the specific Pokémon-catching effect. Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm) again:
@@ -391,7 +384,7 @@ First, add the essential data. The `TOWN_MAP` item constant already exists, but
Now fix the effect. Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm):
```diff
- TownMapEffect: ; ee01
+ TownMapEffect:
- farcall PokegearMap
+ call FadeToMenu
+ farcall _TownMap
@@ -402,7 +395,6 @@ Now fix the effect. Edit [engine/items/item_effects.asm](../blob/master/engine/i
+ farcall WaitBGMap_DrawPackGFX
+ farcall Pack_InitColors
ret
- ; ee08
```
This code is based on how items with `ITEMMENU_PARTY` work, as written in `UseItem.Party` in [engine/items/pack.asm](../blob/master/engine/items/pack.asm).
@@ -435,11 +427,9 @@ Eviolite's effect is pretty similar to Metal Powder, which boosts Ditto's defens
Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/effect_commands.asm):
```diff
- DittoMetalPowder: ; 352b1
+ DittoMetalPowder:
...
- ; 352dc
-
+UnevolvedEviolite:
+; get the defender's species
+ ld a, MON_SPECIES
@@ -498,7 +488,7 @@ Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/ef
+ rr c
+ ret
- PlayerAttackDamage: ; 352e2
+ PlayerAttackDamage:
; Return move power d, player level e, enemy defense c and player attack b.
...
@@ -512,11 +502,9 @@ Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/ef
and a
ret
- ; 3534d
-
...
- EnemyAttackDamage: ; 353f6
+ EnemyAttackDamage:
...
ld a, [wEnemyMonLevel]
@@ -527,8 +515,6 @@ Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/ef
ld a, 1
and a
ret
-
- ; 35461
```
The implementation of `UnevolvedEviolite` is very similar to `DittoMetalPowder`, except the simple check for whether the species is `DITTO` has been replaced by a check for evolutions, similar to the check in `MoonBallMultiplier` in [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm). (Also, instead of checking whether `[hl]` is `EVIOLITE`, we check whether `b` is `HELD_EVIOLITE`; either would be fine, since `GetOpponentItem` returns "the effect of the opponent's item in `bc`, and its id at `hl`", as explained in a comment.) `bc` gets repeatedly saved on the stack with `push` and `pop` because it contains the defense stat, and we don't want the various pre-boost checks to corrupt the original value.