Claim set · data/claims/pokeemerald.yaml

Pokémon Emerald (pret/pokeemerald)

Game: Pokémon Emerald. Concept: Type effectiveness.

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. pokeemerald/type-chart

Value
{
 "kind": "type-chart",
 "types": [
  "Normal",
  "Fighting",
  "Flying",
  "Poison",
  "Ground",
  "Rock",
  "Bug",
  "Ghost",
  "Steel",
  "Fire",
  "Water",
  "Grass",
  "Electric",
  "Psychic",
  "Ice",
  "Dragon",
  "Dark"
 ],
 "matchups": [
  [
   "Normal",
   "Rock",
   5,
   337
  ],
  [
   "Normal",
   "Steel",
   5,
   338
  ],
  [
   "Fire",
   "Fire",
   5,
   339
  ],
  [
   "Fire",
   "Water",
   5,
   340
  ],
  [
   "Fire",
   "Grass",
   20,
   341
  ],
  [
   "Fire",
   "Ice",
   20,
   342
  ],
  [
   "Fire",
   "Bug",
   20,
   343
  ],
  [
   "Fire",
   "Rock",
   5,
   344
  ],
  [
   "Fire",
   "Dragon",
   5,
   345
  ],
  [
   "Fire",
   "Steel",
   20,
   346
  ],
  [
   "Water",
   "Fire",
   20,
   347
  ],
  [
   "Water",
   "Water",
   5,
   348
  ],
  [
   "Water",
   "Grass",
   5,
   349
  ],
  [
   "Water",
   "Ground",
   20,
   350
  ],
  [
   "Water",
   "Rock",
   20,
   351
  ],
  [
   "Water",
   "Dragon",
   5,
   352
  ],
  [
   "Electric",
   "Water",
   20,
   353
  ],
  [
   "Electric",
   "Electric",
   5,
   354
  ],
  [
   "Electric",
   "Grass",
   5,
   355
  ],
  [
   "Electric",
   "Ground",
   0,
   356
  ],
  [
   "Electric",
   "Flying",
   20,
   357
  ],
  [
   "Electric",
   "Dragon",
   5,
   358
  ],
  [
   "Grass",
   "Fire",
   5,
   359
  ],
  [
   "Grass",
   "Water",
   20,
   360
  ],
  [
   "Grass",
   "Grass",
   5,
   361
  ],
  [
   "Grass",
   "Poison",
   5,
   362
  ],
  [
   "Grass",
   "Ground",
   20,
   363
  ],
  [
   "Grass",
   "Flying",
   5,
   364
  ],
  [
   "Grass",
   "Bug",
   5,
   365
  ],
  [
   "Grass",
   "Rock",
   20,
   366
  ],
  [
   "Grass",
   "Dragon",
   5,
   367
  ],
  [
   "Grass",
   "Steel",
   5,
   368
  ],
  [
   "Ice",
   "Water",
   5,
   369
  ],
  [
   "Ice",
   "Grass",
   20,
   370
  ],
  [
   "Ice",
   "Ice",
   5,
   371
  ],
  [
   "Ice",
   "Ground",
   20,
   372
  ],
  [
   "Ice",
   "Flying",
   20,
   373
  ],
  [
   "Ice",
   "Dragon",
   20,
   374
  ],
  [
   "Ice",
   "Steel",
   5,
   375
  ],
  [
   "Ice",
   "Fire",
   5,
   376
  ],
  [
   "Fighting",
   "Normal",
   20,
   377
  ],
  [
   "Fighting",
   "Ice",
   20,
   378
  ],
  [
   "Fighting",
   "Poison",
   5,
   379
  ],
  [
   "Fighting",
   "Flying",
   5,
   380
  ],
  [
   "Fighting",
   "Psychic",
   5,
   381
  ],
  [
   "Fighting",
   "Bug",
   5,
   382
  ],
  [
   "Fighting",
   "Rock",
   20,
   383
  ],
  [
   "Fighting",
   "Dark",
   20,
   384
  ],
  [
   "Fighting",
   "Steel",
   20,
   385
  ],
  [
   "Poison",
   "Grass",
   20,
   386
  ],
  [
   "Poison",
   "Poison",
   5,
   387
  ],
  [
   "Poison",
   "Ground",
   5,
   388
  ],
  [
   "Poison",
   "Rock",
   5,
   389
  ],
  [
   "Poison",
   "Ghost",
   5,
   390
  ],
  [
   "Poison",
   "Steel",
   0,
   391
  ],
  [
   "Ground",
   "Fire",
   20,
   392
  ],
  [
   "Ground",
   "Electric",
   20,
   393
  ],
  [
   "Ground",
   "Grass",
   5,
   394
  ],
  [
   "Ground",
   "Poison",
   20,
   395
  ],
  [
   "Ground",
   "Flying",
   0,
   396
  ],
  [
   "Ground",
   "Bug",
   5,
   397
  ],
  [
   "Ground",
   "Rock",
   20,
   398
  ],
  [
   "Ground",
   "Steel",
   20,
   399
  ],
  [
   "Flying",
   "Electric",
   5,
   400
  ],
  [
   "Flying",
   "Grass",
   20,
   401
  ],
  [
   "Flying",
   "Fighting",
   20,
   402
  ],
  [
   "Flying",
   "Bug",
   20,
   403
  ],
  [
   "Flying",
   "Rock",
   5,
   404
  ],
  [
   "Flying",
   "Steel",
   5,
   405
  ],
  [
   "Psychic",
   "Fighting",
   20,
   406
  ],
  [
   "Psychic",
   "Poison",
   20,
   407
  ],
  [
   "Psychic",
   "Psychic",
   5,
   408
  ],
  [
   "Psychic",
   "Dark",
   0,
   409
  ],
  [
   "Psychic",
   "Steel",
   5,
   410
  ],
  [
   "Bug",
   "Fire",
   5,
   411
  ],
  [
   "Bug",
   "Grass",
   20,
   412
  ],
  [
   "Bug",
   "Fighting",
   5,
   413
  ],
  [
   "Bug",
   "Poison",
   5,
   414
  ],
  [
   "Bug",
   "Flying",
   5,
   415
  ],
  [
   "Bug",
   "Psychic",
   20,
   416
  ],
  [
   "Bug",
   "Ghost",
   5,
   417
  ],
  [
   "Bug",
   "Dark",
   20,
   418
  ],
  [
   "Bug",
   "Steel",
   5,
   419
  ],
  [
   "Rock",
   "Fire",
   20,
   420
  ],
  [
   "Rock",
   "Ice",
   20,
   421
  ],
  [
   "Rock",
   "Fighting",
   5,
   422
  ],
  [
   "Rock",
   "Ground",
   5,
   423
  ],
  [
   "Rock",
   "Flying",
   20,
   424
  ],
  [
   "Rock",
   "Bug",
   20,
   425
  ],
  [
   "Rock",
   "Steel",
   5,
   426
  ],
  [
   "Ghost",
   "Normal",
   0,
   427
  ],
  [
   "Ghost",
   "Psychic",
   20,
   428
  ],
  [
   "Ghost",
   "Dark",
   5,
   429
  ],
  [
   "Ghost",
   "Steel",
   5,
   430
  ],
  [
   "Ghost",
   "Ghost",
   20,
   431
  ],
  [
   "Dragon",
   "Dragon",
   20,
   432
  ],
  [
   "Dragon",
   "Steel",
   5,
   433
  ],
  [
   "Dark",
   "Fighting",
   5,
   434
  ],
  [
   "Dark",
   "Psychic",
   20,
   435
  ],
  [
   "Dark",
   "Ghost",
   20,
   436
  ],
  [
   "Dark",
   "Dark",
   5,
   437
  ],
  [
   "Dark",
   "Steel",
   5,
   438
  ],
  [
   "Steel",
   "Fire",
   5,
   439
  ],
  [
   "Steel",
   "Water",
   5,
   440
  ],
  [
   "Steel",
   "Electric",
   5,
   441
  ],
  [
   "Steel",
   "Ice",
   20,
   442
  ],
  [
   "Steel",
   "Rock",
   20,
   443
  ],
  [
   "Steel",
   "Steel",
   5,
   444
  ]
 ],
 "foresightOnly": [
  [
   "Normal",
   "Ghost",
   0,
   446
  ],
  [
   "Fighting",
   "Ghost",
   0,
   447
  ]
 ],
 "foresightMarkerLine": 445
}
Codepokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L329-L449// format: attacking type, defending type, damage multiplier // the multiplier is a (decimal) fixed-point number: … TYPE_FORESIGHT, TYPE_FORESIGHT, TYPE_MUL_NO_EFFECT, TYPE_NORMAL, TYPE_GHOST, TYPE_MUL_NO_EFFECT, TYPE_FIGHTING, TYPE_GHOST, TYPE_MUL_NO_EFFECT, TYPE_ENDTABLE, TYPE_ENDTABLE, TYPE_MUL_NO_EFFECTpokeemerald: decompilation of Pokémon Emerald · include/constants/pokemon.h#L5-L23 — type order used for `types` (constants that appear in at least one row)Checked by claude-agent, 2026-10-20 — read every row of src/battle_main.c L329–L449 and the type constants at the pinned commit; probes/pokemon-types/type-charts.mjs re-parses the array and diffs it against this valueChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Pokémon Crystal, Type effectiveness

Emerald keeps the Game Boy encoding: 20 super effective, 10 normal, 5 not effective, and 0 no effect. pokeemerald/multiplier-encoding

Value: kind multiplier-encoding · neutral 10 · super 20 · not very 5 · none 0

Codepokeemerald: decompilation of Pokémon Emerald · include/battle_main.h#L31-L34#define TYPE_MUL_NO_EFFECT 0 #define TYPE_MUL_NOT_EFFECTIVE 5 #define TYPE_MUL_NORMAL 10 #define TYPE_MUL_SUPER_EFFECTIVE 20Checked by claude-agent, 2026-10-20 — read the defines and the table comment (battle_main.c L329–L334)Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Pokémon Crystal, Type effectiveness

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. pokeemerald/chart-diff

Value: kind chart-diff · from pokecrystal · new types · changed

Codepokecrystal: disassembly of Pokémon Crystal · data/types/type_matchups.asm#L1-L118db NORMAL, ROCK, NOT_VERY_EFFECTIVE db NORMAL, STEEL, NOT_VERY_EFFECTIVE … db -2 ; end (with Foresight)pokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L335-L449TYPE_NORMAL, TYPE_ROCK, TYPE_MUL_NOT_EFFECTIVE, TYPE_NORMAL, TYPE_STEEL, TYPE_MUL_NOT_EFFECTIVE, … TYPE_FORESIGHT, TYPE_FORESIGHT, TYPE_MUL_NO_EFFECT,Type/Type chart · Type charts: Generations II-VThis matchup table is used from Generation II to Generation V.Checked by claude, 2026-11-04 — read Crystal's matchup table (type_matchups.asm L1-L118) and Emerald's (battle_main.c L335-L449) at the pinned commits: both open Normal→Rock, Normal→Steel and put the Foresight marker before the two Ghost immunities; the row count and the row-by-row comparison are computed by the probe (probes/pokemon-types/type-charts.mjs), which checks this claim's valueChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-25.Revised after a check by a second AI model, 2026-11-04: The row-by-row match is now stated as computed by the probe.Probe: probes/pokemon-types/type-charts.mjs

Cited by: Pokémon Crystal, Pokémon Emerald, Type effectiveness

Type 9, named "???", sits between the physical and special types and has no rows. pokeemerald/mystery-type

Codepokeemerald: decompilation of Pokémon Emerald · include/constants/pokemon.h#L15#define TYPE_MYSTERY 9pokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L462[TYPE_MYSTERY] = _("???"),Checked by claude-agent, 2026-10-20 — read the constants and the type-name table; the probe lists type constants with no rows (Mystery only)Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.Probe: probes/pokemon-types/type-charts.mjs

Cited by: Type effectiveness

Before the type chart, the type-calculation battle command applies STAB as damage×15/10 when either attacker type equals the move's type. pokeemerald/stab

About: Pokémon Emerald Same-type attack bonus

Value: kind stab · form mul-div · mul 15 · div 10

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1368-L1373 // check stab if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType)) { gBattleMoveDamage = gBattleMoveDamage * 15; gBattleMoveDamage = gBattleMoveDamage / 10; }pokeemerald: decompilation of Pokémon Emerald · include/battle.h#L471 — IS_BATTLER_OF_TYPE tests types[0] or types[1]Checked by claude-agent, 2026-10-20 — read Cmd_typecalc L1355–L1424Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

For non-negative integers ⌊15d/10⌋ equals the Game Boy games' d+⌊d/2⌋, so STAB's arithmetic did not change, only its form.

Cited by: Damage modifier, Pokémon Crystal, Same-type attack bonus, Type effectiveness

For each row of the move's type, the type-damage step runs once per distinct target type it matches: damage×multiplier/10, raised from 0 to 1 unless the multiplier is 0. pokeemerald/type-step

Value: kind type-step · div 10 · zero min1

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1321-L1325 gBattleMoveDamage = gBattleMoveDamage * multiplier / 10; if (gBattleMoveDamage == 0 && multiplier != 0) gBattleMoveDamage = 1;pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1386-L1406 if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1])Checked by claude-agent, 2026-10-20 — read ModulateDmgByType and the loop in Cmd_typecalcChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Damage modifier, Pokémon Crystal, Type effectiveness

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. pokeemerald/effectiveness-message

Value: kind message · rule flags

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1327-L1352 case TYPE_MUL_SUPER_EFFECTIVE: if (gBattleMoves[gCurrentMove].power && !(gMoveResultFlags & MOVE_RESULT_NO_EFFECT)) { if (gMoveResultFlags & MOVE_RESULT_NOT_VERY_EFFECTIVE) gMoveResultFlags &= ~MOVE_RESULT_NOT_VERY_EFFECTIVE; else gMoveResultFlags |= MOVE_RESULT_SUPER_EFFECTIVE; }Checked by claude-agent, 2026-10-20 — read the switch in ModulateDmgByTypeChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Pokémon Crystal, Pokémon Emerald, Type effectiveness

Against a Foresight target, the loop breaks at the Foresight marker row, skipping the Normal→Ghost and Fighting→Ghost immunities after it. pokeemerald/foresight

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1388-L1394 if (TYPE_EFFECT_ATK_TYPE(i) == TYPE_FORESIGHT) { if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT) break;pokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L445-L447Checked by claude-agent, 2026-10-20 — read the loop and the table tailChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Type effectiveness

Struggle skips the type-calculation battle command entirely, so neither STAB nor the type chart touches it. pokeemerald/struggle-skips

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1360-L1364 if (gCurrentMove == MOVE_STRUGGLE) { gBattlescriptCurrInstr++; return; }Checked by claude-agent, 2026-10-20 — read the function entryChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Same-type attack bonus, Type effectiveness

The type-calculation battle command flags a Ground move against a Levitate target as missed and “doesn't affect”, and walks no type row. pokeemerald/levitate

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1375-L1384 if (gBattleMons[gBattlerTarget].ability == ABILITY_LEVITATE && moveType == TYPE_GROUND) { gLastUsedAbility = gBattleMons[gBattlerTarget].ability; gMoveResultFlags |= (MOVE_RESULT_MISSED | MOVE_RESULT_DOESNT_AFFECT_FOE);Checked by claude-agent, 2026-10-20 — read Cmd_typecalcChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Ability, Pokémon Emerald, Type effectiveness

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. pokeemerald/wonder-guard

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1409-L1414if (gBattleMons[gBattlerTarget].ability == ABILITY_WONDER_GUARD && AttacksThisTurn(gBattlerAttacker, gCurrentMove) == 2 && (!(gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || ((gMoveResultFlags & (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE)) == (MOVE_RESULT_SUPER_EFFECTIVE | MOVE_RESULT_NOT_VERY_EFFECTIVE))) && gBattleMoves[gCurrentMove].power) … gMoveResultFlags |= MOVE_RESULT_MISSED;pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L8221-L8238 — the routine's body, not only its comment, gives 1 only while a two-turn move chargesstatic u8 AttacksThisTurn(u8 battler, u16 move) // Note: returns 1 if it's a charging turn, otherwise 2 … if (gBattleMoves[move].effect == EFFECT_SOLAR_BEAM && (gBattleWeather & B_WEATHER_SUN)) return 2; … if (gBattleMoves[move].effect == EFFECT_SKULL_BASH || gBattleMoves[move].effect == EFFECT_RAZOR_WIND || gBattleMoves[move].effect == EFFECT_SKY_ATTACK || gBattleMoves[move].effect == EFFECT_SOLAR_BEAM || gBattleMoves[move].effect == EFFECT_SEMI_INVULNERABLE || gBattleMoves[move].effect == EFFECT_BIDE) …Checked by claude, 2026-11-04 — read Cmd_typecalc's Wonder Guard branch (L1409-L1419), which sets the missed flag, and the whole body of AttacksThisTurn (L8221-L8239)Checked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Quoted the miss flag and the attacks-this-turn routine; named the two-turn moves.

Cited by: Pokémon Emerald, Type effectiveness

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. pokeemerald/truncation-order

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L369-L373 TYPE_ICE, TYPE_WATER, TYPE_MUL_NOT_EFFECTIVE, … TYPE_ICE, TYPE_FLYING, TYPE_MUL_SUPER_EFFECTIVE,pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1386-L1405while (TYPE_EFFECT_ATK_TYPE(i) != TYPE_ENDTABLE) … else if (TYPE_EFFECT_ATK_TYPE(i) == moveType) { // check type1 if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[0]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); // check type2 if (TYPE_EFFECT_DEF_TYPE(i) == gBattleMons[gBattlerTarget].types[1] && gBattleMons[gBattlerTarget].types[0] != gBattleMons[gBattlerTarget].types[1]) ModulateDmgByType(TYPE_EFFECT_MULTIPLIER(i)); } …pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1321-L1325static void ModulateDmgByType(u8 multiplier) { gBattleMoveDamage = gBattleMoveDamage * multiplier / 10; if (gBattleMoveDamage == 0 && multiplier != 0) gBattleMoveDamage = 1;pokeemerald: decompilation of Pokémon Emerald · include/battle_main.h#L32-L34 — computed: 3 × 5 / 10 = 1 in integer math, then 1 × 20 / 10 = 2; the other way, 3 × 20 / 10 = 6, then 6 × 5 / 10 = 3#define TYPE_MUL_NOT_EFFECTIVE 5 #define TYPE_MUL_NORMAL 10 #define TYPE_MUL_SUPER_EFFECTIVE 20Checked by claude, 2026-11-04 — read the Ice rows (battle_main.c L369, L373), Cmd_typecalc's loop over the rows in table order, ModulateDmgByType, and the multiplier definesChecked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Quoted the multiply-and-divide and the multipliers; reworded to "3 damage becomes 1, then 2".Probe: probes/pokemon-types/type-charts.mjs

Cited by: Type effectiveness

Type still decides physical or special in Emerald, by whether it comes before or after type 9, "???". pokeemerald/physical-special-by-type

About: Pokémon Emerald Damage formula

Codepokeemerald: decompilation of Pokémon Emerald · include/battle.h#L466-L467#define IS_TYPE_PHYSICAL(moveType) (moveType < TYPE_MYSTERY) #define IS_TYPE_SPECIAL(moveType) (moveType > TYPE_MYSTERY)Type 9, named "???", sits between the physical and special types and has no rows. CodeChecked by claude-agent, 2026-10-20 — read the macros and their use in src/pokemon.c (L3232, L3287)Checked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-10-28.

Cited by: Damage formula, Physical/special split, Type effectiveness

A plain damaging move rolls for a critical hit, computes the base damage, applies the type step (STAB, then the type rows), and then applies the random factor. pokeemerald/damage-order

About: Pokémon Emerald Damage formula

Codepokeemerald: decompilation of Pokémon Emerald · data/battle_scripts_1.s#L249-L252 critcalc damagecalc typecalc adjustnormaldamageThe 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 critical rollThe 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 — the base-damage stepBefore the type chart, the type-calculation battle command applies STAB as damage×15/10 when either attacker type equals the move's type. Code — STAB at the start of the type stepFor each row of the move's type, the type-damage step runs once per distinct target type it matches: damage×multiplier/10, raised from 0 to 1 unless the multiplier is 0. Code — the type rowspokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1658-L1662 — the random factor itself is pokeemerald/random-factorstatic void Cmd_adjustnormaldamage(void) … ApplyRandomDmgMultiplier();The random factor changes form from Crystal's random byte over 255: Emerald multiplies nonzero damage by 100 − (a random number mod 16), 85 to 100, divides by 100, and raises a 0 result to 1. CodeChecked by claude, 2026-11-04 — read BattleScript_EffectHit's four damage commands (battle_scripts_1.s L249-L252), the STAB lines at the start of Cmd_typecalc (L1368-L1373), and Cmd_adjustnormaldamage's call to ApplyRandomDmgMultiplier (L1658-L1662)Checked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Dropped the script command names and cited the claims for each step.

Cited by: Damage formula, Damage modifier, Type effectiveness

The random factor changes form from Crystal's random byte over 255: Emerald multiplies nonzero damage by 100 − (a random number mod 16), 85 to 100, divides by 100, and raises a 0 result to 1. pokeemerald/random-factor

About: Pokémon Emerald Damage formula

Value: 85, 100

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1641-L1649u16 rand = Random(); u16 randPercent = 100 - (rand % 16); … if (gBattleMoveDamage != 0) { gBattleMoveDamage *= randPercent; gBattleMoveDamage /= 100; if (gBattleMoveDamage == 0) gBattleMoveDamage = 1;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 — Crystal's form, a random byte from 217 to 255 over 255Checked by claude, 2026-11-04 — read ApplyRandomDmgMultiplier (L1638-L1651), including the raise from 0 to 1, and compared Crystal's form through pokecrystal/random-factorChecked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Quoted the raise from 0 to 1 and cited Crystal's form for the comparison.

Cited by: Damage formula, Type effectiveness

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. pokeemerald/critical-chance

About: Pokémon Emerald Critical hit

Value: by stage 16, 8, 4, 3, 2 · form Random() % N == 0

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L605-L606// The chance is 1/N for each stage. static const u16 sCriticalHitChance[] = {16, 8, 4, 3, 2};pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1267-L1285critChance = 2 * ((gBattleMons[gBattlerAttacker].status2 & STATUS2_FOCUS_ENERGY) != 0) + (gBattleMoves[gCurrentMove].effect == EFFECT_HIGH_CRITICAL) … + (holdEffect == HOLD_EFFECT_SCOPE_LENS) … if ((gBattleMons[gBattlerTarget].ability != ABILITY_BATTLE_ARMOR && gBattleMons[gBattlerTarget].ability != ABILITY_SHELL_ARMOR) … && !(Random() % sCriticalHitChance[critChance])) gCritMultiplier = 2;pokeemerald: decompilation of Pokémon Emerald · src/random.c#L11-L16u16 Random(void) … return gRngValue >> 16;Checked by claude, 2026-10-21 — read Cmd_critcalc, the chance table, and Random(), which returns the high 16 bits of the 32-bit state; 65,536 = 3 × 21,845 + 1, so the stage-3 test passes 21,846 times in 65,536Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

The tutorial battle with Wally and the first battle never produce a critical.

Cited by: Critical hit

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. pokeemerald/critical-effect

About: Pokémon Emerald Critical hit

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1296gBattleMoveDamage = gBattleMoveDamage * gCritMultiplier * gBattleScripting.dmgMultiplier;pokeemerald: decompilation of Pokémon Emerald · src/pokemon.c#L3234-L3268if (gCritMultiplier == 2) { // Critical hit, if attacker has lost attack stat stages then ignore stat drop … // Critical hit, if defender has gained defense stat stages then ignore stat increase … if ((sideStatus & SIDE_STATUS_REFLECT) && gCritMultiplier == 1)Checked by claude-agent, 2026-10-20 — read Cmd_critcalc and Cmd_damagecalc, and both stat branches of CalculateBaseDamage (physical L3232-L3275; special L3287-L3325, with Light Screen at L3318)Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Unlike Crystal, the attacker keeps its raised stages and the defender its lowered ones.

Cited by: Critical hit, Damage formula, Damage modifier

The accuracy-check battle command combines the attacker's accuracy stage and the target's evasion stage into one stage, multiplies the move's accuracy in percent by that stage's ratio, and misses when a roll from 1 to 100 exceeds the result, so a 100% move at even stages never misses. pokeemerald/hit-test

About: Pokémon Emerald Hit chance

Net stageNumeratorDenominator
-633100
-536100
-443100
-350100
-260100
-175100
011
1133100
2166100
321
4233100
513350
631
Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L1128-L1176if (gBattleMons[gBattlerTarget].status2 & STATUS2_FORESIGHT) … buff = acc + DEFAULT_STAT_STAGE - gBattleMons[gBattlerTarget].statStages[STAT_EVASION]; … calc = sAccuracyStageRatios[buff].dividend * moveAcc; calc /= sAccuracyStageRatios[buff].divisor; … // final calculation if ((Random() % 100 + 1) > calc)pokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L588-L603static const struct StatFractions sAccuracyStageRatios[] = { { 33, 100}, // -6 … { 1, 1}, // 0 … { 3, 1}, // +6Checked by claude-agent, 2026-10-20 — read Cmd_accuracycheck and AccuracyCalcHelper (L1054-L1097); Compound Eyes (×1.3), Sand Veil in a sandstorm and Hustle on physical moves (×0.8), and BrightPowder or Lax Incense (the evasion-up hold effect) scale the result before the rollChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.Checked by a second AI model, 2026-10-28.

Against a Foresight target only the attacker's accuracy stage counts. Swift and Vital Throw (EFFECT_ALWAYS_HIT, EFFECT_VITAL_THROW) skip the roll in AccuracyCalcHelper.

Cited by: Hit chance, Random number generator

In Emerald a plain damaging move checks accuracy before it computes damage, the reverse of Red, Blue, and Crystal. pokeemerald/hit-before-damage

About: Pokémon Emerald Hit chance

Codepokeemerald: decompilation of Pokémon Emerald · data/battle_scripts_1.s#L241-L252BattleScript_HitFromAtkCanceler:: attackcanceler BattleScript_HitFromAccCheck:: accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE … critcalc damagecalc typecalc adjustnormaldamageIn 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 — Red and Blue run the hit test after the random factorA 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 — Crystal's plain hit runs the accuracy check lastChecked by claude, 2026-11-04 — read BattleScript_EffectHit (battle_scripts_1.s L241-L252), and cited pokered/damage-order and pokecrystal/damage-order for the Game Boy orderChecked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Cited the Red/Blue and Crystal order claims for the comparison.

Cited by: Hit chance

The multi-hit battle command gives 2 or 3 hits with probability 3/8 each and 4 or 5 with 1/8 each; the loop reruns the critical-hit and damage calculations for every hit, after one accuracy check. pokeemerald/multi-hit

About: Pokémon Emerald Multi-hit attack

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_script_commands.c#L7139-L7155gMultiHitCounter = Random() & 3; if (gMultiHitCounter > 1) gMultiHitCounter = (Random() & 3) + 2; else gMultiHitCounter += 2;pokeemerald: decompilation of Pokémon Emerald · data/battle_scripts_1.s#L604-L639BattleScript_EffectMultiHit:: attackcanceler accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE … setmultihitcounter 0 … BattleScript_MultiHitLoop:: … critcalc damagecalc typecalc … …Checked by claude-agent, 2026-10-20 — read Cmd_setmultihitcounter, Cmd_decrementmultihit (L3644-L3650), and BattleScript_EffectMultiHitChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

The loop also stops when the target faints or the attacker falls asleep, except during Sleep Talk.

Cited by: Critical hit, Hit chance, Multi-hit attack

Emerald's random number generator is a linear congruential generator, x←1103515245x+24691(mod232), returning the top 16 bits; pret's comment traces the multiplier to the example rand in the ISO C standard. pokeemerald/rng

About: Pokémon Emerald Random number generator

Codepokeemerald: decompilation of Pokémon Emerald · src/random.c#L8-L16COMMON_DATA u32 gRngValue = 0; … u16 Random(void) { gRngValue = ISO_RANDOMIZE1(gRngValue); sRandCount++; return gRngValue >> 16; }pokeemerald: decompilation of Pokémon Emerald · include/random.h#L14-L17// The number 1103515245 comes from the example implementation of rand and srand // in the ISO C standard. #define ISO_RANDOMIZE1(val) (1103515245 * (val) + 24691) #define ISO_RANDOMIZE2(val) (1103515245 * (val) + 12345)Checked by claude-agent, 2026-10-20 — read random.c and random.h; gRngValue is a u32, so the arithmetic wraps mod 2^32Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

ISO_RANDOMIZE2, with the standard's 12345, drives a few side generators (Feebas tiles, the lottery, weather sprites).

Cited by: Random encounter, Random number generator

Emerald seeds its random number generator from a hardware timer only when the player's naming screen closes, which also sets the trainer ID; the seeding from the real-time clock at power-on is compiled only into pret's BUGFIX build, so after loading a save the generator starts from 0, and the VBlank handler steps it once a frame outside link, Frontier, and recorded battles. pokeemerald/rng-seed

About: Pokémon Emerald Random number generator

Codepokeemerald: decompilation of Pokémon Emerald · src/main.c#L108-L110#ifdef BUGFIX SeedRngWithRtc(); // see comment at SeedRngWithRtc definition belowpokeemerald: decompilation of Pokémon Emerald · src/main.c#L208-L236void SeedRngAndSetTrainerId(void) { u16 val = REG_TM1CNT_L; SeedRng(val); … // FRLG commented this out to remove RTC, however Emerald didn't undo this! #ifdef BUGFIXpokeemerald: decompilation of Pokémon Emerald · src/main.c#L365-L366if (!gMain.inBattle || !(gBattleTypeFlags & (BATTLE_TYPE_LINK | BATTLE_TYPE_FRONTIER | BATTLE_TYPE_RECORDED))) Random();pokeemerald: decompilation of Pokémon Emerald · src/naming_screen.c#L700-L701if (sNamingScreen->templateNum == NAMING_SCREEN_PLAYER) SeedRngAndSetTrainerId();pokeemerald: decompilation of Pokémon Emerald · src/random.c#L8COMMON_DATA u32 gRngValue = 0;Checked by claude-agent, 2026-10-20 — read AgbMain, SeedRngAndSetTrainerId, and the VBlank handler; grepped src/ for SeedRng, whose other callers are link setup, record mixing, and the contest paintingChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

A saved game therefore walks the same sequence from power-on; what varies is how many steps, one per frame plus one per call, come before a roll.

Cited by: Random number generator, RNG manipulation

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. pokeemerald/encounter-rate

About: Pokémon Emerald Random encounter

Value: route 101 20 · scale 16 · of 2880

Codepokeemerald: decompilation of Pokémon Emerald · src/wild_encounter.c#L493-L529if (Random() % MAX_ENCOUNTER_RATE < encounterRate) … encounterRate *= 16; if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) encounterRate = encounterRate * 80 / 100; ApplyFluteEncounterRateMod(&encounterRate); ApplyCleanseTagEncounterRateMod(&encounterRate); … else if (ability == ABILITY_STENCH) encounterRate /= 2; else if (ability == ABILITY_ILLUMINATE) encounterRate *= 2;pokeemerald: decompilation of Pokémon Emerald · src/wild_encounter.c#L27#define MAX_ENCOUNTER_RATE 2880pokeemerald: decompilation of Pokémon Emerald · src/data/wild_encounters.json#L39-L42"map": "MAP_ROUTE101", … "encounter_rate": 20,Checked by claude-agent, 2026-10-20 — read EncounterOddsCheck, WildEncounterCheck, and StandardWildEncounter; 16 × 20 = 320 of 2,880 is 1 in 9Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Random encounter, Wild encounters

A step onto a tile whose behavior differs from the last one skips the encounter check 40% of the time. pokeemerald/encounter-new-tile

About: Pokémon Emerald Random encounter

Codepokeemerald: decompilation of Pokémon Emerald · src/wild_encounter.c#L531-L539// When you first step on a different type of metatile, there's a 40% chance it // skips the wild encounter check entirely. static bool8 AllowWildCheckOnNewMetatile(void) { if (Random() % 100 >= 60) return FALSE;pokeemerald: decompilation of Pokémon Emerald · src/wild_encounter.c#L599-L602else if (prevMetatileBehavior != curMetatileBehavior && !AllowWildCheckOnNewMetatile()) return FALSE;Checked by claude-agent, 2026-10-20 — read AllowWildCheckOnNewMetatile and its use for land and water encountersChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-11-04.

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. pokeemerald/encounter-slots

About: Pokémon Emerald Random encounter

Value: 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1

Codepokeemerald: decompilation of Pokémon Emerald · src/data/wild_encounters.json#L7-L11"type": "land_mons", "encounter_rates": [ 20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1 ]pokeemerald: decompilation of Pokémon Emerald · src/wild_encounter.c#L182-L189static u8 ChooseWildMonIndex_Land(void) { u8 rand = Random() % ENCOUNTER_CHANCE_LAND_MONS_TOTAL; … if (rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_0) return 0; else if (rand >= ENCOUNTER_CHANCE_LAND_MONS_SLOT_0 && rand < ENCOUNTER_CHANCE_LAND_MONS_SLOT_1) return 1;pokeemerald: decompilation of Pokémon Emerald · json_data_rules.mk#L11-L12 — the build writes the slot constants from the JSON through a templateinclude/constants/wild_encounter.h: $(DATA_SRC_SUBDIR)/wild_encounters.json $(DATA_SRC_SUBDIR)/wild_encounters.constants.json.txt $(JSONPROC) $^ $@pokeemerald: decompilation of Pokémon Emerald · src/data/wild_encounters.constants.json.txt#L13-L15 — each slot's bound is the running sum of the rates and the total is the last bound; computed, the land rates sum to 100, so slot n covers exactly its rate's count of the 100 values#define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ loop.index }} ({% if loop.index == 0 %}{{ encounter_rate }}{% else %}ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ subtract(loop.index, 1) }} + {{ encounter_rate }}{% endif %}){{ setVarInt(wild_encounter_field.type, loop.index) }} … #define ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_TOTAL (ENCOUNTER_CHANCE_{{ upper(wild_encounter_field.type) }}_SLOT_{{ getVar(wild_encounter_field.type) }})Checked by claude, 2026-11-04 — read the land rates in wild_encounters.json, the make rule and template that generate the slot constants, and ChooseWildMonIndex_Land (L182-L210)Checked by a second AI model, 2026-10-21.Revised after a check by a second AI model, 2026-11-04: Quoted the generator that turns the rates into slot bounds; the percentages are computed.

After a battle starts, and whenever a map loads, the next 4 encounter checks are skipped. pokeemerald/encounter-cooldown

About: Pokémon Emerald Random encounter

Value: 4

Codepokeemerald: decompilation of Pokémon Emerald · src/field_control_avatar.c#L662-L675void RestartWildEncounterImmunitySteps(void) { // Starts at 0 and counts up to 4 steps. sWildEncounterImmunitySteps = 0; } … if (sWildEncounterImmunitySteps < 4) { sWildEncounterImmunitySteps++;pokeemerald: decompilation of Pokémon Emerald · src/battle_setup.c#L369-L370SetMainCallback2(CB2_InitBattle); RestartWildEncounterImmunitySteps();pokeemerald: decompilation of Pokémon Emerald · src/overworld.c#L800RestartWildEncounterImmunitySteps();Checked by claude-agent, 2026-10-20 — read CheckStandardWildEncounter and its callers' resets (battle_setup.c L370, L941; overworld.c L800, L850)Checked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-11-04.

Cited by: Random encounter, Wild encounters

An attempt to run always escapes with a Smoke Ball, or with the Run Away ability outside the Battle Pyramid. Otherwise, in a single battle outside the Pyramid, it escapes when the player's Pokémon is at least as fast as the foe, or when ⌊128P/E⌋+30n, stored in a byte, exceeds a random byte, for n earlier attempts. pokeemerald/run

About: Pokémon Emerald Fleeing

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_util.c#L407-L475u8 speedVar; … if (holdEffect == HOLD_EFFECT_CAN_ALWAYS_RUN) … else if (gBattleMons[battler].ability == ABILITY_RUN_AWAY) { if (CurrentBattlePyramidLocation() != PYRAMID_LOCATION_NONE) … if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE)) … else if (gBattleMons[battler].speed < gBattleMons[BATTLE_OPPOSITE(battler)].speed) { …Checked by claude-agent, 2026-10-20 — read TryRunFromBattle; Run Away loses its guarantee only in the Battle Pyramid, and a trainer battle in the Frontier or Trainer Hill always lets the player goRevised after a check by a second AI model, 2026-10-21: The run formula holds only in single battles outside the Battle Pyramid.Checked by a second AI model, 2026-10-28.

Because speedVar is a u8, the sum wraps past 255. After 5 to 9 failed attempts, depending on the two Speeds, it wraps to below 30, so that attempt's chance falls under 12%.

Cited by: Fleeing

The turn-order routine puts the higher-priority move first; at equal priority the higher Speed goes first, after stat stages, Swift Swim or Chlorophyll in their weather, the third badge's ×1.1 for the player, Macho Brace, paralysis's ×¼, and a Quick Claw that triggers; a tie is a coin flip. pokeemerald/turn-order

About: Pokémon Emerald Turn order

Codepokeemerald: decompilation of Pokémon Emerald · src/battle_main.c#L4595-L4750u8 GetWhoStrikesFirst(u8 battler1, u8 battler2, bool8 ignoreChosenMoves) … speedBattler1 = (speedBattler1 * 110) / 100; … if (gBattleMons[battler1].status1 & STATUS1_PARALYSIS) speedBattler1 /= 4; if (holdEffect == HOLD_EFFECT_QUICK_CLAW && gRandomTurnNumber < (0xFFFF * holdEffectParam) / 100) speedBattler1 = UINT_MAX; … // both move priorities are different than 0 … if (speedBattler1 == speedBattler2 && Random() & 1) …Checked by claude-agent, 2026-10-20 — read GetWhoStrikesFirst; the badge boost needs FLAG_BADGE03_GET and applies only on the player's side outside link and Frontier battles; the Quick Claw's parameter is 20 (src/data/items.h L2240-L2241), one random number per turn shared by both battlersChecked by a second AI model, 2026-10-21.Checked by a second AI model, 2026-10-28.

Cited by: Held item, Turn order