diff options
-rw-r--r-- | Add-different-kinds-of-new-items.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Add-different-kinds-of-new-items.md b/Add-different-kinds-of-new-items.md index 50b5425..78ea050 100644 --- a/Add-different-kinds-of-new-items.md +++ b/Add-different-kinds-of-new-items.md @@ -475,8 +475,8 @@ Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/ef +; check if the defender's item is Eviolite + push bc + call GetOpponentItem -+ ld a, [hl] -+ cp EVIOLITE ++ ld a, b ++ cp HELD_EVIOLITE + pop bc + ret nz + @@ -530,7 +530,7 @@ Anyway, edit [engine/battle/effect_commands.asm](../blob/master/engine/battle/ef ; 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). `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. +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. In general, if you're implementing a custom held item effect, think about which items have similar effects, and which other code might already do something like what you want. |