summaryrefslogtreecommitdiff
path: root/Add-a-new-move.md
blob: 61785502a7d430d17791cb7fb623277df631547f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
This tutorial is for how to add a new move, allowing up to 254 moves. As an example, we'll add Nasty Plot.


## Contents

1. [Define a move constant](#1-define-a-move-constant)
2. [Give it a name and description](#2-give-it-a-name-and-description)
3. [Define its battle properties](#3-define-its-battle-properties)
4. [Define its animation](#4-define-its-animation)
5. [Let Pokémon learn the move](#5-let-pokémon-learn-the-move)


## 1. Define a move constant

Edit [constants/move_constants.asm](../blob/master/constants/move_constants.asm):

```diff
 ; move ids
 ; indexes for:
 ; - Moves (see data/moves/moves.asm)
 ; - MoveNames (see data/moves/names.asm)
 ; - MoveDescriptions (see data/moves/descriptions.asm)
 ; - BattleAnimations (see data/moves/animations.asm)
 	const_def
 	const NO_MOVE      ; 00
 	const POUND        ; 01
 	...
 	const BEAT_UP      ; fb
+	const NASTY_PLOT   ; fc
 NUM_ATTACKS EQU const_value + -1

-	const MOVE_OR_ANIM_FC ; fc
 	const MOVE_OR_ANIM_FD ; fd
 	const MOVE_OR_ANIM_FE ; fe

 ; Battle animations use the same constants as the moves up to this point
 	const ANIM_SWEET_SCENT_2     ; ff
 	...
```

Move constants are actually a subset of battle animation constants. $01 to $FB are the 251 constants from `POUND` to `BEAT_UP`; then `MOVE_OR_ANIM_FC`, `MOVE_OR_ANIM_FD`, and `MOVE_OR_ANIM_FE` are unused; then `ANIM_SWEET_SCENT_2` and above correspond to animations beyond the ones played for moves (throwing Poké Balls, showing confusion, etc). Anyway, those three `MOVE_OR_ANIM_*` constants can all be used for new moves.


## 2. Give it a name and description

Edit [data/moves/names.asm](../blob/master/data/moves/names.asm):

```diff
 MoveNames::
 	db "POUND@"
 	...
 	db "BEAT UP@"
+	db "NASTY PLOT@"
```

A name can be up to 12 characters long, plus a "@" at the end.

Now edit [data/moves/descriptions.asm](../blob/master/data/moves/descriptions.asm):

```diff
 MoveDescriptions::
 ; entries correspond to move ids (see constants/move_constants.asm)
 	dw PoundDescription
 	...
 	dw BeatUpDescription
-	dw MoveFCDescription
+	dw NastyPlotDescription
 	dw MoveFDDescription
 	dw MoveFEDescription
 	dw MoveFFDescription
 	dw Move00Description

-MoveFCDescription:
 MoveFDDescription:
 MoveFEDescription:
 MoveFFDescription:
 Move00Description:
 	db "?@"

 ...

 BeatUpDescription:
 	db   "Party #MON join"
 	next "in the attack.@"
+
+NastyPlotDescription:
+	db   "Sharply increases"
+	next "user's SPCL.ATK.@"
```

A description has two lines, each with up to 18 characters, plus a "@" at the end.


## 3. Define its battle properties

Edit [data/moves/moves.asm](../blob/master/data/moves/moves.asm):

```diff
 Moves:
 ; entries correspond to constants/move_constants.asm
 	move POUND,        EFFECT_NORMAL_HIT,         40, NORMAL,   100, 35,   0
 	...
 	move BEAT_UP,      EFFECT_BEAT_UP,            10, DARK,     100, 10,   0
+	move NASTY_PLOT,   EFFECT_SP_ATK_UP_2,         0, DARK,     100, 20,   0
```

The `move` defines these properties:

- **animation:** Which animation to play when using the move. Remember, constants like `POUND` correspond to moves but also to battle animations, as we'll see later.
- **effect:** What effect the move has. Valid effects are in [constants/move_effect_constants.asm](../blob/master/constants/move_effect_constants.asm). Some exist that aren't used for any moves yet, like `EFFECT_SP_ATK_UP_2`.
- **power:** The base power. 0 for non-damaging moves; 1 for moves that do damage but not with the standard formula, like Seismic Toss, Counter, or Magnitude. (The AI uses this property to distinguish damaging and non-damaging moves.)
- **type:** The type.
- **accuracy:** The accuracy, from 1 to 100.
- **PP:** The PP, from 5 to 40. Sketch has 1 PP but it requires special-case code in some places; and 40 is the maximum because any more and PP Up could boost it out of bounds. (PP is stored in 6 bits, not a full byte, so cannot exceed 63.)
- **effect chance:** The chances of an effect triggering. Not applicable for all effects.


## 4. Define its animation

Edit [data/moves/animations.asm](../blob/master/data/moves/animations.asm):

```diff
 BattleAnimations::
 ; entries correspond to constants/move_constants.asm
 	dw BattleAnim_0
 	dw BattleAnim_Pound
 	...
 	dw BattleAnim_BeatUp
-	dw BattleAnim_252
+	dw BattleAnim_NastyPlot
 	dw BattleAnim_253
 	dw BattleAnim_254
 	dw BattleAnim_SweetScent2
 ; $100
 	dw BattleAnim_ThrowPokeBall
 	...

 BattleAnim_0:
-BattleAnim_252:
 BattleAnim_253:
 BattleAnim_254:
 BattleAnim_MirrorMove:
 	anim_ret

 ...

+BattleAnim_NastyPlot:
BattleAnim_PsychUp:
	anim_1gfx ANIM_GFX_STATUS
	anim_call BattleAnim_FollowEnemyFeet_0
	anim_bgeffect ANIM_BG_1A, $0, $1, $20
	anim_sound 0, 0, SFX_PSYBEAM
	anim_obj ANIM_OBJ_PSYCH_UP, 44, 88, $0
	anim_obj ANIM_OBJ_PSYCH_UP, 44, 88, $10
	anim_obj ANIM_OBJ_PSYCH_UP, 44, 88, $20
	anim_obj ANIM_OBJ_PSYCH_UP, 44, 88, $30
	anim_wait 64
	anim_incbgeffect ANIM_BG_1A
	anim_call BattleAnim_ShowMon_0
	anim_wait 16
	anim_ret
```

Designing a new animation is beyond the scope of this tutorial. They require careful placement and timing of different elements, and the scripting system used to do this is [poorly understood](../blob/master/docs/battle_anim_commands.md). Here we're just reusing Psych Up's animation for Nasty Plot, since it looks appropriate.


## 5. Let Pokémon learn the move

By now the move fully exists—it might show up with Metronome—but no Pokémon can use it. So add it to level-up learnsets in [data/pokemon/evos_attacks.asm](../blob/master/data/pokemon/evos_attacks.asm), egg move sets in [data/pokemon/egg_moves.asm](../blob/master/data/pokemon/egg_moves.asm), or NPC trainers' parties in [data/trainers/parties.asm](../blob/master/data/trainers/parties.asm) (see the [new Pokémon](Add-a-new-Pokémon) and [new trainer](Add-a-new-trainer-class) tutorials for help with that). Or add a new TM for it, following [the tutorial](Add-a-new-TM).

I added `NASTY_PLOT` to these sets, based on their canon ones in later generations:

- [data/pokemon/evos_attacks.asm](../blob/master/data/pokemon/evos_attacks.asm): Meowth, Persian, Drowzee, Hypno, Mew, Pichu, Aipom, Slowking, Girafarig, Houndour, Houndoom
- [data/pokemon/egg_moves.asm](../blob/master/data/pokemon/egg_moves.asm): Zubat, Drowzee, Mr. Mime, Togepi, Misdreavus, Houndour, Smoochum
- [data/trainers/parties.asm](../blob/master/data/trainers/parties.asm): Karen's Houndoom

![Screenshot](screenshots/nasty-plot.png)