Facts
Games
7 · 1996–2004
Evidence
Code (10)
Sources
7
On this page
  1. Implementations
  2. Related
  3. References
  4. Sources

A move whose type matches one of its user’s types gets a damage bonus. The comment on Crystal’s code for it expands its name, STAB, as “Same Type Attack Bonus”1. It runs in the same routine as type effectiveness, directly before the type rows2,3,4.

#Implementations

GameInteger math
Red and Blued+⌊d/2⌋2
Crystald+⌊d/2⌋3, after weather and badge boosts
Emerald⌊d×15/10⌋4

Pokémon Yellow keeps Red and Blue’s form, and Pokémon Gold and Silver already have Crystal’s5,2,6,3. Pokémon Ruby and Sapphire and Pokémon FireRed and LeafGreen use Emerald’s7,8,4.

The forms agree for every non-negative d: ⌊15d/10⌋=d+⌊d/2⌋4. In Crystal and Emerald, Struggle skips the routine and never gets the bonus9,10.

Every claim about this mechanic, by game (8)

References

  1. ^Codepret/pokecrystaleffect_commands.asm 1214–1215
    How we know

    A comment in pokecrystal's STAB battle command expands STAB as “Same Type Attack Bonus”.

    1214BattleCommand_Stab:
    1215; STAB = Same Type Attack Bonus
    
    engine/battle/effect_commands.asm lines 1214–1215 at 97187cd · upstream ↗

    Claim page

  2. ^ abcdCodepret/pokeredcore.asm 5101–5125
    How we know

    The type-adjustment routine applies STAB before any type row: damage+⌊damage/2⌋ when the move's type matches either attacker type.

    5116	srl b
    5117	rr c      ; bc = floor(0.5 * damage)
    5118	add hl, bc ; hl = floor(1.5 * damage)
    
    engine/battle/core.asm lines 5101–5125 at af51989 · upstream ↗

    Claim page

  3. ^ abcdCodepret/pokecrystaleffect_commands.asm 1251–1288
    How we know

    The STAB battle command applies weather and badge type boosts, then STAB (damage+⌊damage/2⌋ if either attacker type matches), then the type chart.

    1251	farcall DoWeatherModifiers
    ⋮
    1258	farcall DoBadgeTypeBoosts
    ⋮
    1278	srl b
    1279	rr c
    1280	add hl, bc
    
    engine/battle/effect_commands.asm lines 1251–1288 at 97187cd · upstream ↗

    Claim page

  4. ^ abcdeCodepret/pokeemeraldbattle_script_commands.c 1368–1373; battle.h 471
    How we know

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

    1368    // check stab
    1369    if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
    ⋮
    1371        gBattleMoveDamage = gBattleMoveDamage * 15;
    1372        gBattleMoveDamage = gBattleMoveDamage / 10;
    
    src/battle_script_commands.c lines 1368–1373 at 731ad5b · upstream ↗
    include/battle.h#L471 · upstream ↗

    Claim page

  5. ^ abCodepret/pokeyellow · pret/pokeredcore.asm 5287–5288, 5075–5191
    How we know

    Yellow keeps Red and Blue's routine that adjusts damage for the move's type, so STAB is still damage+⌊damage/2⌋ before the type rows.

    5287	srl b
    5288	rr c      ; bc = floor(0.5 * damage)
    
    engine/battle/core.asm lines 5287–5288 at b6696f2 · upstream ↗
    engine/battle/core.asm#L5075-L5191 · upstream ↗

    Claim page

  6. ^ abCodepret/pokegold · pret/pokecrystaleffect_commands.asm 1217–1281, 1214–1397
    How we know

    Gold and Silver's same-type bonus command, which Crystal keeps unchanged, applies the weather and badge type boosts and then STAB, damage+⌊damage/2⌋, before the type rows.

    1217BattleCommand_Stab:
    1218; STAB = Same Type Attack Bonus
    ⋮
    1254	farcall DoWeatherModifiers
    ⋮
    1261	farcall DoBadgeTypeBoosts
    ⋮
    1281	srl b
    
    engine/battle/effect_commands.asm lines 1217–1281 at fc702b6 · upstream ↗
    engine/battle/effect_commands.asm#L1214-L1397 · upstream ↗

    Claim page

  7. ^ abCodepret/pokeruby · pret/pokeemeraldbattle_script_commands.c 1486–1490, 1368–1372
    How we know

    Ruby and Sapphire's type-calculation command applies STAB as damage×15/10 before the type rows, as Emerald's does.

    1486        //check stab
    ⋮
    1489            gBattleMoveDamage = gBattleMoveDamage * 15;
    
    src/battle_script_commands.c lines 1486–1490 at 5784633 · upstream ↗
    1368    // check stab
    1369    if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
    ⋮
    1371        gBattleMoveDamage = gBattleMoveDamage * 15;
    1372        gBattleMoveDamage = gBattleMoveDamage / 10;
    
    src/battle_script_commands.c lines 1368–1372 at 731ad5b · upstream ↗

    Claim page

  8. ^ abCodepret/pokefirered · pret/pokeemeraldbattle_script_commands.c 1287–1292, 1368–1372
    How we know

    FireRed and LeafGreen keep Emerald's STAB, damage×15/10 before the type rows; their type-calculation command differs from Emerald's only in how it names the defender's types.

    1287    // check stab
    1288    if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
    ⋮
    1290        gBattleMoveDamage = gBattleMoveDamage * 15;
    1291        gBattleMoveDamage = gBattleMoveDamage / 10;
    
    src/battle_script_commands.c lines 1287–1292 at ce6406d · upstream ↗
    1368    // check stab
    1369    if (IS_BATTLER_OF_TYPE(gBattlerAttacker, moveType))
    ⋮
    1371        gBattleMoveDamage = gBattleMoveDamage * 15;
    1372        gBattleMoveDamage = gBattleMoveDamage / 10;
    
    src/battle_script_commands.c lines 1368–1372 at 731ad5b · upstream ↗

    Claim page

  9. ^Codepret/pokecrystaleffect_commands.asm 1216–1219
    How we know

    Struggle returns from the STAB battle command at once, so it skips weather, badge boosts, STAB, and the type chart.

    1216	ld a, BATTLE_VARS_MOVE_ANIM
    1217	call GetBattleVar
    1218	cp STRUGGLE
    1219	ret z
    
    engine/battle/effect_commands.asm lines 1216–1219 at 97187cd · upstream ↗

    Claim page

  10. ^Codepret/pokeemeraldbattle_script_commands.c 1360–1364
    How we know

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

    1360    if (gCurrentMove == MOVE_STRUGGLE)
    ⋮
    1362        gBattlescriptCurrInstr++;
    1363        return;
    
    src/battle_script_commands.c lines 1360–1364 at 731ad5b · upstream ↗

    Claim page

Sources

Code