Facts
Released
2000-12-14 (JP); 2001-07-30 (NA)
Genre
Japanese role-playing game, Monster-taming
Platforms
Game Boy Color
Developer
Game Freak
Publisher
Nintendo
Series
Pokémon
Code
Disassembly by pret contributors
Evidence
Code (7)
Wiki (1)
Sources
5
On this page
  1. Related
  2. Mechanics
  3. References
  4. Sources

Pokémon Crystal is a Generation II game for the Game Boy Color, released in Japan in December 2000 and North America in July 20011. The code read here is pret’s pokecrystal disassembly.

In type effectiveness, Crystal adds Steel and Dark2 and changes four older matchups3. Immunity becomes an explicit miss4, and Foresight removes the Ghost immunities5.

Interactive: type-matrix (needs JavaScript)

Crystal’s type chart. Cells changed since Red/Blue are outlined.

Mechanics

MechanicKindHow
Type effectiveness17 typesSteel and Dark join, four matchups change, and ×0 becomes an outright miss
Same-type attack bonusHalf againdamage plus half, after weather and badge boosts and before the type rows
Damage formulaAttack over defenseRed and Blue's order, with held-item boosts and the critical's ×2 inside the base step
Critical hitFrom stagesFocus Energy, high-critical moves, and a Scope Lens add stages, from 17 to 128 in 256
Hit chanceMove accuracyan accuracy byte after stages, less 20 against a BrightPowder, and 255 always hits
Multi-hit attackPer-hit damage2–5 hits, each with its own critical and damage roll
Random encounterBy areaRate by timeSlots by timethe map's rate for morning, day, or night, then one of 7 grass slots
FleeingSpeed ratioRed and Blue's formula, plus a held Smoke Ball that always escapes
Turn orderPriority, then Speedmove priority from 0 to 3, then a held Quick Claw's roll, then Speed
Random number generatorHardware-stirredRed and Blue's divider-stirred generator, returning the other byte
Held itemGold and Silver's held effects: a Scope Lens, a BrightPowder, a Quick Claw, and a Smoke Ball
WeatherSet by movesGold and Silver's rain and sun, unchanged
Time of daymorning, day, and night rates for wild encounters, as in Gold and Silver
Raster effectsPer linean interrupt after each line copies the next line's byte from a 144-entry table into one video register; the Magnet Train scrolls three bands
CaptureSingle catch rollone byte against the ball-modified rate scaled by (3M − 2H)/3M plus a sleep or freeze bonus; the wobbles are rolled after the result
Physical/special splitBy typethe type decides, with Dark special and Steel physical
Every claim about this game, by concept (39)
generalPokémon Crystal (developer Game Freak, publisher Nintendo, Game Boy Color, and Generation II core series) came out in Japan on 14 December 2000 and North America on 30 July 2001.Wiki
CaptureA wild Pokémon's catch rate is its species' catch-rate byte, copied into the wild Pokémon's battle data when the battle loads it (45 for Bulbasaur).Code
The Poké Ball item routine catches outright with a Master Ball or in the catching tutorial. Otherwise a ball's routine changes the catch rate: the Ultra Ball doubles it, and the Great, Safari, and Park Balls add half of it, each capped at 255. The Poké Ball has no routine and leaves it as it is.Code
For a Pokémon with max HP over 341 the catch formula breaks: when 3M is 256 or more, for max HP M and current HP H, the ball routine first divides both 3M and 2H by 4 (a quartered 2H of 0 becomes 1) and keeps only each low byte. Except with a Level Ball, it scales the ball-modified rate C′ by HP: X=max⁡(⌊C′(3M−2H)/3M⌋,1).Code
The Level Ball doubles the catch rate when the player's Pokémon is higher in level than the wild one, quadruples it when half the player's level is still higher, and multiplies it by 8 when a quarter is, capped at 255. It then skips the HP and status steps: its final rate is that multiplied catch rate alone.Code
Crystal adds 10 to X for a sleeping or frozen Pokémon, capped at 255, and nothing for burn, poison, or paralysis: the test meant to add 5 for them reads a value the sleep-and-freeze mask has already cleared. Gold and Silver have the same code, and their disassembly notes that those three statuses were meant to rank between sleep and none.Code
The final rate is stored, and one random byte at most that rate catches, so the chance is (X+1)/256 and a final rate of 255 always catches. This one roll decides the throw; the wobbles come after.Code
Computed, counting every value of the roll as equally likely: a Bulbasaur (catch rate 45) with max HP 100 and no status in a Poké Ball has a final rate of 15 at full HP, so 16 in 256 (6.25%), and 44 at 1 HP, so 45 in 256 (17.6%).Code
The ball's wobbles are drawn after the throw is decided. A caught Pokémon always gets three. On a failed throw, each of up to three wobbles happens with chance p/256, where p is read from the first row of the wobble table whose catch rate is at least the final rate (63 for a rate of 1, up to 255 for 255). The table's comment gives the left column over 255 as the right column over 255 to the fourth power, so each p is a fourth root, p/255=(𝑟𝑎𝑡𝑒/255)1/4.Code
Critical hitThe critical-hit battle command sums a critical level, +1 for Focus Energy, +2 for a high-critical move, and +1 for a Scope Lens, then rolls against 17, 32, 64, 85, or 128 in 256 for levels 0 to 4; Chansey with a Lucky Punch and Farfetch'd with a Stick get level 2 and skip the other bonuses.Code
A critical hit doubles the damage after held-item boosts and before the cap at 997 and the final +2. Unless the attacker's attacking-stat stage is higher than the defender's defending-stat stage, it also uses both Pokémon's stats without stages, which drops Reflect and Light Screen; pret's comment asks for the defender's stage to be higher, but the code takes this path at equal stages too.Code
Damage formulaType still picks the stats: Steel is physical (numbered below the first special type); Dark is special, using Special Attack against Special Defense.Code
A plain damaging move takes these steps in order: the critical-hit roll; loading the attacking and defending stats; the base damage formula, then held-item type boosts and the critical ×2; then weather, badge type boosts, the same-type ×1.5, and the type chart rows; then the random factor; and last the accuracy check.Code
As in Red and Blue, damage is multiplied by a random byte from 217 to 255 and divided by 255, and 0 or 1 damage is left untouched.Code
FleeingIn an ordinary wild battle Crystal keeps Red and Blue's escape formula. With P the player's Pokémon's Speed and E the foe's, P≥E escapes; otherwise the player escapes when a random byte is at most ⌊32P/(⌊E/4⌋mod256)⌋ plus 30 for each earlier attempt, or at once when the divisor ⌊E/4⌋mod256 is 0 or the sum passes 255. A held Smoke Ball always escapes, and the foe's Mean Look or a trapping move holding the player prevents it.Code
Hit chanceThe hit-check battle command scales the accuracy byte by the accuracy and evasion stages, subtracts 20 if the target holds a BrightPowder, and then hits on a random byte below it; an accuracy of 255 always hits.Code
Multi-hit attackThe battle command that ends a multi-hit loop gives 2–5 hits with Red and Blue's odds and Triple Kick 1–3 hits, 1/3 each, and jumps back to the critical-hit command, so every hit rolls its own critical and damage; the hit check sits before the loop and runs once.Code
Random encounterOn each step, the wild encounter check starts a battle when a random byte is below the map's rate for the time of day (morning, day, or night) or its water rate; the Pokémon March or Ruins of Alph radio doubles the rate, and the Pokémon Lullaby or a Cleanse Tag in the party halves it.Code
A second random number from 1 to 100 picks one of a grass area's 7 slots, at 30, 30, 20, 10, 5, 4, and 1 percent, or one of 3 water slots at 60, 30, and 10 percent.Code
Random number generatorCrystal's random-number routine is Red and Blue's generator, adding the divider register (with carry) to one byte and subtracting it (with borrow) from a second, but it returns the second where Red and Blue's returns the first; pret's comment says the divider counts at 16,384 Hz.Code
Raster effectsThe game sets the STAT interrupt to fire at every horizontal blank, and the handler copies the byte for the current line from a 144-entry table into whichever video register a pointer in high RAM names; while that pointer is 0 the handler does nothing. The handler runs in the horizontal blank after line LY, so entry n takes effect from line n + 1, and line 0 shows the register's value from before the frame (the Magnet Train writes its top band's scroll to hSCX for that line).Code
On the Magnet Train ride the scenery in the screen's top and bottom bands scrolls 4 pixels a frame, while the middle band, the train's, scrolls 1 pixel a frame to a hold point, pauses, then 2 a frame to its stop. Each frame the ride sets a horizontal scroll value for every screen line, in three bands of 47, 48, and 49 lines; the top and bottom bands take twice an offset that moves 2 a frame, and the middle band takes the train's position.Code
Same-type attack bonusThe STAB battle command applies weather and badge type boosts, then STAB (damage+⌊damage/2⌋ if either attacker type matches), then the type chart.Code
A comment in pokecrystal's STAB battle command expands STAB as “Same Type Attack Bonus”.Code
Turn orderCrystal ranks moves by priority: 3 for Protect, Detect, and Endure, 2 for Quick Attack, Mach Punch, and ExtremeSpeed, 1 for most moves, and 0 for Roar, Whirlwind, Counter, Mirror Coat, and Vital Throw; at equal priority a held Quick Claw goes first on a random byte below 60, then higher Speed, then a coin flip.Code
Type effectivenessCrystal's type chart has 108 non-neutral rows over 17 types, then a -2 marker, Normal→Ghost and Fighting→Ghost ×0, and a -1 end.Code
Multipliers are unchanged from Red/Blue: scaled by 10, with 20 for “super effective”, 05 for “not very effective”, 00 for no effect, and 10 for effective.Code
Crystal's type constants add Steel (physical), Dark (special), and an unused curse type named “???”; the Bird type remains, still with no rows.Code
Struggle returns from the STAB battle command at once, so it skips weather, badge boosts, STAB, and the type chart.Code
Each type chart row matching the move's type and either defender type computes damage×value; a nonzero product becomes ⌊product/10⌋, raised to 1 if that truncates to 0, and a zero product stays 0.Code
In Crystal, a ×0 type chart row makes the move miss as soon as it matches, where Red and Blue mark a miss only when the damage reaches 0.Code
A ×¼ hit no longer truncates to a miss: 2 damage through two ½ rows gives ⌊2 × 5 / 10⌋ = 1, then ⌊1 × 5 / 10⌋ = 0, raised to 1.Code
Against a target hit by Foresight, the type chart is read only up to an end marker placed before the Normal-against-Ghost and Fighting-against-Ghost immunities, so those two rows are skipped.Code
After the loop, the type matchup check's combined value (m=⌊m×row/10⌋ from 10) replaces the effectiveness byte, so the text reflects every row: ×4 is 40, ×¼ is 2, and ½ with 2× is 10.Code
An Ice move against a Water/Flying Pokémon prints no effectiveness message in Crystal: the message reads a combined value that starts at 10 and is multiplied by each matching row's value and divided by 10, here 10 → 5 → 10.Code
As in Red and Blue, row order matters: an Ice move against a Water/Flying Pokémon takes 3 damage to ⌊3 × 5 / 10⌋ = 1 at the ½ row, then to ⌊1 × 20 / 10⌋ = 2 at the 2× row, not 3.Code
Crystal's type chart makes Ghost-type moves super effective on Psychic types.Code
Crystal's table adds Steel and Dark and changes four Red/Blue matchups: Poison→Bug ×2 → ×1, Bug→Poison ×2 → ×½, Ghost→Psychic ×0 → ×2, and Ice→Fire ×1 → ×½.Code
WeatherCrystal's Rain Dance, Sunny Day, and weather tables match Gold's: Rain Dance and Sunny Day set rain or sun for 5 turns, and in rain a Water move does ×1.5 and a Fire move ×½, in sun the reverse.Code

References

  1. ^WikiBulbapedia, “Pokémon Crystal Version”
    How we know

    Pokémon Crystal (developer Game Freak, publisher Nintendo, Game Boy Color, and Generation II core series) came out in Japan on 14 December 2000 and North America on 30 July 2001.

    Developer: Game Freak … Publisher: Nintendo … Part of: Generation II core series … Japan: December 14, 2000 … (Game Boy) … North America: July 30, 2001 … (Game Boy)
    infobox, Basic info and Release dates · archived copy ↗

    Claim page

  2. ^Codepret/pokecrystaltype_constants.asm 9–37; names.asm 37
    How we know

    Crystal's type constants add Steel (physical), Dark (special), and an unused curse type named “???”; the Bird type remains, still with no rows.

    19	const STEEL
    ⋮
    23	const CURSE_TYPE
    ⋮
    34	const DARK
    
    constants/type_constants.asm lines 9–37 at 97187cd · upstream ↗
    37CurseType: db "???@"
    
    data/types/names.asm line 37 at 97187cd · upstream ↗

    Measured by a script. It fails if the result disagrees with the claim.

    Claim page

  3. ^Codepret/pokered · pret/pokecrystal · Bulbapedia, “Type/Type chart”type_matchups.asm 1–85, 1–118; battle_constants.asm 61–65, 21–25
    How we know

    Crystal's table adds Steel and Dark and changes four Red/Blue matchups: Poison→Bug ×2 → ×1, Bug→Poison ×2 → ×½, Ghost→Psychic ×0 → ×2, and Ice→Fire ×1 → ×½.

    48	db POISON,       BUG,          SUPER_EFFECTIVE
    ⋮
    70	db BUG,          POISON,       SUPER_EFFECTIVE
    ⋮
    78	db GHOST,        PSYCHIC_TYPE, NO_EFFECT
    
    data/types/type_matchups.asm lines 1–85 at af51989 · upstream ↗
    61DEF SUPER_EFFECTIVE    EQU 20
    ⋮
    63DEF EFFECTIVE          EQU 10
    64DEF NOT_VERY_EFFECTIVE EQU 05
    65DEF NO_EFFECT          EQU 00
    
    constants/battle_constants.asm lines 61–65 at af51989 · upstream ↗
    42	db ICE,          FIRE,         NOT_VERY_EFFECTIVE
    ⋮
    80	db BUG,          POISON,       NOT_VERY_EFFECTIVE
    ⋮
    94	db GHOST,        PSYCHIC_TYPE, SUPER_EFFECTIVE
    ⋮
    103	db DARK,         DARK,         NOT_VERY_EFFECTIVE
    ⋮
    110	db STEEL,        STEEL,        NOT_VERY_EFFECTIVE
    
    data/types/type_matchups.asm lines 1–118 at 97187cd · upstream ↗
    The Dark and Steel types were introduced. Bug was made ½× against Poison instead of 2×. Poison was made 1× against Bug instead of 2×. Ghost was made 2× against Psychic instead of 0×. Ice was made ½× against Fire instead of 1×.
    Changes: Between Generations I and II · archived copy ↗

    Measured by a script. It fails if the result disagrees with the claim.

    1 more excerpts on the claim page

  4. ^Codepret/pokecrystaleffect_commands.asm 1329–1336; battle_constants.asm 25
    How we know

    In Crystal, a ×0 type chart row makes the move miss as soon as it matches, where Red and Blue mark a miss only when the damage reaches 0.

    1329; If the target is immune to the move, treat it as a miss and calculate the damage as 0
    1330	ld a, [hl]
    1331	and a
    1332	jr nz, .NotImmune
    1333	inc a
    1334	ld [wAttackMissed], a
    
    engine/battle/effect_commands.asm lines 1329–1336 at 97187cd · upstream ↗
    25DEF NO_EFFECT          EQU 00
    
    constants/battle_constants.asm line 25 at 97187cd · upstream ↗

    Claim page

  5. ^Codepret/pokecrystaleffect_commands.asm 1302–1310; type_matchups.asm 112–118; +1 files
    How we know

    Against a target hit by Foresight, the type chart is read only up to an end marker placed before the Normal-against-Ghost and Fighting-against-Ghost immunities, so those two rows are skipped.

    1302	; foresight
    1303	cp -2
    1304	jr nz, .SkipForesightCheck
    1305	ld a, BATTLE_VARS_SUBSTATUS1_OPP
    1306	call GetBattleVar
    1307	bit SUBSTATUS_IDENTIFIED, a
    1308	jr nz, .end
    
    engine/battle/effect_commands.asm lines 1302–1310 at 97187cd · upstream ↗
    112	db -2 ; end (with Foresight)
    ⋮
    114; Foresight removes Ghost's immunities.
    115	db NORMAL,       GHOST,        NO_EFFECT
    116	db FIGHTING,     GHOST,        NO_EFFECT
    ⋮
    118	db -1 ; end
    
    data/types/type_matchups.asm lines 112–118 at 97187cd · upstream ↗
    1BattleCommand_Foresight:
    ⋮
    4	jr nz, .failed
    ⋮
    7	jr nz, .failed
    ⋮
    9	ld a, BATTLE_VARS_SUBSTATUS1_OPP
    10	call GetBattleVarAddr
    11	bit SUBSTATUS_IDENTIFIED, [hl]
    12	jr nz, .failed
    ⋮
    14	set SUBSTATUS_IDENTIFIED, [hl]
    
    engine/battle/move_effects/foresight.asm lines 1–14 at 97187cd · upstream ↗

    Claim page

  6. ^Codepret/pokegold · pret/pokecrystaleffect_commands.asm 1145–1205, 1120–1213; critical_hit_chances.asm 1–8
    How we know

    Gold and Silver already use the staged critical hit that Crystal keeps line for line: Focus Energy (+1), a high-critical move (+2), and a Scope Lens (+1) add to a critical level, which reads 17, 32, 64, 85, or 128 in 256 from a table. Chansey holding a Lucky Punch and Farfetch'd holding a Stick get level 2 at once and skip the other bonuses.

    1145	cp CHANSEY
    1146	jr nz, .Farfetchd
    1147	ld a, [hl]
    1148	cp LUCKY_PUNCH
    1149	jr nz, .FocusEnergy
    ⋮
    1151; +2 critical level
    1152	ld c, 2
    1153	jr .Tally
    ⋮
    1156	cp FARFETCH_D
    1157	jr nz, .FocusEnergy
    1158	ld a, [hl]
    1159	cp STICK
    ⋮
    
    engine/battle/effect_commands.asm lines 1145–1205 at fc702b6 · upstream ↗
    1CriticalHitChances:
    2	db 1 out_of 15 ;  0
    3	db 1 out_of 8  ; +1
    4	db 1 out_of 4  ; +2
    5	db 1 out_of 3  ; +3
    6	db 1 out_of 2  ; +4
    
    data/battle/critical_hit_chances.asm lines 1–8 at fc702b6 · upstream ↗
    engine/battle/effect_commands.asm#L1120-L1213 · upstream ↗

    Claim page

  7. ^Codepret/pokegold · pret/pokecrystaltype_matchups.asm 1–118, 1–118; type_constants.asm 9–37; +2 files
    How we know

    Gold and Silver's type chart already has the 17 types (computed from the type constants), Steel and Dark included, and Ghost's ×2 on Psychic (a factor of 20 over 10), so these date from Gold and Silver; Crystal's chart has these rows too.

    1TypeMatchups:
    ⋮
    50	db FIGHTING,     DARK,         SUPER_EFFECTIVE
    ⋮
    94	db GHOST,        PSYCHIC_TYPE, SUPER_EFFECTIVE
    ⋮
    101	db DARK,         PSYCHIC_TYPE, SUPER_EFFECTIVE
    ⋮
    108	db STEEL,        ICE,          SUPER_EFFECTIVE
    ⋮
    112	db -2 ; end (with Foresight)
    ⋮
    118	db -1 ; end
    
    data/types/type_matchups.asm lines 1–118 at fc702b6 · upstream ↗
    1TypeMatchups:
    ⋮
    50	db FIGHTING,     DARK,         SUPER_EFFECTIVE
    ⋮
    94	db GHOST,        PSYCHIC_TYPE, SUPER_EFFECTIVE
    ⋮
    101	db DARK,         PSYCHIC_TYPE, SUPER_EFFECTIVE
    ⋮
    108	db STEEL,        ICE,          SUPER_EFFECTIVE
    ⋮
    112	db -2 ; end (with Foresight)
    ⋮
    118	db -1 ; end
    
    data/types/type_matchups.asm lines 1–118 at 97187cd · upstream ↗
    9DEF PHYSICAL EQU const_value
    10	const NORMAL
    11	const FIGHTING
    12	const FLYING
    13	const POISON
    14	const GROUND
    15	const ROCK
    16	const BIRD
    17	const BUG
    18	const GHOST
    19	const STEEL
    ⋮
    21DEF UNUSED_TYPES EQU const_value
    ⋮
    
    constants/type_constants.asm lines 9–37 at fc702b6 · upstream ↗

    2 more excerpts on the claim page

  8. ^Codepret/pokegold · pret/pokecrystalwildmons.asm 283–295, 252–348; probabilities.asm 6–21, 6–21
    How we know

    The time of day picks which of a grass area's three sets of 7 slots is used; a roll from 1 to 100 then picks a slot at 30, 30, 20, 10, 5, 4, and 1 percent, or one of 3 water slots at 60, 30, and 10 percent. Crystal's routine and table are the same.

    engine/overworld/wildmons.asm at fc702b6
    Our readingstep past wTimeOfDay × NUM_GRASSMON 2-byte slots (by its label)283–285the grass table286keep the list pointer (not quoted)290roll a random byte until it's below 100291–294+ 1: 1 to 100295
    6GrassMonProbTable:
    7	table_width 2
    8	mon_prob 30,  0 ; 30% chance
    9	mon_prob 60,  1 ; 30% chance
    10	mon_prob 80,  2 ; 20% chance
    11	mon_prob 90,  3 ; 10% chance
    12	mon_prob 95,  4 ;  5% chance
    13	mon_prob 99,  5 ;  4% chance
    14	mon_prob 100, 6 ;  1% chance
    ⋮
    18	table_width 2
    19	mon_prob 60,  0 ; 60% chance
    20	mon_prob 90,  1 ; 30% chance
    ⋮
    
    data/wild/probabilities.asm lines 6–21 at fc702b6 · upstream ↗
    6GrassMonProbTable:
    ⋮
    14	mon_prob 100, 6 ;  1% chance
    
    data/wild/probabilities.asm lines 6–21 at 97187cd · upstream ↗
    engine/overworld/wildmons.asm#L252-L348 · upstream ↗
    Our readingno wild data here: no battle (not quoted)253–254a roaming Pokémon met: battle it (not quoted)255–256on water: the water table (not quoted)261–263else: step past time of day × NUM_GRASSMON 2-byte slots (not quoted)264–268 the grass table (not quoted)269roll 1 to 100 (not quoted)274–278the first entry whose bound is at least the roll (not quoted)283–288its slot: the level (not quoted)290–296on water: + 0 to 4 levels by a second roll (not quoted)298–313the level kept (not quoted)317–318species not valid: no battle (not quoted)319–321Unown, with none unlocked: no battle (not quoted)323–329else: that species, battle (not quoted)340–345

    Claim page

Sources

Code

Secondary