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
178
179
180
181
182
183
184
185
186
|
This tutorial is for how to add a new fishing rod. As an example, we'll add a Master Rod, even better than a Super Rod.
## Contents
1. [Create the new Rod item](#1-create-the-new-rod-item)
2. [Define the item effect](#2-define-the-item-effect)
3. [Define wild data for the new Rod](#3-define-wild-data-for-the-new-rod)
4. [Update the code that loads the wild data](#4-update-the-code-that-loads-the-wild-data)
## 1. Create the new Rod item
Follow [the tutorial to add a new item](Add-a-new-item) 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
Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm):
```diff
ItemEffects:
; entries correspond to item ids
dw PokeBallEffect ; MASTER_BALL
...
dw NoEffect ; ITEM_87
- dw NoEffect ; ITEM_88
+ dw MasterRodEffect ; MASTER_ROD
dw NoEffect ; ITEM_89
...
dw NoEffect ; ITEM_B3
...
OldRodEffect:
ld e, $0
jr UseRod
GoodRodEffect:
ld e, $1
jr UseRod
SuperRodEffect:
ld e, $2
jr UseRod
+
+MasterRodEffect:
+ ld e, $3
+ jr UseRod
UseRod:
farcall FishFunction
ret
```
Pretty simple; we just observe how the other three Rods work, and follow their pattern.
## 3. Define wild data for the new Rod
Edit [data/wild/fish.asm](../blob/master/data/wild/fish.asm):
```diff
time_group EQUS "0," ; use the nth TimeFishGroups entry
fishgroup: MACRO
-; chance, old rod, good rod, super rod
- dbwww \1, \2, \3, \4
+; chance, old rod, good rod, super rod, master rod
+ db \1
+ dw \2, \3, \4, \5
ENDM
FishGroups:
; entries correspond to FISHGROUP_* constants
- fishgroup 50 percent + 1, .Shore_Old, .Shore_Good, .Shore_Super
- ...
- fishgroup 50 percent + 1, .Qwilfish_NoSwarm_Old, .Qwilfish_NoSwarm_Good, .Qwilfish_NoSwarm_Super
+ fishgroup 50 percent + 1, .Shore_Old, .Shore_Good, .Shore_Super, .Shore_Master
+ ...
+ fishgroup 50 percent + 1, .Qwilfish_NoSwarm_Old, .Qwilfish_NoSwarm_Good, .Qwilfish_NoSwarm_Super, .Qwilfish_NoSwarm_Master
...
.Remoraid_Old:
db 70 percent + 1, MAGIKARP, 10
db 85 percent + 1, MAGIKARP, 10
db 100 percent, POLIWAG, 10
.Remoraid_Good:
db 35 percent, MAGIKARP, 20
db 70 percent, POLIWAG, 20
db 90 percent + 1, POLIWAG, 20
db 100 percent, time_group 6
.Remoraid_Super:
db 40 percent, POLIWAG, 40
db 70 percent, time_group 7
db 90 percent + 1, MAGIKARP, 40
db 100 percent, REMORAID, 40
+
+.Shore_Master:
+.Ocean_Master:
+.Lake_Master:
+.Pond_Master:
+.WhirlIslands_Master:
+ db 20 percent, OMASTAR, 60
+ db 40 percent, KABUTOPS, 60
+ db 70 percent, OCTILLERY, 60
+ db 90 percent + 1, LAPRAS, 60
+ db 100 percent, KINGDRA, 60
+
+.Gyarados_Master:
+ db 40 percent, MAGIKARP, 60
+ db 70 percent, GYARADOS, 60
+ db 90 percent + 1, GYARADOS, 60
+ db 100 percent, GYARADOS, 60
+
+.Dratini_Master:
+.Dratini_2_Master:
+ db 40 percent, GYARADOS, 60
+ db 70 percent, KINGDRA, 60
+ db 90 percent + 1, DRAGONAIR, 60
+ db 100 percent, DRAGONITE, 60
+
+.Qwilfish_Master:
+.Qwilfish_Swarm_Master:
+.Qwilfish_NoSwarm_Master:
+ db 40 percent, TENTACRUEL, 60
+ db 70 percent, QWILFISH, 60
+ db 90 percent + 1, QWILFISH, 60
+ db 100 percent, QWILFISH, 60
+
+.Remoraid_Master:
+.Remoraid_Swarm_Master:
+ db 40 percent, TENTACRUEL, 60
+ db 70 percent, REMORAID, 60
+ db 90 percent + 1, REMORAID, 60
+ db 100 percent, OCTILLERY, 60
```
Here we've modified the `fishgroup` macro to take four pointers instead of three; added new pointers to the end of each `fishgroup` line for the Master Rod; and declared the actual data for the new Master Rod pointers.
Notice the format of the wild data. Each line has the format "<code>db <i>chance</i>, <i>species</i>, <i>level</i></code>" or "<code>db <i>chance</i>, time_group <i>index</i></code>", with the chances increasing up to 100%. A random byte from 0% to 100% is generated, and compared with the chances to determine your encounter.
## 4. Update the code that loads the wild data
Edit [constants/pokemon_data_constants.asm](../blob/master/constants/pokemon_data_constants.asm):
```diff
-FISHGROUP_DATA_LENGTH EQU 1 + 2 * 3
+FISHGROUP_DATA_LENGTH EQU 1 + 2 * 4
```
If you're using an older copy of pokecrystal and `FISHGROUP_DATA_LENGTH` does not exist, then edit [engine/events/fish.asm](../blob/master/engine/events/fish.asm) instead:
```diff
Fish:
; Using a fishing rod.
; Fish for monsters with rod e in encounter group d.
; Return monster e at level d.
push af
push bc
push hl
ld b, e
call GetFishGroupIndex
ld hl, FishGroups
-rept 7
+rept 9
add hl, de
endr
call .Fish
pop hl
pop bc
pop af
ret
```
Either way, this allows the `FishGroups` table to be indexed by Rods from 0 to 3, instead of 0 to 2. (Remember how we defined `MasterRodEffect`.)
We're done!

|