diff options
-rw-r--r-- | Add-a-new-fishing-rod.md | 8 | ||||
-rw-r--r-- | Add-different-kinds-of-new-items.md | 74 | ||||
-rw-r--r-- | Tutorials.md | 1 | ||||
-rw-r--r-- | screenshots/x-sp-def.png | bin | 0 -> 2657 bytes |
4 files changed, 77 insertions, 6 deletions
diff --git a/Add-a-new-fishing-rod.md b/Add-a-new-fishing-rod.md index 8d45219..eac04b9 100644 --- a/Add-a-new-fishing-rod.md +++ b/Add-a-new-fishing-rod.md @@ -11,7 +11,7 @@ This tutorial is for how to add a new fishing rod. As an example, we'll add a Ma ## 1. Create the new Rod item -Follow [the tutorial to add a new item](Add-different-kinds-of-new-items) to create the Master Rod. Replace `ITEM_87` with `MASTER_ROD`; give it a name, description, and attributes (`0, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE`); and remove `ITEM_87` from `TimeCapsule_CatchRateItems`. +Follow [the tutorial to add a new item](Add-different-kinds-of-new-items) to create the Master Rod. Replace `ITEM_88` with `MASTER_ROD`, and give it a name, description, and attributes (`0, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE`). (`ITEM_88` is not in `TimeCapsule_CatchRateItems`.) ## 2. Define the item effect @@ -23,10 +23,10 @@ Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.as ; entries correspond to item ids dw PokeBallEffect ; MASTER_BALL ... - dw NoEffect ; PASS -- dw NoEffect ; ITEM_87 + dw NoEffect ; ITEM_87 +- dw NoEffect ; ITEM_88 + dw MasterRodEffect ; MASTER_ROD - dw NoEffect ; ITEM_88 + dw NoEffect ; ITEM_89 ... dw NoEffect ; ITEM_B3 diff --git a/Add-different-kinds-of-new-items.md b/Add-different-kinds-of-new-items.md index f1ffce9..cf77464 100644 --- a/Add-different-kinds-of-new-items.md +++ b/Add-different-kinds-of-new-items.md @@ -11,6 +11,7 @@ This tutorial is for how to add different kinds of new items, including a healin - [`StatusHealingEffect`: Lava Cookie](#statushealingeffect-lava-cookie) - [`PokeBallEffect`: Dusk Ball](#pokeballeffect-dusk-ball) - [`EvoStoneEffect`: Mist Stone](#evostoneeffect-mist-stone) + - [`XItemEffect`: X Sp.Def](#xitemeffect-x-spdef) - [`TownMapEffect`: Town Map](#townmapeffect-town-map) - [Held effect: Eviolite](#held-effect-eviolite) 4. [Adding up to 254 items](#4-adding-up-to-254-items) @@ -376,6 +377,77 @@ Edit [data/pokemon/evos_attacks.asm](../blob/master/data/pokemon/evos_attacks.as  +### `XItemEffect`: X Sp.Def + +X Sp.Def, from Gen 4, boosts Special Defense by one stage in battle. It can only be used during battle, and enemy trainer AI should know how to use one too. + +(In Gen 1, X Special boosted the single Special stat. Gen 2 split Special into Attack and Defense, but X Special only boosted Special Attack, and it took until Gen 4 to split the item as well into X Sp.Atk and X Sp.Def.) + +First, add the essential data. Replace `ITEM_78` with `X_SP_DEF`; give it a name, description, and attributes (`350, HELD_NONE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_CLOSE`); give it the `RestoreHPEffect`; and remove `ITEM_78` from `TimeCapsule_CatchRateItems`. + +A piece of data specific to X items is which stat they boost. Edit [data/items/x_stats.asm](../blob/master/data/items/x_stats.asm): + +```diff + XItemStats: + ; item, stat + db X_ATTACK, ATTACK + db X_DEFEND, DEFENSE + db X_SPEED, SPEED + db X_SPECIAL, SP_ATTACK ++ db X_SP_DEF, SP_DEFENSE +``` + +`XItemStats` is used by `XItemEffect`, so now it will successfully boost Special Defense when used by the player. + +Now edit [engine/battle/ai/items.asm](../blob/master/engine/battle/ai/items.asm): + +```diff + AI_Items: + dbw FULL_RESTORE, .FullRestore + ... + dbw X_SPECIAL, .XSpecial ++ dbw X_SP_DEF, .XSpDef + db -1 ; end + + ... + + .XSpecial: + call .XItem + jp c, .DontUse + call EnemyUsedXSpecial + jp .Use ++ ++.XSpDef: ++ call .XItem ++ jp c, .DontUse ++ call EnemyUsedXSpDef ++ jp .Use + + ... + ++EnemyUsedXSpDef: ++ ld b, SP_DEFENSE ++ ld a, X_SP_DEF ++ jr EnemyUsedXItem + + EnemyUsedXSpecial: + ld b, SP_ATTACK + ld a, X_SPECIAL + + ; Parameter + ; a = ITEM_CONSTANT + ; b = BATTLE_CONSTANT (ATTACK, DEFENSE, SPEED, SP_ATTACK, SP_DEFENSE, ACCURACY, EVASION) + EnemyUsedXItem: + ... +``` + +Now if a trainer has an X Sp.Def (as defined in [data/trainers/attributes.asm](../blob/master/data/trainers/attributes.asm)) they'll be able to use it. The `.XItem` subroutine called by `.XSpDef` determines whether the healing item will be used, with different random chances depending on the enemy AI and the battle situation; and the `EnemyUsedXSpDef` routine does the whole process of boosting the stat, playing the sound effect, etc. + + + +Note that I named it "X SPCL.DEF", not "X SP.DEF", because that's the naming convention for stats in Gen 2. I also renamed "X SPECIAL" to "X SPCL.ATK" so they match. + + ### `TownMapEffect`: Town Map The Town Map was present in Gen 1 but replaced in Gen 2 by the Pokégear's Map Card; however, it still exists in the code. Its `TownMapEffect` implementation is buggy, but can be fixed. @@ -407,7 +479,7 @@ This code is based on how items with `ITEMMENU_PARTY` work, as written in `UseIt Eviolite, from Gen 5, boosts Defense and Special Defense by 50% if held by a Pokémon that is not fully evolved. -First, add the essential data. Replace `ITEM_78` with `EVIOLITE`; give it a name, description, and attributes (`200, HELD_EVIOLITE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE`); give it `NoEffect` (it has a *held* effect, but no *used* effect); and remove `ITEM_78` from `TimeCapsule_CatchRateItems`. +First, add the essential data. Replace `ITEM_87` with `EVIOLITE`; give it a name, description, and attributes (`200, HELD_EVIOLITE, 0, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE`); give it `NoEffect` (it has a *held* effect, but no *used* effect); and remove `ITEM_87` from `TimeCapsule_CatchRateItems`. `HELD_EVIOLITE` has not been defined yet, so we'll do that next. Edit [constants/item_data_constants.asm](../blob/master/constants/item_data_constants.asm): diff --git a/Tutorials.md b/Tutorials.md index 4273509..976db52 100644 --- a/Tutorials.md +++ b/Tutorials.md @@ -89,6 +89,5 @@ Tutorials may use diff syntax to show edits: - Pan the camera for cutscenes by making the player invisible - Gain experience from catching Pokémon - TM/HM item balls say the move name -- X Spcl.Def - Nuzlocke mode (an in-game enforced [Nuzlocke Challenge](https://bulbapedia.bulbagarden.net/wiki/Nuzlocke_Challenge)) - Useful unused content (`COLL_CURRENT_*`, `HELD_PREVENT_*`, `ENVIRONMENT_5`, `TRADE_GENDER_MALE`, `GROWTH_SLIGHTLY_*`, `SPRITE_UNUSED_GUY`, `PAL_NPC_PINK`, etc) diff --git a/screenshots/x-sp-def.png b/screenshots/x-sp-def.png Binary files differnew file mode 100644 index 0000000..986fc4c --- /dev/null +++ b/screenshots/x-sp-def.png |