Headbutt tree

Headbutt trees are special trees found in the Johto and Kanto regions that a Pokémon can use on to encounter wild Pokémon. They are only found in the games that feature Johto: , and .
==Generation II==
In Generation II, most outdoor areas in Johto contain a number of special trees () that Pokémon can use on. These trees are distinct from other trees that either take up two vertical paces or that have rounded tops. When a Pokémon uses Headbutt on a tree, a wild Pokémon may drop out of the tree. Depending on the time of day, the Pokémon that falls out may be . Some Pokémon can only be caught by this method (e.g., , ).
All headbuttable trees contain wild Pokémon, but different trees have different chances of creating an encounter after Headbutt is used. The headbuttable trees in an area also generate their encounters from different sets of Pokémon depending on whether they have moderate encounter chances or low encounter chances. For example, on , trees with moderate encounter chances may only contain or , while trees with a high encounter chance may also contain .
===Encounter mechanics===
The encounter rate and encounter table of each tree depends on the tree's index and the player's Trainer ID number.
The tree's index is an integer from 0 to 9, which depends on its X and Y coordinates on the map—that is, its distance from the westernmost and northernmost edges, respectively. Specifically, the tree's index is calculated using the following formula.
:TreeIndex = \left\lfloor \frac{X \cdot Y + X + Y}{5} \right\rfloor \bmod 10
The encounter rate and tree type depends on the last digit of the player's Trainer ID.
* If a tree's index is equal to that ID digit, the tree is a "high-encounter tree" and its encounter rate is 80%.
* If the tree's index is one of the next four indices after that ID digit (wrapping back around to 0 after 9), the tree is a "moderate-encounter tree" and its encounter rate is 50%.
* Otherwise, the tree is a "moderate-encounter tree" and its encounter rate is 10%.
====Encounter rate by index and Trainer ID====
The following is a table depicting the encounter rate of the tree, based on the tree index and the last digit of the player's Trainer ID. Tree indexes are displayed in rows, while Trainer ID digits are displayed in columns.
An 80% encounter rate indicates the tree is a "high-encounter tree". Otherwise it is a "moderate-encounter tree".
 	0 	1 	2 	3 	4 	5 	6 	7 	8 	9
0	80%	10%	10%	10%	10%	10%	50%	50%	50%	50%
1	50%	80%	10%	10%	10%	10%	10%	50%	50%	50%
2	50%	50%	80%	10%	10%	10%	10%	10%	50%	50%
3	50%	50%	50%	80%	10%	10%	10%	10%	10%	50%
4	50%	50%	50%	50%	80%	10%	10%	10%	10%	10%
5	10%	50%	50%	50%	50%	80%	10%	10%	10%	10%
6	10%	10%	50%	50%	50%	50%	80%	10%	10%	10%
7	10%	10%	10%	50%	50%	50%	50%	80%	10%	10%
8	10%	10%	10%	10%	50%	50%	50%	50%	80%	10%
9	10%	10%	10%	10%	10%	50%	50%	50%	50%	80%
====Analysis====
Since X and Y are interchangeable in the tree index formula, it is possible to "fix" one dimension to consider traveling along the other. Substituting "Z" for the fixed axis and "n" for the axis that will be traversed, the formula becomes:
:
\begin{align}
TreeIndex &= \left\lfloor \frac{Z \cdot n + Z + n}{5} \right\rfloor \bmod 10 \\
&= \left\lfloor \frac{(Z + 1) \cdot n + Z}{5} \right\rfloor \bmod 10
\end{align}
This result shows that, if a single row or column of trees is traversed, moving to an adjacent tree increases the tree's index by \tfrac{Z + 1}{5} (modulo 10), where Z is the distance of that row or column from its origin edge (north or west). This means that the closer a row or column is to the edge, the slower the indices of those trees change as the row or column is traversed.
===Pokémon===
The following group names are unofficial.
====Pokémon Gold and Silver====
Wild Pokémon encounters from headbuttable trees in fall into three simple groups, the third going unused.
=====Forest group=====
Assigned to Azalea Town, Ilex Forest, Lake of Rage, , , , , , , , and .
=====Mountain group=====
Assigned to , , , , , , , , , and .
(Note: Route 45 and 46 lack headbuttable trees altogether.)
=====City group=====
Assigned to New Bark Town, Violet City, Ecruteak City, Mahogany Town, and Blackthorn City.
(Note: Unused group exclusive to Gold and Silver. The encounter data for this group was removed in Crystal, and its pointer now redirects to the Mountain group's encounter data.)
====Pokémon Crystal====
In , wild Pokémon encounters from headbuttable trees fall into six different groups.
=====Mountain group=====
Assigned to , , and .
(Note: Route 45 and 46 lack headbuttable trees altogether.)
=====Town group=====
Assigned to Azalea Town, , and .
=====Route group=====
Assigned to , , , , , , , , and .
=====Border group=====
Assigned to , , and .
=====Lake group=====
Assigned to the Lake of Rage and .
=====Forest group=====
Assigned to Ilex Forest.
==Generation IV==
In , Pokémon are now pre-defined for each eligible location. Due to this, the levels of Pokémon vary between locations, and the player can now find Pokémon in Kanto beyond and . The player can Headbutt trees while ing, and in fact certain encounter trees are otherwise unreachable.
Each location has a pre-defined list of trees that can contain encounters. Each of these trees can have encounters from one of two encounter tables, or have no encounters at all. Which group the tree falls into depends on the player's Trainer ID and secret ID. Unlike in Generation II, a Headbutt tree that contains encounters will always yield one when headbutted; Repel cannot prevent Pokémon from appearing when headbutting a tree.
In addition to the standard two encounter tables, some locations have a third encounter table assigned to certain trees. These locations are Pewter City, Cherrygrove City, , , and , and National Park; the ones on Route 38 and in Cherrygrove City and National Park require scaling a rocky wall to access.
The amount of designated trees with Pokémon can range from as few as 2, to as many as 44 or 45 in Ilex Forest.
===Encounter mechanics===
The encounter type of each tree is determined by the player's full ID number and the number of designated trees in the area.
The player's full ID number is a 4-byte number, composed by concatenating their Secret ID (as the upper byte) with their Trainer ID (as the lower byte).
The number of designated trees is the number of trees (except Group C trees) that can possibly have headbutt encounters. The following table details how many designated trees are in each location.
Designated trees	Locations
1 	none
2 	(Celadon City side)
3 	Routes , , , and ; Mt. Silver Cave's mountainside
4 	Routes , and
5 or more 	All other locations with possible headbutt encounters
To determine which encounters are used, the value X = ID_{full} \mod 10 is derived from the player's full ID. This value (X), the number of designated trees (n), and the ID of the tree within the location's headbutt array (TreeID) are used to determine which encounter table is used.
* If n is 1 (unused): The tree will have group A encounters if X is even, and group B if X is odd.
* If n is 2, 3, or 4: Encounter_{ID} = Tree_{ID} + (X \times n), then lookup the tree type from the table below
* If n 5 or more: Encounter_{ID} = (Tree_{ID} \mod 5) + (X \times 5), then lookup the tree type from the table below
In the following table, columns refer to the number of designated trees in the area, while rows refer to EncounterID. Cases with no encounters are marked with –.
 Tree types
Encounter ID	2 	3 	4 	5
0 	A 	A 	- 	-
1 	B 	B 	A 	A
2 	B 	- 	A 	A
3 	A 	A 	B 	B
4 	A 	- 	B 	B
5 	B 	B 	- 	B
6 	B 	B 	A 	-
7 	A 	A 	A 	A
8 	A 	- 	B 	A
9 	B 	B 	B 	B
10 	B 	- 	- 	B
11 	A 	A 	A 	B
12 	A 	- 	A 	-
13 	B 	A 	B 	A
14 	B 	B 	B 	A
15 	A 	- 	- 	A
16 	A 	B 	A 	B
17 	B 	A 	A 	B
18 	B 	A 	B 	-
19 	A 	B 	B 	A
20 	N/A	- 	- 	A
21 	N/A	A 	A 	A
22 	N/A	- 	B 	B
23 	N/A	B 	A 	B
24 	N/A	B 	B 	-
25 	N/A	A 	- 	-
26 	N/A	- 	A 	A
27 	N/A	B 	B 	B
28 	N/A	- 	A 	A
29 	N/A	A 	B 	B
30 	N/A	N/A	- 	B
31 	N/A	N/A	A 	-
32 	N/A	N/A	B 	A
33 	N/A	N/A	A 	B
34 	N/A	N/A	B 	A
35 	N/A	N/A	- 	A
36 	N/A	N/A	A 	B
37 	N/A	N/A	B 	-
38 	N/A	N/A	A 	A
39 	N/A	N/A	B 	B
40 	N/A	N/A	N/A	B
41 	N/A	N/A	N/A	A
42 	N/A	N/A	N/A	B
43 	N/A	N/A	N/A	-
44 	N/A	N/A	N/A	A
45 	N/A	N/A	N/A	A
46 	N/A	N/A	N/A	B
47 	N/A	N/A	N/A	A
48 	N/A	N/A	N/A	B
49 	N/A	N/A	N/A	-
Due to the way the trees are assigned encounters, certain IDs have one less tree with encounters. For example, locations with 4 potential encounter trees have one tree with no encounters unless the ID combination results in X of 4 and 9. Similarly, in Ilex Forest, if an ID combination results in 0 or 5, there will be 12 trees without encounters instead of 11.
====Example====
For Trainer ID of 19410 (0x4BD2) and secret ID of 21243 (0x52FB):
:
\begin{align}
ID_{full} &= ID_{secret} \operatorname{||} ID_{trainer} \\
ID_{full} &= 52FB4BD2_{16} \\
ID_{full} &= 1392200658_{10}
\end{align}
:
\begin{align}
X & = ID_{full} \mod 10 \\
X & = 1392200658 \mod 10 \\
X & = 8 
\end{align}
With X of 8, EncounterID for first tree in the location is 16 for areas with 2 potential encounter trees, 24 for areas with 3, 32 for areas with 4, and 40 for areas with more than 4. In the first case, the tree has encounter group A; in all other cases it has encounter group B.
===Pokémon===
The following group names are unofficial.
====Johto route group====
New Bark Town, Ecruteak City, Safari Zone Gate, Routes , , , , , , , , , and 
====Cherrygrove City====
Cherrygrove City
====Violet City====
Violet City
====Johto mountain group====
Azalea Town, Routes , , and 
====Viridian City group====
Pallet Town, Viridian City, Routes , and 
====Pewter City====
Pewter City
====Cerulean City group====
Cerulean City, Routes , and 
====Vermilion and Celadon City group====
Vermilion City, Celadon City, Routes , and 
====Coastal Kanto group====
Fuchsia City, Routes , , , , and 
====Mt. Moon group====
Routes and 
====Route 25====
====Mt. Silver group====
, Mt. Silver and Mt. Silver Cave
====Route 32====
====Route 38====
====Lake of Rage group====
 and Lake of Rage
====Route 45====
====Route 47====
====Ilex Forest====
Ilex Forest
====National Park====
National Park
====Viridan Forest====
Viridian Forest
==External Links==
* Headbutt Tree Calculator
Category:Locations
Category:Methods of obtaining Pokémon
ja:ずつきができる木
zh:头锤树