summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Add-a-new-fishing-rod.md188
-rw-r--r--Tutorials.md2
-rw-r--r--screenshots/master-rod.pngbin0 -> 2284 bytes
3 files changed, 189 insertions, 1 deletions
diff --git a/Add-a-new-fishing-rod.md b/Add-a-new-fishing-rod.md
new file mode 100644
index 0000000..902abed
--- /dev/null
+++ b/Add-a-new-fishing-rod.md
@@ -0,0 +1,188 @@
+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.
+
+
+## TOC
+
+
+## 1. Create the Master Rod item
+
+Follow [the tutorial to add a new item](Add-different-kinds-of-new-items) to create the Master Rod. Replace `ITEM_87` with `MASTER_ROD`; give it a name, description, and attributes (`0, HELD_NONE, 0, CANT_TOSS, KEY_ITEM, ITEMMENU_CLOSE, ITEMMENU_NOUSE`); and remove `ITEM_87` from `TimeCapsule_CatchRateItems`.
+
+
+## 2. Define the item effect
+
+Edit [engine/items/item_effects.asm](../blob/master/engine/items/item_effects.asm):
+
+```diff
+ ItemEffects: ; e73c
+ ; entries correspond to item ids
+ dw PokeBallEffect ; MASTER_BALL
+ ...
+ dw NoEffect ; PASS
+- dw NoEffect ; ITEM_87
++ dw MasterRodEffect ; MASTER_ROD
+ dw NoEffect ; ITEM_88
+ ...
+ dw NoEffect ; ITEM_B3
+ ; e8a2
+
+ ...
+
+ OldRodEffect: ; f5a5
+ ld e, $0
+ jr UseRod
+ ; f5a9
+
+ GoodRodEffect: ; f5a9
+ ld e, $1
+ jr UseRod
+ ; f5ad
+
+ SuperRodEffect: ; f5ad
+ ld e, $2
+ jr UseRod
+ ; f5b1
++
++MasterRodEffect:
++ ld e, $3
++ jr UseRod
+
+ UseRod: ; f5b1
+ farcall FishFunction
+ ret
+ ; f5b8
+```
+
+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: ; 92488
+ ; 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: ; 9264e
+ db 70 percent + 1, MAGIKARP, 10
+ db 85 percent + 1, MAGIKARP, 10
+ db 100 percent, POLIWAG, 10
+ .Remoraid_Good: ; 92657
+ db 35 percent, MAGIKARP, 20
+ db 70 percent, POLIWAG, 20
+ db 90 percent + 1, POLIWAG, 20
+ db 100 percent, time_group 6
+ .Remoraid_Super: ; 92663
+ db 40 percent, POLIWAG, 40
+ db 70 percent, time_group 7
+ db 90 percent + 1, MAGIKARP, 40
+ db 100 percent, REMORAID, 40
+ ; 9266f
++
++.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:
+
+```
+ Fish: ; 92402
+ ; 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
+ ; 9241a
+```
+
+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!
+
+![Screenshot](screenshots/master-rod.png)
diff --git a/Tutorials.md b/Tutorials.md
index 74310ea..7c9a9ba 100644
--- a/Tutorials.md
+++ b/Tutorials.md
@@ -24,6 +24,7 @@ Tutorials may use diff syntax to show edits:
- [Music song](Add-a-new-music-song)
- [Pack pocket](Add-a-new-Pack-pocket)
- [Radio channel](Add-a-new-radio-channel)
+- [Fishing rod](Add-a-new-fishing-rod)
**Upgrades to existing features:**
@@ -52,7 +53,6 @@ Tutorials may use diff syntax to show edits:
- Example map scripts (for common cases like an NPC that gives you an item)
- Scene for an existing map (aka triggers; auto-running event scripts)
- HM (for Rock Smash)
-- Fourth fishing rod
- 8th wild grass slot
- Two more Unown forms
- Evolution method (location, held item, move)
diff --git a/screenshots/master-rod.png b/screenshots/master-rod.png
new file mode 100644
index 0000000..dbd474a
--- /dev/null
+++ b/screenshots/master-rod.png
Binary files differ