summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIdain <luiscarlosholguinperez@outlook.com>2021-11-29 23:35:20 -0400
committerIdain <luiscarlosholguinperez@outlook.com>2021-11-29 23:35:20 -0400
commit6542bfe1935e868dd9c1a1f90acdc9822234d8bf (patch)
treea9dc1e14ba9e6e6b19f33ebdcce4061d96530dd3
parent0b00f56c0ce3c75c0f17dbb6f06c80dd7600fd43 (diff)
Add asserts and update hyperlink in step 4
-rw-r--r--Add-a-new-trainer-class.md16
1 files changed, 15 insertions, 1 deletions
diff --git a/Add-a-new-trainer-class.md b/Add-a-new-trainer-class.md
index 1e558f1..9b48c30 100644
--- a/Add-a-new-trainer-class.md
+++ b/Add-a-new-trainer-class.md
@@ -71,6 +71,7 @@ Edit [data/trainers/class_names.asm](../blob/master/data/trainers/class_names.as
...
li "MYSTICALMAN"
+ li "PARASOL LADY"
+ assert_list_length NUM_TRAINER_CLASSES
```
A name can be up to 12 characters long. Note that the trainer class and individual name will get printed on one line in phrases like "PARASOL LADY SUE wants to battle!" so make sure the whole phrase will fit in 18 characters.
@@ -103,6 +104,8 @@ Edit [data/trainers/attributes.asm](../blob/master/data/trainers/attributes.asm)
+ db 10 ; base reward
+ dw AI_BASIC | AI_TYPES | AI_OPPORTUNIST | AI_STATUS
+ dw CONTEXT_USE | SWITCH_SOMETIMES
+
+ assert_table_length NUM_TRAINER_CLASSES
```
"Attributes" encompass a number of different properties:
@@ -147,13 +150,14 @@ Edit [data/trainers/dvs.asm](../blob/master/data/trainers/dvs.asm):
...
dn 9, 8, 8, 8 ; MYSTICALMAN
+ dn 7, 8, 8, 8 ; parasol lady
+ assert_table_length NUM_TRAINER_CLASSES
```
The four numbers define, in order, the Attack, Defense, Speed, and Special DVs for all the trainer class's Pokémon. Each DV can be from 0 to 15. (Remember, in Gen 2 there was one DV for both Special Attack and Special Defense; and bits from all four DVs were combined to calculate HP.)
Female trainer classes tend to have low Attack DVs so that their Pokémon will usually be female (since gender in Gen 2 was determined by the Attack and Speed DVs, primarily Attack). Gym Leaders are mostly an exception to this rule.
-You may also want to choose DVs that give some important Parasol Lady the right Hidden Power type, if that's relevant. Or follow [this tutorial](Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-and-nicknames) to give individual trainers unique DVs (as well as stat experience and nicknames!).
+You may also want to choose DVs that give some important Parasol Lady the right Hidden Power type, if that's relevant. Or follow [this tutorial](Allow-more-trainer-parties,-with-individual-DVs,-stat-experience,-nicknames,-variable-teams,-etc.) to give individual trainers unique DVs (as well as stat experience and nicknames!).
## 5. Define their encounter music
@@ -167,6 +171,7 @@ Edit [data/trainers/encounter_music.asm](../blob/master/data/trainers/encounter_
...
db MUSIC_HIKER_ENCOUNTER ; mysticalman
+ db MUSIC_BEAUTY_ENCOUNTER ; parasol lady
+ assert_table_length NUM_TRAINER_CLASSES + 1
- db MUSIC_HIKER_ENCOUNTER
- db MUSIC_HIKER_ENCOUNTER
- db MUSIC_HIKER_ENCOUNTER
@@ -196,6 +201,7 @@ Next edit [data/trainers/pic_pointers.asm](../blob/master/data/trainers/pic_poin
...
dba_pic MysticalmanPic
+ dba_pic ParasolLadyPic
+ assert_table_length NUM_TRAINER_CLASSES
```
We have to use `dba_pic` here instead of a standard `dba`—declaring the bank and address of `ParasolLadyPic`—because of [this design flaw](../blob/master/docs/design_flaws.md#pic-banks-are-offset-by-pics_fix). I strongly recommend removing the whole `FixPicBank` routine from [engine/gfx/load_pics.asm](../blob/master/engine/gfx/load_pics.asm), including all four calls to it in that file, and just using `dba` here; then you'll be able to `INCBIN` sprites in arbitrary banks.
@@ -231,6 +237,8 @@ Anyway, edit [data/trainers/palettes.asm](../blob/master/data/trainers/palettes.
...
INCBIN "gfx/trainers/mysticalman.gbcpal", middle_colors
+INCBIN "gfx/trainers/parasol_lady.gbcpal", middle_colors
+
+ assert_table_length NUM_TRAINER_CLASSES + 1
```
parasol_lady.2bpp.lz and parasol_lady.gbcpal will be automatically generated from parasol_lady.png when you run `make`.
@@ -249,6 +257,7 @@ Edit [data/trainers/party_pointers.asm](../blob/master/data/trainers/party_point
...
dw MysticalmanGroup
+ dw ParasolLadyGroup
+ assert_table_length NUM_TRAINER_CLASSES
```
Then edit [data/trainers/parties.asm](../blob/master/data/trainers/parties.asm):
@@ -305,8 +314,10 @@ Edit [data/trainers/sprites.asm](../blob/master/data/trainers/sprites.asm):
db SPRITE_FALKNER
...
db SPRITE_ROCKET_GIRL
+- assert_table_length NUM_TRAINER_CLASSES - 1 ; exclude MYSTICALMAN
+ db SPRITE_SUPER_NERD
+ db SPRITE_TEACHER
++ assert_table_length NUM_TRAINER_CLASSES
```
Valid sprites are in [constants/sprite_constants.asm](../blob/master/constants/sprite_constants.asm). They're for the 16x16 overworld sprites, not the 56x56 battle sprites. Adding a custom sprite is beyond the scope of this tutorial.
@@ -318,11 +329,14 @@ Anyway, edit [data/trainers/genders.asm](../blob/master/data/trainers/genders.as
```diff
BTTrainerClassGenders:
; entries correspond to trainer classes
+ table_width 1, BTTrainerClassGenders
db MALE ; FALKNER
...
db FEMALE ; GRUNTF
+- assert_table_length NUM_TRAINER_CLASSES - 1 ; exclude MYSTICALMAN
+ db MALE ; MYSTICALMAN
+ db FEMALE ; PARASOL_LADY
++ assert_table_length NUM_TRAINER_CLASSES
```
Again, we had to add data for `MYSTICALMAN` to reach the slot for `PARASOL_LADY`.