v0.1 ⌊ALPHA⌉
Cite as
pret/pokeemerald
Original
https://github.com/pret/pokeemerald
Pinned
pret/pokeemerald @ 731ad5bfd6e6f265508d0efcca0ba42f9dcf5881
Accessed
2026-10-20
Licence
none stated (no LICENSE file; GitHub reports no license)
Credit
The pret community, about 162 GitHub contributors (2026-10-20), led in commit count by GriffinRichards, DizzyEggg, PikalaxALT, Sierraffinity and Kermalis. See https://github.com/pret/pokeemerald/graphs/contributors.
Notes
A matching C decompilation: it compiles to the ROM with sha1 f3ae088181bf583e55daf962a92bb46f4f1d07b7 (README). Function and variable names are the decompilers', not Game Freak's.

Cited on

Claims (15)

Emerald's type chart, gTypeEffectiveness, is a flat u8 array of 108 non-neutral (attacker, defender, multiplier) rows over 17 types, then a TYPE_FORESIGHT marker, two Ghost immunities, and TYPE_ENDTABLE.src/battle_main.c L329–449include/constants/pokemon.h L5–23T3
Emerald keeps the Game Boy encoding, now named TYPE_MUL_*: 20 super effective, 10 normal, 5 not effective, and 0 no effect.include/battle_main.h L31–34T3
Emerald's table holds the same 110 rows as Crystal's, in the same order: no new type and no changed matchup.src/battle_main.c L335–449T4
TYPE_MYSTERY (9), named "???", sits between the physical and special types and has no rows.include/constants/pokemon.h L15src/battle_main.c L462T3
Before the type chart, Cmd_typecalc applies STAB as damage×15/10 when either attacker type equals the move's type.src/battle_script_commands.c L1368–1373include/battle.h L471T3
For each row of the move's type, ModulateDmgByType runs once per distinct target type it matches: damage×multiplier/10, raised from 0 to 1 unless the multiplier is 0.src/battle_script_commands.c L1321–1325src/battle_script_commands.c L1386–1406T3
The text comes from flags ModulateDmgByType 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.src/battle_script_commands.c L1327–1352T3
Against a Foresight target, the loop breaks at the TYPE_FORESIGHT row, skipping the Normal→Ghost and Fighting→Ghost immunities after it.src/battle_script_commands.c L1388–1394src/battle_main.c L445–447T3
Struggle skips Cmd_typecalc entirely, so neither STAB nor the type chart touches it.src/battle_script_commands.c L1360–1364T3
Cmd_typecalc flags a Ground move against a Levitate target as missed and “doesn't affect”, and walks no type row.src/battle_script_commands.c L1375–1384T3
After the rows, a Wonder Guard target makes a damaging move miss on the turn it attacks, unless the move carries the super-effective flag without the not-very-effective one.src/battle_script_commands.c L1409–1419T3
Row order still matters: an Ice move against Water/Flying takes 3 damage to 1, then 2 (½ row at L369, 2× at L373).src/battle_main.c L369–373T4
Type still decides physical or special in Emerald, by its position relative to TYPE_MYSTERY.include/battle.h L466–467T3
A plain damaging move runs critcalc, damagecalc (base damage), typecalc (STAB, then type rows), and then adjustnormaldamage (random factor).data/battle_scripts_1.s L249–252T3
The random factor changes form: damage × (100 − rand % 16) / 100, i.e. 85–100 %, raised to 1 if that gives 0.src/battle_script_commands.c L1639–1651T3