diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-03-16 21:19:10 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2021-03-16 21:19:10 -0400 |
commit | 7a7372b6603295e89196086ddbef993614434e01 (patch) | |
tree | ea66092ebcdb71b63a5c7776ab5a4ce60f1461fe | |
parent | b8b97a99563e433eade8deaccba2330b3e749c7b (diff) |
Revert
-rw-r--r-- | Add-a-new-Pack-pocket.md | 115 | ||||
-rw-r--r-- | Replace-stat-experience-with-EVs.md | 114 |
2 files changed, 70 insertions, 159 deletions
diff --git a/Add-a-new-Pack-pocket.md b/Add-a-new-Pack-pocket.md index 4645d42..01d8c84 100644 --- a/Add-a-new-Pack-pocket.md +++ b/Add-a-new-Pack-pocket.md @@ -1,8 +1,4 @@ -This tutorial is for how to add a new Pack pocket. Before starting, you'll need to install a Tilemap editor for Game Boy and GBC; [Tilemap Studio](https://github.com/Rangi42/tilemap-studio) is highly recommended for this (and will be the one used to illustrate one of the steps). - -As an example, we'll add a Berry Pocket in the third slot of our bag. - - +This tutorial is for how to add a new Pack pocket. As an example, we'll add a Berry Pocket. ## Contents @@ -16,10 +12,9 @@ As an example, we'll add a Berry Pocket in the third slot of our bag. 7. [Update `HasNoItems` and `CheckRegisteredItem` to check the new pocket](#7-update-hasnoitems-and-checkregistereditem-to-check-the-new-pocket) 8. [Update standard inventory routines](#8-update-standard-inventory-routines) 9. [Update the Pack engine](#9-update-the-pack-engine) -10. [Create/Edit pack_menu.tilemap](#10-createedit-pack_menutilemap) -11. [Update the Crystal-only Pack engine](#10-update-the-crystal-only-pack-engine) -12. [Update Kurt's Apricorn script](#11-update-kurts-apricorn-script) -13. [Fix build errors](#12-fix-build-errors) +10. [Update the Crystal-only Pack engine](#10-update-the-crystal-only-pack-engine) +11. [Update Kurt's Apricorn script](#11-update-kurts-apricorn-script) +12. [Fix build errors](#12-fix-build-errors) ## 1. Define pocket-related constants @@ -41,10 +36,9 @@ Edit [constants/item_data_constants.asm](../blob/master/constants/item_data_cons const_def const ITEM_POCKET ; 0 const BALL_POCKET ; 1 -+ const BERRY_POCKET const KEY_ITEM_POCKET ; 2 const TM_HM_POCKET ; 3 - ++ const BERRY_POCKET ; 4 NUM_POCKETS EQU const_value MAX_ITEMS EQU 20 @@ -54,7 +48,7 @@ Edit [constants/item_data_constants.asm](../blob/master/constants/item_data_cons +MAX_BERRIES EQU 17 ``` -Notice that the "item types" constants are in a different order than the "pack pockets" constants, so don't mix them up. Also we name the item type "`BERRIES`" because "`BERRY`" is an item, so don't mix those up either. +Notice that the "item types" constants are in a different order than the "pack pockets" constants. So don't mix them up. Also we name the item type "`BERRIES`" because "`BERRY`" is an item, so don't mix those up either. The `MAX_*` constants are the storage capacities of their respective pockets. We defined `MAX_BERRIES` as 17 because there are 17 items that will go in the Berry pocket, as we'll see later; that way you can conveniently carry one stack of each Berry. (Likewise, `MAX_BALLS` is 12, and 12 items belong in the Ball pocket.) @@ -142,7 +136,7 @@ Edit [wram.asm](../blob/master/wram.asm): +wBerryPocketCursor:: db wPCItemsScrollPosition:: db - ds 1 + wPartyMenuScrollPosition:: db ; unused wItemsPocketScrollPosition:: db wKeyItemsPocketScrollPosition:: db wBallsPocketScrollPosition:: db @@ -152,8 +146,9 @@ Edit [wram.asm](../blob/master/wram.asm): ... +wDudeNumBerries:: - wDudeNumKeyItems:: db - wDudeKeyItems:: ds 18 + 1 + wDudeNumKeyItems:: db ; d292 + wDudeKeyItems:: ds 18 + wDudeKeyItemsEnd:: db ... @@ -163,11 +158,13 @@ Edit [wram.asm](../blob/master/wram.asm): ... - wNumBalls:: db - wBalls:: ds MAX_BALLS * 2 + 1 + wNumBalls:: db ; d8d7 + wBalls:: ds MAX_BALLS * 2 + 1 ; d8d8 + wBallsEnd:: +wNumBerries:: db +wBerries:: ds MAX_BERRIES * 2 + 1 ++wBerriesEnd:: ``` Every pocket has a <code>w<i>Name</i>PocketCursor</code> and a <code>w<i>Name</i>PocketScrollPosition</code> byte for scrolling through it, a <code>wNum<i>Names</i></code> byte that stores how many items are in it, and a <code>w<i>Names</i></code>–<code>w<i>Names</i>End</code> array for storing its items. `wTMsHMs` and `wKeyItems` are special, but normal item-storage pockets like `wItems` and `wBalls` have two bytes per possible item (one for the ID, one for the quantity) plus a byte for the end-of-list marker. @@ -241,9 +238,9 @@ Now edit [engine/overworld/select_menu.asm](../blob/master/engine/overworld/sele ; entries correspond to *_POCKET constants dw .CheckItem dw .CheckBall -+ dw .CheckBerry dw .CheckKeyItem dw .CheckTMHM ++ dw .CheckBerry ... @@ -394,12 +391,12 @@ We've saved editing the longest file for last: [engine/items/pack.asm](../blob/m const PACKSTATE_ITEMSPOCKETMENU ; 2 const PACKSTATE_INITBALLSPOCKET ; 3 const PACKSTATE_BALLSPOCKETMENU ; 4 -+ const PACKSTATE_INITBERRYPOCKET -+ const PACKSTATE_BERRYPOCKETMENU const PACKSTATE_INITKEYITEMSPOCKET ; 5 const PACKSTATE_KEYITEMSPOCKETMENU ; 6 const PACKSTATE_INITTMHMPOCKET ; 7 const PACKSTATE_TMHMPOCKETMENU ; 8 ++ const PACKSTATE_INITBERRYPOCKET ++ const PACKSTATE_BERRYPOCKETMENU const PACKSTATE_QUITNOSCRIPT ; 9 const PACKSTATE_QUITRUNSCRIPT ; 10 ``` @@ -419,12 +416,12 @@ Notice the pattern to this table: for each pocket, there's a `PACKSTATE_INIT*POC dw .ItemsPocketMenu ; 2 dw .InitBallsPocket ; 3 dw .BallsPocketMenu ; 4 -+ dw .InitBerryPocket -+ dw .BerryPocketMenu dw .InitKeyItemsPocket ; 5 dw .KeyItemsPocketMenu ; 6 dw .InitTMHMPocket ; 7 dw .TMHMPocketMenu ; 8 ++ dw .InitBerryPocket ++ dw .BerryPocketMenu dw Pack_QuitNoScript ; 9 dw Pack_QuitRunScript ; 10 ``` @@ -519,12 +516,12 @@ Two, we actually write the subroutines that we just added pointers to in the jum dw .ItemsPocketMenu ; 2 dw .InitBallsPocket ; 3 dw .BallsPocketMenu ; 4 -+ dw .InitBerryPocket -+ dw .BerryPocketMenu dw .InitKeyItemsPocket ; 5 dw .KeyItemsPocketMenu ; 6 dw .InitTMHMPocket ; 7 dw .TMHMPocketMenu ; 8 ++ dw .InitBerryPocket ++ dw .BerryPocketMenu dw Pack_QuitNoScript ; 9 dw Pack_QuitRunScript ; 10 ``` @@ -612,9 +609,9 @@ Just like before, we insert the Berry pocket between the Ball and Key Item pocke ; entries correspond to *_POCKET constants dw .ItemsPocket dw .BallsPocket -+ dw .BerryPocket dw .KeyItemsPocket dw .TMHMPocket ++ dw .BerryPocket ... @@ -697,9 +694,9 @@ This is somewhat tricky to notice. Here the code is decrementing or incrementing ; entries correspond to *_POCKET constants dw .Items dw .Balls -+ dw .Berries dw .KeyItems dw .TMHM ++ dw .Berries ... @@ -750,14 +747,38 @@ Another jumptable, this time used by the catch tutorial dude. Once again, we jus PackGFXPointers: dw PackGFX + (15 tiles) * 1 ; ITEM_POCKET dw PackGFX + (15 tiles) * 3 ; BALL_POCKET -+ dw PackGFX + (15 tiles) * 4 ; BERRY_POCKET dw PackGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET dw PackGFX + (15 tiles) * 2 ; TM_HM_POCKET ++ dw PackGFX + (15 tiles) * 4 ; BERRY_POCKET ``` This is a table of pointers to the individual highlighted pocket pictures in pack.png and pack_f.png. Remember how they were out of order compared to the constants? That's why this table is necessary. For example, the first (#0) picture was of the Key Item pocket, and `KEY_ITEM_POCKET` is 2, so the third (#2) entry here points to the first picture. Anyway, all we have to do is add a pointer for the Berry pocket again. +```diff + .tilemap + ; ITEM_POCKET + db $00, $04, $04, $04, $01 ; top border + db $06, $07, $08, $09, $0a ; Items + db $02, $05, $05, $05, $03 ; bottom border + ; BALL_POCKET + db $00, $04, $04, $04, $01 ; top border + db $15, $16, $17, $18, $19 ; Balls + db $02, $05, $05, $05, $03 ; bottom border + ; KEY_ITEM_POCKET + db $00, $04, $04, $04, $01 ; top border + db $0b, $0c, $0d, $0e, $0f ; Key Items + db $02, $05, $05, $05, $03 ; bottom border + ; TM_HM_POCKET + db $00, $04, $04, $04, $01 ; top border + db $10, $11, $12, $13, $14 ; TM/HM + db $02, $05, $05, $05, $03 ; bottom border ++; BERRY_POCKET ++ db $00, $04, $04, $04, $01 ; top border ++ db $1a, $1b, $1c, $1d, $1e ; Berries ++ db $02, $05, $05, $05, $03 ; bottom border +``` +These are tilemaps for the pocket name labels in pack_menu.png. Each one is three rows of five tiles each, with tile indexes starting at 0. Take a look at pack_menu.png and notice how the hexadecimal indexes here correspond to tiles that form sensible pictures. ```diff BallsPocketMenuHeader: @@ -824,39 +845,7 @@ This is a table of pointers to the individual highlighted pocket pictures in pac We saw `BallsPocketMenuHeader` used in the subroutines for the Start Menu Pack and the battle Pack, and `PC_Mart_BallsPocketMenuHeader` in the subroutine for the Pack when depositing or selling. Here they're finally being defined. And since we created the corresponding names `BerryPocketMenuHeader` and `PC_Mart_BerryPocketMenuHeader`, they need defining too; as usual, we can just copy whatever the Ball pocket does and substitute "Berry" for "Ball". -## 10. Create/Edit pack_menu.tilemap - - - -Remember that at the start of this tutorial you were told to install a tilemap editor? This is why you need it. Open Tilemap Studio, select Tilemap > Open and, in your local repo, select [gfx/pack/pack_menu.tilemap](.../blob/master/gfx/pack/pack_menu.tilemap). In the Tilemap Options window, select "Plain Tiles" as the format. From there, resize the Tilemap to 5x15 and edit it so that "Berries" is the third box in the tilemap, just like in the image presented above. - -**NOTE**: In case you're using an old version of this repo, you'll have to select Tileset > Load and then your new [gfx/pack/pack_menu.png](.../blob/master/gfx/pack/pack_menu.png). After that, select Tilemap > New and, in the New Tilemap window, adjust the tilemap size to 5x15, with the Plain Tiles format. Also, change this in [engine/items/pack.asm](.../blob/master/engine/items/pack.asm): - -```diff --.tilemap: ; 5x12 -+.tilemap: ; 5x15 -- ; ITEM_POCKET -- db $00, $04, $04, $04, $01 ; top border -- db $06, $07, $08, $09, $0a ; Items -- db $02, $05, $05, $05, $03 ; bottom border -- ; BALL_POCKET -- db $00, $04, $04, $04, $01 ; top border -- db $15, $16, $17, $18, $19 ; Balls -- db $02, $05, $05, $05, $03 ; bottom border -- ; KEY_ITEM_POCKET -- db $00, $04, $04, $04, $01 ; top border -- db $0b, $0c, $0d, $0e, $0f ; Key Items -- db $02, $05, $05, $05, $03 ; bottom border -- ; TM_HM_POCKET -- db $00, $04, $04, $04, $01 ; top border -- db $10, $11, $12, $13, $14 ; TM/HM -- db $02, $05, $05, $05, $03 ; bottom border- -+; the 5x3 pieces correspond to *_POCKET constants -+INCBIN "gfx/pack/pack_menu.tilemap" -``` - - -## 11. Update the Crystal-only Pack engine +## 10. Update the Crystal-only Pack engine Edit [engine/items/pack_kris.asm](../blob/master/engine/items/pack_kris.asm): @@ -864,15 +853,15 @@ Edit [engine/items/pack_kris.asm](../blob/master/engine/items/pack_kris.asm): PackFGFXPointers: dw PackFGFX + (15 tiles) * 1 ; ITEM_POCKET dw PackFGFX + (15 tiles) * 3 ; BALL_POCKET -+ dw PackFGFX + (15 tiles) * 4 ; BERRY_POCKET dw PackFGFX + (15 tiles) * 0 ; KEY_ITEM_POCKET dw PackFGFX + (15 tiles) * 2 ; TM_HM_POCKET ++ dw PackFGFX + (15 tiles) * 4 ; BERRY_POCKET ``` This is just like `PackGFXPointers`, but for the Crystal-only girl's Pack. -## 12. Update Kurt's Apricorn script +## 11. Update Kurt's Apricorn script If you did not change the Apricorns' pocket, then skip this step. @@ -892,7 +881,7 @@ Kurt's script to turn Apricorns into Balls assumes they're still in the Item poc Just use your text editor to find all five occurrences of "`wNumItems`" in the file, and make that one-line change to all of them. -## 13. Fix build errors +## 12. Fix build errors We're almost finished, but if you run `make` now, it gives an error: diff --git a/Replace-stat-experience-with-EVs.md b/Replace-stat-experience-with-EVs.md index afa94ad..ec9a629 100644 --- a/Replace-stat-experience-with-EVs.md +++ b/Replace-stat-experience-with-EVs.md @@ -6,16 +6,15 @@ Gen 3 replaced stat experience with EVs, which are different in a number of ways ## Contents 1. [Replace stat experience with EVs in the Pokémon data structure](#1-replace-stat-experience-with-evs-in-the-pokémon-data-structure) -2. [(OPTIONAL) Replace stat experience with EVs in Debug Room](#2-optional-replace-stat-experience-with-evs-in-debug-room) -3. [Replace stat experience with EVs in base data](#3-replace-stat-experience-with-evs-in-base-data) -4. [Gain EVs from winning battles](#4-gain-evs-from-winning-battles) -5. [Calculate stats based on EVs](#5-calculate-stats-based-on-evs) -6. [Vitamins give EVs, not stat experience](#6-vitamins-give-evs-not-stat-experience) -7. [Replace Odd Egg and Battle Tower stat experience with EVs](#7-replace-odd-egg-and-battle-tower-stat-experience-with-evs) -8. [Replace `MON_STAT_EXP` with `MON_EVS` everywhere](#8-replace-mon_stat_exp-with-mon_evs-everywhere) -9. [Replace some more labels](#9-replace-some-more-labels) -10. [Remove unused square root code](#10-remove-unused-square-root-code) -11. [Add Zinc to boost Special Defense EVs](#11-add-zinc-to-boost-special-defense-evs) +2. [Replace stat experience with EVs in base data](#2-replace-stat-experience-with-evs-in-base-data) +3. [Gain EVs from winning battles](#3-gain-evs-from-winning-battles) +4. [Calculate stats based on EVs](#4-calculate-stats-based-on-evs) +5. [Vitamins give EVs, not stat experience](#5-vitamins-give-evs-not-stat-experience) +6. [Replace Odd Egg and Battle Tower stat experience with EVs](#6-replace-odd-egg-and-battle-tower-stat-experience-with-evs) +7. [Replace `MON_STAT_EXP` with `MON_EVS` everywhere](#7-replace-mon_stat_exp-with-mon_evs-everywhere) +8. [Replace some more labels](#8-replace-some-more-labels) +9. [Remove unused square root code](#9-remove-unused-square-root-code) +10. [Add Zinc to boost Special Defense EVs](#10-add-zinc-to-boost-special-defense-evs) ## 1. Replace stat experience with EVs in the Pokémon data structure @@ -100,85 +99,8 @@ And edit [constants/pokemon_data_constants.asm](../blob/master/constants/pokemon By replacing the 10 stat experience bytes with 6 EV bytes, we've freed up 4 bytes in `box_struct`. That's valuable space, since it gets saved when Pokémon are deposited in the PC. Making use of it is beyond the scope of this tutorial, so we'll leave it as padding for now. -## 2. (OPTIONAL) Replace stat experience with EVs in Debug Room -If you're going to build a debug ROM to test your project, this step is necessary. One of the options in the debug room, "POKÉMON GET!", lets you edit the structure of a Pokémon before creating it, but some pages use Stat Experience instead of EVs, so we'll need to change this; otherwise, our debug ROM won't assemble. Go to [engine/debug/debug_room.asm](.../blob/master/engine/debug/debug_room.asm) and edit it: - -```diff - DebugRoomMenu_PokemonGet_Page2Values: - db 8 -- paged_value wDebugRoomMonHPExp+0, $00, $ff, $00, DebugRoom_BoxStructStrings.HPExp0, NULL, FALSE -- paged_value wDebugRoomMonHPExp+1, $00, $ff, $00, DebugRoom_BoxStructStrings.HPExp1, NULL, FALSE -- paged_value wDebugRoomMonAtkExp+0, $00, $ff, $00, DebugRoom_BoxStructStrings.AttkExp0, NULL, FALSE -- paged_value wDebugRoomMonAtkExp+1, $00, $ff, $00, DebugRoom_BoxStructStrings.AttkExp1, NULL, FALSE -- paged_value wDebugRoomMonDefExp+0, $00, $ff, $00, DebugRoom_BoxStructStrings.DfnsExp0, NULL, FALSE -- paged_value wDebugRoomMonDefExp+1, $00, $ff, $00, DebugRoom_BoxStructStrings.DfnsExp1, NULL, FALSE -- paged_value wDebugRoomMonSpdExp+0, $00, $ff, $00, DebugRoom_BoxStructStrings.SpeedExp0, NULL, FALSE -- paged_value wDebugRoomMonSpdExp+1, $00, $ff, $00, DebugRoom_BoxStructStrings.SpeedExp1, NULL, FALSE -+ paged_value wDebugRoomMonHPEV, $00, $ff, $00, DebugRoom_BoxStructStrings.HPEV, NULL, FALSE -+ paged_value wDebugRoomMonAtkEV, $00, $ff, $00, DebugRoom_BoxStructStrings.AttkEV, NULL, FALSE -+ paged_value wDebugRoomMonDefEV, $00, $ff, $00, DebugRoom_BoxStructStrings.DfnsEV, NULL, FALSE -+ paged_value wDebugRoomMonSpdEV, $00, $ff, $00, DebugRoom_BoxStructStrings.SpeedEV, NULL, FALSE -+ paged_value wDebugRoomMonSpclAtkEV, $00, $ff, $00, DebugRoom_BoxStructStrings.SpclAtkEV, NULL, FALSE -+ paged_value wDebugRoomMonSpclDefEV, $00, $ff, $00, DebugRoom_BoxStructStrings.SpclDefEV, NULL, FALSE -+ paged_value wDebugRoomMonDVs+0, $00, $ff, $00, DebugRoom_BoxStructStrings.PowerRnd0, NULL, TRUE -+ paged_value wDebugRoomMonDVs+1, $00, $ff, $00, DebugRoom_BoxStructStrings.PowerRnd1, NULL, TRUE - - - DebugRoomMenu_PokemonGet_Page3Values: - db 8 -- paged_value wDebugRoomMonSpcExp+0, $00, $ff, $00, DebugRoom_BoxStructStrings.SpclExp0, NULL, FALSE -- paged_value wDebugRoomMonSpcExp+1, $00, $ff, $00, DebugRoom_BoxStructStrings.SpclExp1, NULL, FALSE -- paged_value wDebugRoomMonDVs+0, $00, $ff, $00, DebugRoom_BoxStructStrings.PowerRnd0, NULL, TRUE -- paged_value wDebugRoomMonDVs+1, $00, $ff, $00, DebugRoom_BoxStructStrings.PowerRnd1, NULL, TRUE -- paged_value wDebugRoomMonPP+0, $00, $ff, $00, DebugRoom_BoxStructStrings.PP1, NULL, FALSE -- paged_value wDebugRoomMonPP+1, $00, $ff, $00, DebugRoom_BoxStructStrings.PP2, NULL, FALSE -- paged_value wDebugRoomMonPP+2, $00, $ff, $00, DebugRoom_BoxStructStrings.PP3, NULL, FALSE -- paged_value wDebugRoomMonPP+3, $00, $ff, $00, DebugRoom_BoxStructStrings.PP4, NULL, FALSE -+ paged_value wDebugRoomMonPP+0, $00, $ff, $00, DebugRoom_BoxStructStrings.PP1, NULL, FALSE -+ paged_value wDebugRoomMonPP+1, $00, $ff, $00, DebugRoom_BoxStructStrings.PP2, NULL, FALSE -+ paged_value wDebugRoomMonPP+2, $00, $ff, $00, DebugRoom_BoxStructStrings.PP3, NULL, FALSE -+ paged_value wDebugRoomMonPP+3, $00, $ff, $00, DebugRoom_BoxStructStrings.PP4, NULL, FALSE -+ paged_value wDebugRoomMonHappiness, $00, $ff, BASE_HAPPINESS, DebugRoom_BoxStructStrings.Friend, NULL, FALSE -+ paged_value wDebugRoomMonPokerusStatus, $00, $ff, $00, DebugRoom_BoxStructStrings.Pokerus, NULL, TRUE -+ paged_value wDebugRoomMonCaughtData+0, $00, $ff, $00, DebugRoom_BoxStructStrings.NoUse0, NULL, FALSE -+ paged_value wDebugRoomMonCaughtData+1, $00, $ff, $00, DebugRoom_BoxStructStrings.NoUse1, NULL, FALSE - - - DebugRoomMenu_PokemonGet_Page4Values: -- db 6 -+ db 2 -- paged_value wDebugRoomMonHappiness, $00, $ff, BASE_HAPPINESS, DebugRoom_BoxStructStrings.Friend, NULL, FALSE -- paged_value wDebugRoomMonPokerusStatus, $00, $ff, $00, DebugRoom_BoxStructStrings.Pokerus, NULL, TRUE -- paged_value wDebugRoomMonCaughtData+0, $00, $ff, $00, DebugRoom_BoxStructStrings.NoUse0, NULL, FALSE -- paged_value wDebugRoomMonCaughtData+1, $00, $ff, $00, DebugRoom_BoxStructStrings.NoUse1, NULL, FALSE - paged_value wDebugRoomMonLevel, 1, MAX_LEVEL, $05, DebugRoom_BoxStructStrings.Level, NULL, FALSE - paged_value wDebugRoomMonBox, 1, NUM_BOXES, $0e, DebugRoom_BoxStructStrings.SendBox, NULL, FALSE -``` - -```diff - DebugRoom_BoxStructStrings: - ... --.HPExp0: db "HP EXP[0]@" --.HPExp1: db "HP EXP[1]@" --.AttkExp0: db "ATTK EXP[0]@" --.AttkExp1: db "ATTK EXP[1]@" --.DfnsExp0: db "DFNS EXP[0]@" --.DfnsExp1: db "DFNS EXP[1]@" --.SpeedExp0: db "SPEED EXP[0]@" --.SpeedExp1: db "SPEED EXP[1]@" --.SpclExp0: db "SPCL EXP[0]@" --.SpclExp1: db "SPCL EXP[1]@" -+.HPEV: db "HP EV@" -+.AttkEV: db "ATK EV@" -+.DfnsEV: db "DEF EV@" -+.SpeedEV: db "SPEED EV@" -+.SpclAtkEV: db "SP.ATK EV@" -+.SpclDefEV: db "SP.DEF EV@" -``` -What we did was to change all references to Stat Experience for EVs and delete all the _StatExp1_ labels since they're no longer needed (remember, Stat Exp takes _two bytes_, whereas EV only takes _one byte_, so having a second byte for stats is useless). Also, we moved some elements from one page to another, since we've freed up some space and that way it looks more organized. - -## 3. Replace stat experience with EVs in base data +## 2. Replace stat experience with EVs in base data When you knock out a Pokémon, the stat experience you gain is equal to its base stats. That doesn't work for EVs; each species has its own set of EV yields, with a gain of 0 to 3 for each stat. That means we can store each stat's gain in two bits, so six stats will fit in two bytes. Conveniently, there are two unused bytes in base data that we can replace. @@ -293,7 +215,7 @@ Update data/pokemon/base_stats/zubat.asm That will format all the base data files correctly, but with zero EV yields. You'll have to fill in the correct values yourself. -## 4. Gain EVs from winning battles +## 3. Gain EVs from winning battles Edit [engine/battle/core.asm](../blob/master/engine/battle/core.asm): @@ -409,7 +331,7 @@ GiveExperiencePoints: Now instead of gaining the enemy's base stats toward your stat experience, you'll gain their base EV yields toward your EV totals. Having Pokérus will double EV gain. -## 5. Calculate stats based on EVs +## 4. Calculate stats based on EVs Edit [engine/pokemon/move_mon.asm](../blob/master/engine/pokemon/move_mon.asm): @@ -508,7 +430,7 @@ For example, 50 EVs are equivalent to 50² = 2,500 stat exp, and 100 EVs are e Eventually this won't matter, since the maximum 252 EVs or 65,535 stat exp both result in the same stats (252 / 4 = √65,535 / 4 = 63). But you may notice your Pokémon stats growing more slowly at first, and more quickly later on than you're used to. -## 6. Vitamins give EVs, not stat experience +## 5. Vitamins give EVs, not stat experience Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm): @@ -602,7 +524,7 @@ Edit [data/items/descriptions.asm](../blob/master/data/items/descriptions.asm): ``` -## 7. Replace Odd Egg and Battle Tower stat experience with EVs +## 6. Replace Odd Egg and Battle Tower stat experience with EVs First, edit [data/events/odd_eggs.asm](../blob/master/data/events/odd_eggs.asm). Make this same replacement 14 times, once for each hard-coded Odd Egg Pokémon structure: @@ -693,7 +615,7 @@ Done! ``` -## 8. Replace `MON_STAT_EXP` with `MON_EVS` everywhere +## 7. Replace `MON_STAT_EXP` with `MON_EVS` everywhere Replace every occurrence of `MON_STAT_EXP` with `MON_EVS` in these files: @@ -710,7 +632,7 @@ Replace every occurrence of `MON_STAT_EXP` with `MON_EVS` in these files: Most of the `MON_STAT_EXP` occurrences are part of an argument passed to `CalcMonStats`. -## 9. Replace some more labels +## 8. Replace some more labels Edit [engine/events/daycare.asm](../blob/master/engine/events/daycare.asm): @@ -731,7 +653,7 @@ Edit [engine/events/daycare.asm](../blob/master/engine/events/daycare.asm): We're technically done now; EVs will work behind the scenes just like stat experience did. But there's room for more improvement. -## 10. Remove unused square root code +## 9. Remove unused square root code The only place `GetSquareRoot` was used was in `CalcMonStatC`. Without that, we can safely remove it. @@ -744,7 +666,7 @@ Then edit [main.asm](../blob/master/main.asm): ``` -## 11. Add Zinc to boost Special Defense EVs +## 10. Add Zinc to boost Special Defense EVs Now that Calcium only boosts Special Attack EVs, we need Zinc for Special Defense. Follow [this tutorial](Add-a-new-item) to add a new item. |