Add a new type - pret/pokecrystal GitHub Wiki

This tutorial is for how to add a new type for Pokémon or moves. As an example, we'll add the Fairy type introduced in Gen 6.

Contents

  1. Define a type constant
  2. Give the type a name
  3. List the type matchups
  4. Make it searchable in the Pokédex
  5. Update Pokémon types
  6. Update move types
  7. Change Polkadot Bow to boost Fairy moves

1. Define a type constant

Gen 2 was before the physical/special split, so the types after SPECIAL count as special, and the rest count as physical. Fairy moves are mostly special, so we'll add it there.

Edit constants/type_constants.asm:

 DEF SPECIAL EQU const_value
 	const FIRE
 	const WATER
 	const GRASS
 	const ELECTRIC
 	const PSYCHIC_TYPE
 	const ICE
 	const DRAGON
 	const DARK
+	const FAIRY
 DEF TYPES_END EQU const_value

(If you're using an old version of pokecrystal where the EGG_FAIRY egg group constant was still called FAIRY, you'll have to name the type something different, like FAIRY_TYPE or FAERIE.)

2. Give the type a name

Edit data/types/names.asm:

 TypeNames:
 ; entries correspond to types (see constants/type_constants.asm)
	table_width 2, TypeNames
 	dw Normal
 	...
 	dw Dark
+	dw Fairy
	assert_table_length TYPES_END

 Normal:    db "NORMAL@"
 ...
 Dark:      db "DARK@"
+Fairy:     db "FAIRY@"

3. List the type matchups

Edit data/types/type_matchups.asm:

 TypeMatchups:
 	;  attacker,  defender,  *=
 	db NORMAL,    ROCK,      NOT_VERY_EFFECTIVE
 	db NORMAL,    STEEL,     NOT_VERY_EFFECTIVE
 	...
 	db FIGHTING,  STEEL,     SUPER_EFFECTIVE
+	db FIGHTING,  FAIRY,     NOT_VERY_EFFECTIVE
 	...
 	db POISON,    STEEL,     NO_EFFECT
+	db POISON,    FAIRY,     SUPER_EFFECTIVE
 	...
 	db BUG,       STEEL,     NOT_VERY_EFFECTIVE
+	db BUG,       FAIRY,     NOT_VERY_EFFECTIVE
 	...
 	db DRAGON,    STEEL,     NOT_VERY_EFFECTIVE
+	db DRAGON,    FAIRY,     NO_EFFECT
 	...
 	db DARK,      STEEL,     NOT_VERY_EFFECTIVE
+	db DARK,      FAIRY,     NOT_VERY_EFFECTIVE
 	...
 	db STEEL,     STEEL,     NOT_VERY_EFFECTIVE
+	db STEEL,     FAIRY,     SUPER_EFFECTIVE
+	db FAIRY,     FIRE,      NOT_VERY_EFFECTIVE
+	db FAIRY,     FIGHTING,  SUPER_EFFECTIVE
+	db FAIRY,     POISON,    NOT_VERY_EFFECTIVE
+	db FAIRY,     DRAGON,    SUPER_EFFECTIVE
+	db FAIRY,     DARK,      SUPER_EFFECTIVE
+	db FAIRY,     STEEL,     NOT_VERY_EFFECTIVE

 	db -2 ; end (with Foresight)

 ; Foresight removes Ghost's immunities.
 	db NORMAL,    GHOST,     NO_EFFECT
 	db FIGHTING,  GHOST,     NO_EFFECT

 	db -1 ; end

4. Make it searchable in the Pokédex

These tables are used for the Pokédex's type search feature.

Edit data/types/search_types.asm:

 PokedexTypeSearchConversionTable:
 ; entries correspond with PokedexTypeSearchStrings (see data/types/search_strings.asm)
	table_width 1, PokedexTypeSearchConversionTable
 	db NORMAL
 	...
 	db STEEL
+	db FAIRY
	assert_table_length NUM_TYPES

Edit data/types/search_strings.asm:

 PokedexTypeSearchStrings:
 ; entries correspond with PokedexTypeSearchConversionTable (see data/types/search_types.asm)
	table_width POKEDEX_TYPE_STRING_LENGTH, PokedexTypeSearchStrings
 	db "  ----  @"
 	db " NORMAL @"
 	...
 	db " STEEL  @"
+	db " FAIRY  @"
	assert_table_length NUM_TYPES + 1

5. Update Pokémon types

Edit the type entries in data/pokemon/base_stats/:

6. Update move types

Edit the type columns in data/moves/moves.asm:

  • CHARM: NORMALFAIRY
  • SWEET_KISS: NORMALFAIRY
  • MOONLIGHT: NORMALFAIRY

7. Change Polkadot Bow to boost Fairy moves

At this point we're technically done: all the canon aspects of the Fairy type are implemented. (If you want to add new Fairy-type Pokémon or moves, check out different tutorials.) But there's no held type-boosting item for it, and Gen 2 happens to have the unavailable POLKADOT_BOW item that boosts Normal moves like PINK_BOW, so let's change it to boost Fairy moves instead.

Edit constants/item_data_constants.asm:

	const_next 50
	const HELD_NORMAL_BOOST
 	...
 	const HELD_STEEL_BOOST
+	const HELD_FAIRY_BOOST

Edit data/types/type_boost_items.asm:

 TypeBoostItems:
-	db HELD_NORMAL_BOOST,   NORMAL   ; PINK_BOW/POLKADOT_BOW
+	db HELD_NORMAL_BOOST,   NORMAL   ; PINK_BOW
 	...
 	db HELD_STEEL_BOOST,    STEEL    ; METAL_COAT
+	db HELD_FAIRY_BOOST,    FAIRY    ; POLKADOT_BOW
 	db -1

Edit data/items/attributes.asm:

 ItemAttributes:
 ; entries correspond to constants/item_constants.asm
	table_width ITEMATTR_STRUCT_LENGTH, ItemAttributes
 ...
 ; POLKADOT_BOW
-	item_attribute 100, HELD_NORMAL_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE
+	item_attribute 100, HELD_FAIRY_BOOST, 10, CANT_SELECT, ITEM, ITEMMENU_NOUSE, ITEMMENU_NOUSE

And lastly, edit data/items/descriptions.asm:

 PolkadotBowDesc:
-	db   "Powers up normal-"
+	db   "Powers up fairy-"
 	next "type moves. (HOLD)@"

Now we're done!

Screenshot

If you're just varying the original Crystal game, note that you can get three Pink Bows (one from Tuscany on Tuesdays, one from Mary after clearing Team Rocket from Radio Tower, and one from Picnicker Tiffany if you get her phone number), so one of those can be replaced with a Fairy-boosting Polkadot Bow.

You'll also need damaging Fairy moves like Moonblast and Dazzling Gleam, so look up how to add those in the new move tutorial.