Cite as
pret/pokefirered
Original
https://github.com/pret/pokefirered
Pinned
pret/pokefirered @ ce6406d8c2eaf46d543c8a2606de0c3cb1951982
Accessed
2026-10-21
Licence
none stated (no LICENSE file)
Credit
The pret community. See https://github.com/pret/pokefirered/graphs/contributors.
Notes
A matching decompilation of the English FireRed and LeafGreen ROMs, sha1 41cb23d8dccc8ebd7c649cd8fbb58eeace6e2fdc (FireRed) and 574fa542ffebb14be69902d1d36f1ec0a4afd71e (LeafGreen) (README), plus revision 1. Function and variable names are the decompilers', not Game Freak's.

Cited on

Claims (11)

FireRed and LeafGreen run Emerald's formula, status test (bad poison included), and shake checks unchanged; before them, a ball thrown in a battle flagged BATTLE_TYPE_GHOST is dodged.src/battle_script_commands.c L9473–9477src/battle_script_commands.c L9549–9556src/battle_script_commands.c L9587–9590Code
FireRed and LeafGreen's Cmd_critcalc keeps Ruby's stages and its 1 in 16, 8, 4, 3, or 2, but rules out critical hits in the Old Man's catching tutorial, in Pokédude battles, and in the first battle until a tutorial flag is set.src/battle_script_commands.c L1196–1201src/battle_script_commands.c L588Code
FireRed and LeafGreen's Cmd_accuracycheck is Emerald's with one addition: in Pokédude battles every move, on either side, skips the accuracy roll, and in the first battle the player's damaging moves skip it until one tutorial flag is set and the player's status moves until a second.src/battle_script_commands.c L1003–1019Code
FireRed and LeafGreen's gTypeEffectiveness is Emerald's, entry for entry: 108 matchup rows, the Foresight marker, two Ghost immunities, and the end marker.src/battle_main.c L312–426Code
FireRed and LeafGreen keep Emerald's STAB, damage×15/10 before the type rows; their Cmd_typecalc differs from Emerald's only in how it names the defender's types.src/battle_script_commands.c L1287–1292Code
FireRed and LeafGreen's Cmd_damagecalc and Cmd_adjustnormaldamage diff identical with Emerald's: Cmd_damagecalc multiplies the base damage by the critical multiplier, 2 on a critical hit, and the random factor is damage × (100 − rand % 16) / 100, 85–100%.src/battle_script_commands.c L1209–1215src/battle_script_commands.c L1202–1205src/battle_script_commands.c L1558–1570src/battle_script_commands.c L1577–1581Code
FireRed and LeafGreen's Cmd_setmultihitcounter is Emerald's, line for line: 2 or 3 hits at 3/8 each and 4 or 5 at 1/8. The battle script runs accuracycheck once, then loops critcalc, damagecalc, and adjustnormaldamage for every hit.src/battle_script_commands.c L6857–6873data/battle_scripts_1.s L605–640Code
FireRed and LeafGreen roll encounters on their own generator, x←1103515245x+12345, 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 to which every failed check adds the area's rate, reset by a battle or a Repel.src/wild_encounter.c L20src/wild_encounter.c L302–314src/wild_encounter.c L372–374src/wild_encounter.c L667–671include/random.h L18–20src/wild_encounter.c L778–784src/new_game.c L103Code
Before that roll, 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 check through only on a 5-in-100 roll; the flutes, a Cleanse Tag, and the lead's Stench or Illuminate scale both numbers.src/wild_encounter.c L682–686src/wild_encounter.c L716–755Code
FireRed and LeafGreen keep Ruby's escape formula, ⌊128P/E⌋+30t against a random byte, with Smoke Ball and Run Away always escaping, and add that the player always escapes a ghost battle fought without the Silph Scope.src/battle_main.c L4252–4263include/constants/battle.h L69Code
FireRed and LeafGreen's GetWhoStrikesFirst is Emerald's rule: the higher-priority move first, then the higher adjusted Speed, with a tie a coin flip, and a Quick Claw that sets Speed to the maximum on its roll. It differs only in withholding the third badge's ×1.1 Speed in link battles alone, where Emerald also withholds it in recorded-link and Frontier battles.src/battle_main.c L3442–3452src/battle_main.c L3505–3517Code