| Ability | | | | | | uses | | | uses |
| Capture | - Every wild Pokémon of a species starts with the same catch rate, its species' (45 for a Bulbasaur): when the battle loads the Pokémon it copies the species' catch-rate byte, and the ball's catch-rate test reads that copy. In the Safari Zone, bait halves the copy and a rock doubles it, up to 255. Code
- Every ball but the Master Ball starts with a random first number whose range the ball sets: 0 to 255 for a Poké Ball, 0 to 200 for a Great Ball, and 0 to 150 for an Ultra or Safari Ball. The game draws a random byte and draws again while it is above the ball's limit. A Master Ball draws the byte too but ignores it, and catches without this or any later test. Code
- A sleeping or frozen Pokémon is easiest to catch, then a burned, paralyzed, or poisoned one. The ball subtracts 25 from its first number for sleep or freeze, 12 for any other status, and nothing without one, and a first number below that amount catches at once: sleep alone catches on 25 of a Poké Ball's 256 first numbers (9.8%) and on 25 of an Ultra Ball's 151 (16.6%) (computed). Otherwise the throw fails when the first number less that amount is above the catch rate, and goes on to the HP test when it isn't. Code
- The lower the Pokémon's HP, the likelier a throw that passes the catch-rate test (the first number, less the status amount, at most the catch rate) is to catch, and a Great Ball's second test is easier than any other ball's. The ball computes from the Pokémon's max HP and current HP , with 8 for a Great Ball and 12 for every other ball, each division rounding down. A over 255 catches; otherwise a second random byte catches when it is at most . At full HP the second test so passes about a third of the time (about half with a Great Ball), and from roughly a third of max HP down (half with a Great Ball) it always passes (computed). Code
- A Poké Ball catches a Bulbasaur (catch rate 45) with no status and max HP 100 about 6.0% of the time at full HP and 18.0% at 1 HP (computed, counting every value of each random byte as equally likely). Without a status, a throw's chance is : the share of first numbers at most the catch rate , out of , 256 for a Poké Ball, 201 for a Great Ball, and 151 for an Ultra or Safari Ball, times the share of second bytes at most , for max HP , current HP , and a ball factor of 8 for a Great Ball and 12 for any other. Code
- At full HP a Great Ball can catch more often than an Ultra Ball (computed): against a Bulbasaur (catch rate 45) with max HP 100 and no status, the Great Ball catches about 11.4% of the time and the Ultra Ball about 10.2%. A throw rolls two random numbers from 0 to 255, and on both a low roll is the one that catches. With no status, the first roll must be at or below the species' catch rate, its base-stats byte, which loading the opposing Pokémon copies in; the Great Ball rerolls any first roll above 200 and the Ultra Ball any above 150, so the Ultra Ball's first roll passes at least as often. The second roll must be at or below a target of max HP × 255, divided by 8 for the Great Ball or 12 for the Ultra Ball, then by a quarter of current HP (at least 1); a target above 255 catches with no second roll. The Great Ball's smaller divisor gives it the larger target, and with no status and a catch rate of 200 or more both first rolls always pass, so there the Great Ball never catches less often. Code
- A failed throw's shakes depend only on the ball and on the Pokémon's catch rate, HP, and status, so every failed throw of one ball at a Pokémon in the same state shows the same count: no random number feeds it (computed). The game computes from the catch rate , with 255 for a Poké Ball, 200 for a Great Ball, and 150 for any other, then from the HP test's result , plus 10 for sleep or freeze or 5 for another status. A under 10 misses ("You missed the POKéMON!"), under 30 shows one shake ("Darn! The POKéMON broke free!"), under 70 two ("Aww! It appeared to be caught!"), and 70 or more three ("Shoot! It was so close too!"). The code's branch for a over 255, which would show three, never runs: is at most 170 (computed). Code
- A ball thrown at a ghost is dodged ("It dodged the thrown BALL! This POKéMON can't be caught!"): at any wild Pokémon in Pokémon Tower while the Silph Scope isn't in the bag, and at the Marowak on the tower's 6F even with it. A ball thrown in the old man's battle always catches, and that Pokémon isn't added to the player's party, nor is a ball taken from the bag. The ghost tests and the old man's catch both come before any random number is drawn. Code
- A Master Ball catches every wild Pokémon but the ghosts, which dodge it as they dodge every ball, unless the party and the current PC box are both full, when no ball can be thrown: after the ghost tests, it skips the catch-rate, status, and HP tests, so neither status nor HP matters. A random byte is drawn before the ball is identified and never used. Code
- A badly poisoned Pokémon is as easy to catch as a poisoned one. Toxic sets the same poison bit in the status byte as other poisoning moves, plus a separate badly-poisoned flag, and the ball's status tests read only the status byte, so it subtracts 12 from the first number and adds 5 to the shake count, as for any status but sleep or freeze. Code
- A ball can be thrown only in battle; outside one, Oak says "This isn't the time to use that!". With six Pokémon in the party and 20 in the current PC box, a ball can't be thrown ("The POKéMON BOX is full! Can't use that item!"), except in the old man's battle. Thrown at a trainer's Pokémon, the ball is blocked ("The trainer blocked the BALL!", then "Don't be a thief!") and used up. Code
- Outside the old man's battle, a caught Pokémon ("All right! … was caught!") joins the party with the HP and status it had when the ball hit, or goes to the current PC box when the party is full, with "… was transferred to BILL's PC!" once the player has met Bill and "someone's PC!" before. A species not yet owned is first registered in the Pokédex and its entry shown ("New POKéDEX data will be added for …!"). Code
- A Pokémon that is transformed when caught is caught as a Ditto at its level, whatever its species: the catch code assumes only a Ditto can be transformed, which a comment in the disassembly calls a bug, since a wild Pokémon could copy Transform with Mirror Move. Code
- A Great Ball costs ¥600 and an Ultra Ball ¥1200, three and six times a Poké Ball's ¥200. The Master, Ultra, Great, Poké, and Safari Balls are all thrown through the same code. The price list gives the Safari Ball ¥1000 and the Master Ball 0. Code
- In the Safari Zone the wild Pokémon never attacks. Every battle in the Safari Zone's four areas is a Safari battle, whose menu offers BALL×, BAIT, THROW ROCK, and RUN in place of the usual commands. After each of the player's actions that doesn't end the battle, the Pokémon either flees or the menu comes back; no move is ever chosen for either side. Code
- Bait makes a Pokémon harder to catch and a rock easier. Bait halves its catch rate, rounded down, and a rock doubles it, up to 255; each throw works on the rate the last one left, so a Chansey's 30 becomes 15 after bait and 60 after a rock. Halving has no floor: six baits take a catch rate of 45 to 0 (computed), and with no status a rate of 0 still passes the catch-rate test, in which the ball's first random number, less the status amount, must not be above the catch rate, when that first number is 0. When the angry count runs out, the rate returns to the species' own value, undoing every bait and rock before it. When the eating count runs out, the rate stays where the bait left it, and bait thrown at an angry Pokémon clears the angry count without resetting the rate, as a rock thrown at an eating one clears the eating count. Code
- Bait makes the Pokémon eat and a rock makes it angry, each for 1 to 5 more turns, and each ends the other: bait clears the angry count and a rock the eating count. The turns added are a random byte's low three bits, redrawn until under 5, plus 1, and a count stops at 255. After each of the player's actions that doesn't end the battle, the game prints "Wild CHANSEY is eating!" (with the Pokémon's name) and takes a turn off the eating count; when the Pokémon isn't eating, it prints "Wild CHANSEY is angry!" and takes one off the angry count, and with neither count it prints nothing. Code
- A Safari Pokémon flees more often the faster it is, much less often while eating, and more often while angry: at a speed of 50 it flees about 39% of the time (100 in 256), 9.8% while eating, and 78% while angry (computed). After each of the player's actions that doesn't end the battle, it flees ("Wild CHANSEY ran!") when a random byte is below a threshold , so with chance . starts at twice its speed (the speed's low byte, all of any speed under 256), and a low byte of 128 or more makes it flee at once. While it is eating, is divided by 4, rounded down; while it is angry, is doubled, up to 255. The count is taken off before the roll, so bait that adds eating turns lowers the chance on of them (computed). Code
- A Safari Ball catches exactly as an Ultra Ball does: its first roll is redrawn until it is at most 150, its HP check uses a ball factor of 12, and a missed throw counts its shakes against 150. Each throw takes one of the Safari Balls the gate hands out instead of a ball from the bag. Code
- A Safari Zone encounter ends in one of four ways: a catch; the Pokémon fleeing; the player choosing RUN, which in the Safari Zone always gets away ("Got away safely!"); or a missed throw with the last Safari Ball, after which the PA announces "Ding-dong! You are out of SAFARI BALLs!" and the battle ends before the flee check. Code
- A Safari Game costs ¥500 and gives 30 Safari Balls and a step counter that starts at 502, shown out of 500. Each step takes one off, and a step that finds the counter at 0 ends the game ("PA: Ding-dong! Time's up!"); running out of Safari Balls ends it as soon as the player is back on the map. Either way the PA says "Your SAFARI GAME is over!" and the player is sent back to the gate. Code
- A wild Pokémon enters battle at full HP with no status. Its max HP is , capped at 999, where is its species' base HP, its level, and its HP DV, with no stat-experience bonus. A DV is a hidden value from 0 to 15 that each Pokémon has for each stat. A wild Pokémon's attack, defense, speed, and special DVs are the four 4-bit halves of two random bytes drawn when the battle loads it, and its HP DV takes the lowest bit of each: 8 from attack, 4 from defense, 2 from speed, and 1 from special. A level 5 Bulbasaur (base HP 45) so has 19 to 21 max HP (computed). A trainer's Pokémon gets fixed DVs and keeps its party HP and status instead, and a transformed one keeps the DVs it had before transforming. Code
| - Yellow's catch formula is Red and Blue's: every range, status value, ball factor, shake divisor, and shake threshold quoted here is the same in both. The cases around it differ. Yellow adds the Pikachu battle in Pallet Town at the start of the game, which shows Professor Oak on the player's side: a ball there takes the old man's branch and catches outright, and, as in the old man's battle, the full-party-and-box refusal is skipped and the Pokémon isn't given to the player. In the old man's battle itself, the throw catches outright unless a story flag for the first catch training is set, in which case it skips the catch and takes the three-shake result, $63, the value a failed throw's shake count of 70 or more gets. After every catch it gives the player, Yellow also sets Pikachu's mood. Code
| | - A 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 is 256 or more, for max HP and current HP , the ball routine first divides both and by 4 (a quartered of 0 becomes 1) and keeps only each low byte. Except with a Level Ball, it scales the ball-modified rate by HP: . 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 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 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 , where 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 is a fourth root, . Code
| | - The ball-throw command reads the target species' catch rate (45 for Bulbasaur), except with a Safari Ball, which uses the Safari Zone's catch factor times 1275 / 100; the factor starts at the species' catch rate times 100 / 1275. Code
- The ball multiplier is in tenths: 20 for an Ultra Ball, 15 for a Great or Safari Ball, 10 for a Poké Ball; a Net Ball 30 against a Water or Bug type, a Dive Ball 35 underwater, a Nest Ball 40 less the target's level below level 40 (at least 10), a Repeat Ball 30 for a species already caught, a Timer Ball 10 plus the turn count up to 40, and 10 for the Luxury and Premier Balls and for a Net, Dive, Nest, or Repeat Ball outside its condition. Code
- Emerald computes from catch rate , ball multiplier , max HP , and current HP , then doubles it for sleep or freeze, or multiplies it by 15/10 (rounded down) for poison, bad poison, burn, or paralysis. is the species' catch rate, or for a Safari Ball the Safari catch factor × 1275 / 100, rounded down. Code
- An over 254 catches at once. Otherwise Emerald turns it into a threshold , with Sqrt the GBA BIOS's square root, and draws up to four 16-bit random values; each one below is a shake. Four shakes catch; a throw that fails shows the shakes it passed, 0 to 3. A Master Ball's shakes are set to four after the draw. Code
- Computed, counting every random value as equally likely and taking the BIOS square root as rounding down: a throw catches with chance when . Since 16,711,680 is 255 × 65,536 and 1,048,560 is 16 × 65,535, is close to and four passes close to , higher for small because both roots round down. A Bulbasaur (catch rate 45) with max HP 100 in a Poké Ball has and at full HP, about 6.25%, and , at 1 HP, about 19.8%. Code
- Computed, for a Bulbasaur (catch rate 45) with max HP 100 and no status in a Poké Ball: at full HP it is caught about 6.0% of the time in Red and Blue, 6.25% in Crystal, and 6.25% in Emerald; at 1 HP, 18.0%, 17.6%, and 19.8%. Here the three formulas land close together, though they roll twice in Red and Blue, once in Crystal, and up to four times in Emerald. Code
| | - Platinum's shake-count routine keeps Emerald's capture math: the same , the same status bonuses (×2 for sleep or freeze; ×15/10 for poison, bad poison, burn, or paralysis), a catch at once when is 255 or more, and otherwise the threshold with up to four 16-bit rolls, each below a shake, and the Master Ball's shakes set to four after the draw. The two square roots run on the DS hardware square-root unit instead of Emerald's GBA BIOS call, and both games roll with the same generator, multiplier 1,103,515,245 and increment 24,691, keeping the top 16 bits. A Pal Park battle or the catching tutorial always catches. Code
- Platinum keeps Emerald's ball multipliers in tenths (Ultra 20, Great and Safari 15, Poké 10; Net 30 against Water or Bug, Nest 40 less the level below 40 with a floor of 10, Repeat 30, Timer 10 plus the turn count up to 40) and Emerald's 10 for the Luxury and Premier Balls. Two balls have new multipliers: a Dusk Ball gives 35 at night, late at night, or on cave terrain, and a Quick Ball 40 while the battle's turn count is 0. The Dive Ball's 35 now asks for water terrain where Emerald asks for an underwater map. A Safari Ball multiplies the catch rate by one of 13 fractions from 10/40 to 40/10, picked by a stage that starts at 6 (×1), where Emerald uses a Safari catch factor. The Heal and Cherish Balls, also new, give 10. Code
| - HeartGold and SoulSilver's ball-shake routine keeps Platinum's capture math: for catch rate , ball multiplier in tenths, max HP and current HP , ×2 for sleep or freeze and ×15/10 for burn, paralysis, poison, or bad poison, a catch at once when is 255 or more, and otherwise four 16-bit rolls each below , with the Master Ball's shakes set to four after the draw. The Ultra, Great, Poké, and Safari Balls keep Platinum's 20, 15, 10, and 15 (an assembly data table in the decompilation), and a Pal Park or tutorial battle always catches. Code
- In HeartGold and SoulSilver the Apricorn balls change the catch rate itself and leave the multiplier at 10, after which the rate is capped at 255 (a negative one becomes 1) and goes through the usual HP and status steps: the Fast Ball ×4 when the wild species' base Speed is 100 or more, the Level Ball ×2 when the attacking battler's level is above the wild Pokémon's, ×4 when half its level (rounded down) is above it, and ×8 when a quarter of its level (rounded down) is, the Lure Ball ×3 when fishing, the Love Ball ×8 for the same species of the opposite gender, and the Moon Ball ×4 for the 14 species of the Nidoran, Clefairy, Jigglypuff, and Skitty families listed in an assembly data table. Crystal's Level Ball skips the HP and status steps, and its disassembly's comments mark the Moon Ball as never boosting, the Love Ball as boosting the same gender, and the Fast Ball as boosting only three species. Code
- In HeartGold and SoulSilver a Heavy Ball takes 20 off the catch rate of every Pokémon under 204.8 kg (a result below 0 becomes 1), because its last branch tests the catch rate against 1024 instead of the weight; a comment in the decompilation calls this a mistake. The catch rate there is the species' base catch rate, a byte, so at most 255. The ball adds 40 to the catch rate at 409.6 kg or more, 30 at 307.2 kg, and 20 at 204.8 kg, reading weight in tenths of a kilogram from the Pokédex data. Crystal subtracts 20 only below 102.4 kg and adds nothing from there to 204.8 kg. Code
|
| Critical hit | - The critical-hit test makes a hit critical when a random byte is below a threshold set by the attacker's base Speed : for most moves, and for Karate Chop, Razor Leaf, Crabhammer, and Slash. Code
- Without Focus Energy, a Pokémon with base Speed 115, such as Persian, lands a critical hit on 57 of 256 rolls with most moves and on 255 of 256 with Slash. Code
- Focus Energy cuts the critical-hit chance to about a quarter instead of raising it: for most moves the threshold becomes in 256, where is the attacker's base Speed, against without it, because the code halves a value it should double; a comment in pret's disassembly marks this as a bug. Code
- A critical hit doubles the attacker's level in the damage formula and ignores stat stages, Reflect, and Light Screen: the player's Pokémon's attacking or defending stat comes from its party data, and the opponent's is recomputed from its base stat, level, and DVs, without stat experience, or read from its party data in a link battle. Code
| | | - The 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
| - Ruby and Sapphire's critical-hit command, which Emerald keeps apart from a renamed helper, sums Focus Energy (+2), a move whose effect is high-critical, Sky Attack, Blaze Kick, or Poison Tail (+1), a Scope Lens (+1), and Lucky Punch or Stick on their species (+2), caps the stage at 4, and hits critically 1 time in 16, 8, 4, 3, or 2. Battle Armor or Shell Armor on the target, a flag in the attacker's third status word, Wally's tutorial, and the first battle rule it out. Code
| - The critical-hit battle command sums a critical stage, +2 for Focus Energy, +1 for a high-critical move (including Sky Attack, Blaze Kick, and Poison Tail), +1 for a Scope Lens, and +2 for Chansey with a Lucky Punch or Farfetch'd with a Stick, capped at 4; a 16-bit random number taken modulo 16, 8, 4, 3, or 2 must be 0, a chance of 1/16, 1/8, 1/4, 21,846 in 65,536 (slightly over 1/3), or 1/2, and a target with Battle Armor or Shell Armor is never hit critically. Code
- The damage-calculation battle command multiplies the base damage by 2 on a critical; the base-damage formula then ignores the attacker's lowered attacking stat, the defender's raised defending stat, and Reflect or Light Screen. Code
| | - Platinum's critical-hit routine keeps Emerald's stage table, 1 in 16, 8, 4, 3, or 2, capped at stage 4, and its sum: +2 for Focus Energy, +1 for a held item with the critical-rate hold effect, +2 for Chansey or Farfetch'd holding an item whose hold effect names that species, plus the move's boosts, which in Platinum come from a battle-script variable rather than a list of move effects. It adds +1 for the ability Super Luck, which Emerald's sum doesn't read. Besides Battle Armor and Shell Armor, which an attacker with Mold Breaker ignores, Lucky Chant on the target's side blocks a critical, and so does a move-effect flag on the target (bit 15) that a comment in the header says is checked but never set. Platinum draws its 16-bit roll before those tests, where Emerald draws it only after its other tests pass. Code
- A critical multiplies Platinum's damage by 2 after the base formula (its +2 included), at the same step as Emerald, and by 3 when the attacker has Sniper; Emerald's multiplier has no such case. As in Emerald, the critical then ignores the attacker's lowered attacking stat, the defender's raised defending stat, and Reflect or Light Screen. Code
| - HeartGold and SoulSilver's critical-hit routine keeps Platinum's critical-hit rule: the stage sum (+2 Focus Energy, +1 for a held item whose effect raises the critical rate, +1 Super Luck, +2 for Chansey or Farfetch'd with its own item, plus the move's boosts) capped at 4, a chance of 1 in 16, 8, 4, 3, or 2, blocked by Battle Armor or Shell Armor unless ignored, by Lucky Chant on the target's side, or by bit 15 of the target's move-effect flags, and Sniper turning ×2 into ×3. Code
|
| Damage formula | - Type picks the stats: Fire, Water, Grass, Electric, Psychic, Ice, and Dragon (the first special type upward) use Special on both sides; the rest use Attack against Defense. Code
- In Red and Blue, a damaging move runs the critical-hit test, the base formula, the type adjustment (STAB, then type rows), the random factor, and then the hit test (accuracy). Code
- The base-damage routine computes , caps it at 997, and adds 2, so the type step receives 2–999. For a move with the explode effect it halves Defense first (to at least 1). Code
- The damage-randomizing routine multiplies damage by a random byte, 217–255, and integer-divides by 255, leaving 0 or 1 damage untouched. Code
| | | | | | | | |
| Fleeing | | | | | | | | | |
| Held item | | | | uses | uses | uses | | uses | uses |
| Hit chance | - Red and Blue store a move's accuracy as a byte, for percent, so 100% is 255 and 85% is 216. Code
- The hit test lands a move when a random byte is below its accuracy byte, so even a 100% move misses 1 time in 256. Code
- The hit-chance routine multiplies the accuracy byte by the attacker's accuracy-stage ratio and then by the defender's evasion-stage ratio, read in reverse; it truncates after each step, keeps at least 1, and caps the result at 255. Code
- Swift returns from the hit test before any check, so it never misses, even against a Pokémon in the air from Fly or underground from Dig; other moves always miss such a target, and X Accuracy skips only the roll. Code
- Of the 165 moves in the move table, Struggle included, 104 are listed at 100% accuracy and 61 below it; the lowest are the three one-hit KO moves at 30%. Code
- Bulbasaur and Squirtle start with Tackle, 35 power at 95% accuracy, and Charmander with Scratch, 40 power at 100%: the starter arrives at level 5 with the moves its base data lists, plus learned moves up to its level, and none of the three learns one before level 7. Code
- Four 120-power moves trade accuracy for power against a 95-power, 100%-accurate move of the same type: Thunder (70%) against Thunderbolt, Blizzard (90%) against Ice Beam, Fire Blast (85%) against Flamethrower, and Hydro Pump (80%) against Surf. Sing, Hypnosis, Sleep Powder, Lovely Kiss, and Spore put the target to sleep at 55%, 60%, 75%, 75%, and 100%, and Guillotine, Horn Drill, and Fissure knock out in one hit at 30%. Code
- Sand-Attack and Smokescreen (100%), Kinesis (80%), and Flash (70%) lower the target's accuracy by one stage; Double Team and Minimize (100%) raise the user's evasion by one stage. Code
- Outside link battles, an enemy's stat-lowering effect first fails when a random byte is below 64, 1 time in 4; the player's moves skip that roll. A move whose main effect lowers a stat, such as Sand-Attack or Smokescreen, then faces the normal accuracy test, while a damaging move's side effect instead takes hold only on a byte below 85, 85 times in 256. Code
- Pidgey learns Sand-Attack at level 5, and a wild or trainer Pokémon knows the moves its learnset gives up to its level; so the level-5 Pidgey on Route 1 (the last of its 10 grass slots, 3 encounters in 256) and on Route 2 (the fifth slot, 25 in 256), and the rival's level-9 Pidgey on Route 22, can use it. Code
| | | | | | | | |
| Multi-hit attack | - Doubleslap, Comet Punch, Fury Attack, Pin Missile, Spike Cannon, Barrage, and Fury Swipes hit 2 or 3 times with probability 3/8 each, and 4 or 5 times with 1/8 each; Double Kick, Bonemerang, and Twineedle always hit twice. Code
- A multi-hit move runs the critical test, the damage formula, and the accuracy roll once; every later hit repeats the first hit's damage, and a first hit that misses ends the move. Code
- Twineedle hits twice because its branch stores the value of a poison side-effect constant, which is 2, as the hit count, along with making it the move's effect. Code
| | | | - A move with the 2-to-5-hit effect in Ruby and Sapphire strikes 2 or 3 times with probability 3/8 each and 4 or 5 times with 1/8 each (computed). The count comes from a random number's low two bits (0 to 3): 0 or 1 gives 2 or 3 hits, and 2 or 3 draws again for 2 to 5 hits; a nonzero count written in a battle script is used instead, and this effect's script writes 0. The accuracy check runs once, before the count is set; each hit then rolls its own critical hit and its own damage, with a random factor of 85 to 100 percent (computed). The hits stop early when the user or the target has no HP left, when the user is asleep (unless the move came from Sleep Talk), when a hit misses, fails, or doesn't affect the target, or when the target endures. In the Ruby Rev 2 ROM, the compiled routine that sets the count has the same instructions as Emerald's, calling each game's own random-number routine and reading each game's own addresses. Code
| | | | |
| Music driver | | | | | | | | | |
| Nature | | | | | | | | | |
| Password and battery save | - Pokémon Red and Blue keep one copy of the game in battery-backed cartridge RAM (the player's name, the main data, the map's sprites, the party, the current PC box, and one byte for tile animations), followed by a check byte that is the complement of the 8-bit sum of all those bytes. Code
- When Pokémon Red and Blue load, they recompute the save's one check byte over all the saved game data before copying each of three parts (the first check is tried twice before giving up), and on a mismatch print "The file data is destroyed!", wait 100 frames, and set the save status to 1, which the main menu treats as no save file. The failure path doesn't write to the save: the check turns cartridge RAM off before it returns, so before the message prints, and the path's one store is the status byte, in work RAM. Code
| | | | | | | | |
| Physical/special split | uses | | | uses | | uses | | uses | |
| Random encounter | - In caves, Pokémon Tower, the Power Plant, and Pokémon Mansion every step off water can start a wild battle; on routes, in Viridian Forest, and in the Safari Zone only a step in grass or on water can. A turn rolls as a step does: pressing a direction other than the last one walked, from standing, first turns the player in place, and the same check runs on the tile the player stands on, before any step. The tile decides: the tileset's grass tile rolls against the map's grass rate and a water tile ($14) against its water rate. Any other tile rolls against the grass rate on an indoor map, by map number, unless the map uses the forest tileset, as Viridian Forest and the four Safari Zone areas do; outdoors it doesn't roll. Only the overworld, forest, and plateau tilesets have a grass tile. Code
- On a shore half-block whose water lies only at its bottom right, such as Cinnabar Island's east coast (by the comment), a step rolls at the water rate but meets a Pokémon from the grass list. The rate comes from the half-block's bottom-right tile and the list from its bottom-left tile: the water list only when that tile is water ($14) as well, the grass list otherwise. Code
- Surfing on open water meets only Tentacool, of levels 5 to 40, on Routes 19, 20, and 21: theirs are the only water lists. Every other map loads a water rate of 0, which no random byte is below, the water in Seafoam Islands and Cerulean Cave included; the water tile is $14 in every tileset that has water (by the comment). A left-shore half-block rolls at the water rate but draws from the grass list. Code
- The slot byte picks slot 0 for 0–50, 1 for 51–101, 2 for 102–140, 3 for 141–165, 4 for 166–190, 5 for 191–215, 6 for 216–228, 7 for 229–241, 8 for 242–252, and 9 for 253–255. The slot table holds each slot's running total of chances less 1, and the byte takes the first slot whose entry it doesn't pass; the step then reads that slot's level and species from the list. Code
- Some steps can't start a wild battle wherever they are: the two after a battle, a step while a character's scripted movement runs, a ledge jump, a step out of a door, a step that ends on a door or warp tile, and a step past the map's edge. A turn in place runs the same check and the same limits hold for it, but a turn doesn't count the post-battle cooldown down, since only a finished step does: during the cooldown a turn neither rolls nor shortens it. Those steps and turns also leave a Repel's count alone. Code
- A Repel lasts 100 steps, a Super Repel 200, and a Max Repel 250, counted on every step, and every turn in place, that the encounter check runs on, in towns and on paths as well as in grass. Using one outside battle sets the count, replacing what was left. On the step or turn the count reaches 0 the game prints "REPEL's effect wore off." and meets nothing. Code
- While a Repel lasts, a wild Pokémon below the level of the first Pokémon in the party is turned away, and one at that level or above still appears, so battles come less often. The rate roll and the slot pick run first and are unchanged: a Repel alters neither how often they turn up a Pokémon nor which one, and a slot below the leader's level then ends the step with no battle. The first Pokémon's level counts even if it has fainted. Code
- In Viridian Forest a Pikachu takes about 620 steps of grass on average, in either version, and a Repel only makes it rarer (computed). A grass step starts a battle 8 times in 256, once in 32 steps; 14 in 256 battles are a Pikachu (slot 8 at level 3, 11 in 256, and slot 9 at level 5, 3 in 256), so one comes every 18.3 battles, 585 steps, plus 2 steps of cooldown after each of the 17.3 battles before it. With a Repel and a first Pokémon of level 4 or 5, the level-3 Pikachu is turned away, and the walk grows to about 2,800 steps; above level 5 no Pikachu gets through. A turn in place in the grass rolls as a step does and counts here as one; the 2 steps of cooldown are steps walked, since a turn doesn't count them down. Code
- On Mt. Moon 1F a Clefairy takes about 2,350 steps on average, and a Repel saves few of them (computed). Every step there rolls at rate 10, and Clefairy has only slot 9, 3 in 256 at level 8, so one comes every 85.3 battles. With a Repel and a level-8 first Pokémon, the slots below level 8 are turned away: one Clefairy in 60 battles instead, and about 2,300 steps, since a Repel spares battles and their 2 steps of cooldown, not the steps between them. A turn in place rolls as a step does and counts here as one; the 2 steps of cooldown are steps walked, since a turn doesn't count them down. Code
- A battle comes once every 256 ÷ rate rolls on average, a roll being a step, or a turn in place, where the tile rolls: about 8.5 in the Safari Zone (rate 30), 10.2 on Route 1 (25), 32 in Viridian Forest (8), and 51.2 on water (5), plus the 2 steps of cooldown after each battle (computed). Code
- The Old Rod always gets a bite, and it is always a level-5 Magikarp. Code
- Wherever a rod works, a Good Rod cast gets a bite one time in three, a Goldeen or a Poliwag equally (counting each random byte as equally likely and each draw as independent). An odd byte ends the cast with no bite; an even byte bites when its next two bits make 0 or 1, picking that entry, and draws again otherwise, so 64 of the 192 values that end a cast bite. Code
- The Super Rod's lists give 33 maps two to four entries each, 109 rows in all, the same in both versions; on any other map it finds nothing. Ten lists are shared among those maps, and every entry is level 15 except Cerulean Cave's and Route 23's four at level 23, Celadon City's and Route 10's Poliwhirl and Fuchsia City's Seaking at 23, and a level-5 Tentacool on Routes 12, 13, 17, and 18. Its only Dratini are in the Safari Zone. Code
- A Super Rod cast bites half the time on a map whose list has four entries, 3 times in 7 with three, and once in 3 with two, every entry equally likely (counting each random byte as equally likely and each draw as independent). An odd byte ends the cast with no bite; an even byte's next two bits pick an entry, and a number past the map's list draws again. Code
- A rod works only outside battle, facing water or a shore (at Vermilion Dock, water only), and not while surfing. A bite starts its battle at once, without the step's checks, so neither the cooldown after a battle nor a Repel stops a hooked Pokémon. Code
- A step, or a turn in place, that can meet a wild Pokémon finds one when a random byte is below the map's encounter rate, out of 256: Route 1's grass rate is 25, so a step in its grass finds one 25 times in 256. Code
- A second random byte, which the generator updates along with the first, then picks one of the map's 10 slots, which have 51, 51, 39, 25, 25, 25, 13, 13, 11, and 3 chances in 256. Code
- After any battle, including one that ends in a blackout, the first two steps once the map reloads can't start a wild battle and the third can (computed). Every battle's end sets a cooldown flag; the map then reloads (after a blackout, at the place the warp sends the player), and a map load with the flag set sets a counter of 3. Each step not taken under scripted movement counts it down while the flag is set, clearing the flag when it reaches 0, and a wild battle can't start while it is above 0. A step's countdown runs before that step's encounter check. Code
| | - On each step, Gold and Silver's wild-encounter check reads the map's encounter rate for the current time of day (morning, day, or night), or its water rate, doubles it for the Pokémon March or Ruins of Alph radio, halves it for the Pokémon Lullaby or a Cleanse Tag, and starts a battle when a random byte is below it; Crystal keeps this unchanged. Code
- 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. Code
| - On 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
| | - On each step onto grass or water, the wild-encounter check multiplies the area's rate by 16, applies bike, flute, Cleanse Tag, and lead-ability modifiers, and starts a battle when a random number mod 2,880 is below it; Route 101's rate is 20. Code
- A step onto a tile whose behavior differs from the last one skips the encounter check 40% of the time. Code
- Computed from the land rates and the build step that turns them into slot bounds: Emerald's 12 land slots come up 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, and 1 percent of the time. Code
- After a battle starts, and whenever a map loads, the next 4 encounter checks are skipped. Code
| - FireRed and LeafGreen roll encounters on their own generator, , seeded at a new game; a check passes when its value mod 1,600 is below 16 times the area's rate, cut to 80% on a bike, plus 16/200 of a buff: a failed check adds the area's rate to it, or resets it while a Repel is active, and an encounter resets it. Code
- Before a step reaches the encounter check, FireRed and LeafGreen require a minimum number of steps since the last battle, 8 − ⌊rate/10⌋ (0 at a rate of 80 or more, 8 below 10), and before then let a step through to the check only on a 5-in-100 roll. The White Flute halves the steps and adds half to the chance, and the Black Flute doubles the steps and halves the chance; a lead holding a Cleanse Tag adds a third to the steps and takes a third off the chance; a lead, not an egg, with Stench doubles the steps and halves the chance, and one with Illuminate halves the steps and doubles the chance. Both numbers are worked in 256ths and rounded down at the end (computed: 5 becomes 7 with the White Flute, 2 with the Black). Code
| | - When a step ends on grass or water, HeartGold and SoulSilver roll twice, each a random number below 100. The first roll must fall below a gate that starts at 40; loses 20 unless the player is cycling or surfing or an unnamed avatar check, still in assembly, passes; gains 40 in very tall grass, or else 30 when cycling; and gains 30, 40, or 60 once a count of turns to face the opposite way reaches 2, 3, or 4. The Pokémon March on the radio adds 25 and the Pokémon Lullaby takes 25 away, and the gate is then capped at 100. The gate is a byte: from 20, the gate for walking outside very tall grass with fewer than 2 turns, the Lullaby's 25 wraps it to 251, and the cap makes it 100 (computed), so there every first roll passes; from any other gate the Lullaby lowers it by 25. The second roll must fall below the map's own rate for that terrain, capped at 100. A check comes only once a step counter, which a wild battle or a warp clears, is past 3. Platinum's gate is 40, plus 30 in very tall grass or when cycling, adjusted on special dates, with no walking penalty, turn count, or radio. Before its gate, Platinum adds a grace roll: while its count of attempts is below for the rate it is passed (computed), each attempt adds 1 to the count and goes on only if a random number below 100 is below 5; a comment says this covers the first attempts after each map transition or wild battle. HeartGold and SoulSilver's check has no such roll; they skip the check outright while the step counter is 3 or less. Code
- Before the two rolls, HeartGold and SoulSilver adjust the map's rate in this order: the lead Pokémon's ability (unless it is an Egg) doubles it for Arena Trap, No Guard, or Illuminate, halves it for White Smoke, Quick Feet, or Stench, or for Snow Cloak in snow, capped at 100; the Black Flute halves it and the White Flute raises it by half; and a Cleanse Tag or Pure Incense held by the lead Pokémon cuts it to 2/3. Gold and Silver instead double the rate for the Pokémon March or the Ruins of Alph radio and halve it for the Pokémon Lullaby or a Cleanse Tag. Code
- HeartGold and SoulSilver have 12 grass slots and 5 surfing slots, picked by one random number below 100 against bounds in the land and surfing slot rolls, so they come up 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, and 1 percent and 60, 30, 5, 4, and 1 percent (computed from the bounds). Platinum's ground and water slot rolls have the same bounds. Gold and Silver have 7 grass slots and 3 water slots, with cumulative bounds in a grass table (30, 60, 80, 90, 95, 99, 100) and a water table (60, 90, 100), so 30, 30, 20, 10, 5, 4, and 1 percent and 60, 30, and 10 percent (computed from the differences). Code
- A HeartGold or SoulSilver map's encounter record holds one walking rate and three full species lists for its 12 grass slots, morning, day, and night, sharing one list of levels. Gold and Silver keep a separate grass rate for each time of day and three sets of 7 slots. Platinum keeps one 12-slot list and swaps only slots 2 and 3 for their day or night species outside the morning. Code
|
| Random number generator | | | | | | | | | |
| Raster effects | | | | - The 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
| | | | | |
| Sampled sound | | | | | | | | | |
| Same-type attack bonus | | | | | | | | | |
| Time of day | | | | uses | | | | | - HeartGold and SoulSilver (the US releases, which share this code) split the clock's hour into five periods with a 24-entry table: morning from 4:00 to 9:59, day from 10:00 to 16:59, evening from 17:00 to 19:59, night from 20:00 to 23:59, and late night from 0:00 to 3:59. Platinum's table gives every hour the same period (its names are morning, day, twilight, night, and late night). Gold and Silver have three periods: morning from 4:00, day from 10:00, and night from 18:00. Code
- HeartGold and SoulSilver fold the five periods into three for wild Pokémon (morning; day or evening; night or late night), and grass encounters pick their species list the same way. The night test is true at night or late night, so from 20:00 to 3:59 (computed from the hour table), and the evolution methods tied to the clock read it: friendship of at least 220 by day or by night, and a held item by day or by night. Code
|
| Turn order | | | - Gold and Silver order moves by priority, 3 for Protect and Endure, 2 for the priority-hit moves, 0 for Vital Throw and the force-switch, Counter, and Mirror Coat effects, and 1 for the rest; at equal priority a held Quick Claw goes first when a random byte is below its value, 60, about 23% of the time, and otherwise the higher Speed goes first, with a tie split evenly; Crystal keeps the routine. Code
| - Crystal 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 effectiveness | - Red and Blue's type chart has 82 non-neutral (attacker, defender, multiplier) rows over 15 types, ended by -1; unlisted pairs are neutral. Code
- Multipliers are integers scaled by 10 (20 for “super effective”, 05 for “not very effective”, and 00 for no effect); the table never uses 10 (effective) or 15 (more effective). Code
- In table order, each type chart row matching the move's type and either defender type sets damage to ; 0 marks a miss. Code
- Under two ½ rows (×¼), 2 or 3 damage truncates to 0 and the move misses; 4 damage gives 1. Code
- Truncating after each row can cost a hit that nets ×1 damage when its ½ row comes first: Ice against Water/Flying takes 3 to ⌊3 × 5 / 10⌋ = 1, then ⌊1 × 20 / 10⌋ = 2, not 3. Code
- The Red/Blue type chart gives Ghost-type moves no effect on Psychic types. Code
- In Red and Blue, a Saffron Gym trainer's after-battle line, “Psychic #MON fear only ghosts and bugs!”, contradicts the game's own type chart, under which Ghost-type moves have no effect on Psychic types. Code
- Bulbapedia reports that “an abundance of evidence suggests” the Gen 1 Ghost → Psychic ×0 “may have been an error”. Wiki
- Each matching row overwrites one damage-multiplier byte, so the text follows the last row: above 10 is “super effective”, below 10 “not very effective”, and a miss reads “doesn't affect” only at 0. Code
- An Ice move against a Water/Flying Pokémon nets ×1 damage, a ½ row and then a 2× row, yet prints “It's super effective!”, since the message reads only the last matching row's value, 20, and compares it with 10. Code
- Earthquake against a Rock/Flying Pokémon does 0 damage and prints that the attack missed, not “It doesn't affect”: the Ground-against-Flying row (×0) zeroes the damage and makes the move miss, but the message reads the last matching row's value, Ground against Rock's ×2, and only a 0 there picks “doesn't affect”. Code
- Moves on the set-damage list (Sonic Boom, Seismic Toss, Dragon Rage, Night Shade, Psywave, and Super Fang) jump to the hit test, skipping the base-damage routine and the type-adjustment routine, the only damage routine that reads the type chart. Code
- The trainer AI's type-effectiveness lookup stops at the first row matching either defender type, ignoring dual-type products. Code
- The type constants still define a Bird type (
$06), with a name string, but no type chart row names it. Code
| | | - Crystal'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 ; a nonzero product becomes , 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 ( 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
| | - Emerald's type chart is a flat byte array of 108 non-neutral (attacker, defender, multiplier) rows over 17 types, then a Foresight marker, two Ghost immunities, and an end marker. Code
- Emerald keeps the Game Boy encoding: 20 super effective, 10 normal, 5 not effective, and 0 no effect. Code
- Computed by comparing the two tables row by row: Emerald's type table holds the same 110 rows as Crystal's, in the same order, so no type is new and no matchup changed. Code
- Type 9, named "???", sits between the physical and special types and has no rows. Code
- For each row of the move's type, the type-damage step runs once per distinct target type it matches: , raised from 0 to 1 unless the multiplier is 0. Code
- The text comes from flags the type-damage step sets per row: a 2× row cancels an earlier not-very-effective flag, a ½ row an earlier super-effective one, and ×0 sets "doesn't affect", clearing both. Code
- Against a Foresight target, the loop breaks at the Foresight marker row, skipping the Normal→Ghost and Fighting→Ghost immunities after it. Code
- Struggle skips the type-calculation battle command entirely, so neither STAB nor the type chart touches it. Code
- The type-calculation battle command flags a Ground move against a Levitate target as missed and “doesn't affect”, and walks no type row. Code
- After the type rows, a target with Wonder Guard makes a damaging move miss unless the move carries the super-effective flag without the not-very-effective one. The check is skipped on the charging turn of a two-turn move (Skull Bash, Razor Wind, Sky Attack, Solar Beam outside sunshine, the semi-invulnerable moves, and Bide), so it applies on the turn the move strikes. Code
- Row order still matters: against a Water/Flying target, an Ice move's 3 damage becomes 1 at the Water row (½, rounded down), then 2 at the Flying row (×2); computed, the opposite order would give 3. Code
| | | |
| Weather | | | | | | | | | |