• Check out the relaunch of our general collection, with classic designs and new ones by our very own Pissog!

Done Gen 3 Reversal/Flail base power

What type of bug are you reporting? Mechanics

What is the bug?

Reversal is implemented incorrectly on PS!

https://replay.pokemonshowdown.com/gen3ou-2127123398 -- Turn 7

The damage calculator provides the following as the intended outcome:
+2 252+ Atk Heracross Reversal (150 BP) vs. 168 HP / 0 Def Metagross: 418-492 (121.8 - 143.4%) -- guaranteed OHKO

What actually happened:

Heracross used Reversal!
(The opposing Metagross lost 94% of its health!)

The opposing Metagross used Hidden Power!
It's super effective!
(Heracross lost 10% of its health!)

Heracross fainted!

PS! appears to incorrectly use the Gen 4 Reversal damage calculations for other generations; please review.

Per Bulbapedia:

image.png


Are you able to replicate it? If so, how?
https://replay.pokemonshowdown.com/gen3ou-2127172977

Notes are annotated within the game for developer review.
 
Last edited:
The pret Emerald disassembly agrees.

C:
static void Cmd_remaininghptopower(void)
{
    s32 i;
    s32 hpFraction = GetScaledHPFraction(gBattleMons[gBattlerAttacker].hp, gBattleMons[gBattlerAttacker].maxHP, 48);
    for (i = 0; i < (s32) sizeof(sFlailHpScaleToPowerTable); i += 2)
    {
        if (hpFraction <= sFlailHpScaleToPowerTable[i])
            break;
    }
    gDynamicBasePower = sFlailHpScaleToPowerTable[i + 1];
    gBattlescriptCurrInstr++;
}



u8 GetScaledHPFraction(s16 hp, s16 maxhp, u8 scale)
{
    u8 result = hp * scale / maxhp;

    if (result == 0 && hp > 0)
        return 1;

    return result;
}

Here's the table for Gen 3:
C:
static const u8 sFlailHpScaleToPowerTable[] =
{
    1, 200,
    4, 150,
    9, 100,
    16, 80,
    32, 40,
    48, 20
};

Showdown is currently inheriting Gen 4 base power behavior for Gens 2 & 3.

EDIT: fixed by Karthik in https://github.com/smogon/pokemon-showdown/pull/10315
 
Last edited:
Back
Top