• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Editing Type Effectiveness chart and STAB bonus

  • 23
    Posts
    1
    Years
    • Seen Jan 30, 2024
    I am trying to locate the parts of the code that deal with applying the 50% power boost from STAB and also the code that tells what types are effective against what types. I want to edit the type effectiveness around, and edit the effectiveness amount and STAB bonus. I have looked around for awhile now in the code and I cannot recognize it.
     
  • 247
    Posts
    6
    Years
    • Seen May 28, 2024
    I am trying to locate the parts of the code that deal with applying the 50% power boost from STAB and also the code that tells what types are effective against what types. I want to edit the type effectiveness around, and edit the effectiveness amount and STAB bonus. I have looked around for awhile now in the code and I cannot recognize it.

    If you are using the battle engine expansion, STAB is accounted for in src/battle_util.c, within this function:
    Code:
    static u32 CalcFinalDmg(u32 dmg, u16 move, u8 battlerAtk, u8 battlerDef, u8 moveType, u16 typeEffectivenessModifier, bool32 isCrit, bool32 updateFlags)
    {
    ...........................................
        if (IS_BATTLER_OF_TYPE(battlerAtk, moveType) && move != MOVE_STRUGGLE)
        {
            if (abilityAtk == ABILITY_ADAPTABILITY)
                MulModifier(&finalModifier, UQ_4_12(2.0));
            else
                MulModifier(&finalModifier, UQ_4_12(1.5));
        }
    The type effectiveness table will be found in the same file, the table being named sTypeEffectivenessTable.


    If you are using pret pokeemerald instead, STAB calculations are found in src/battle_script_commands.c in the function u8 TypeCalc(u16 move, u8 attacker, u8 defender), as well as static void Cmd_typecalc(void). The important section of both of these functions will look like this:
    Code:
        if (IS_BATTLER_OF_TYPE(attacker, moveType))
        {
            gBattleMoveDamage = gBattleMoveDamage * 15;
            gBattleMoveDamage = gBattleMoveDamage / 10;
        }
    The effectiveness table will be found in src/battle_main.c in the table gTypeEffectiveness.
     
  • 23
    Posts
    1
    Years
    • Seen Jan 30, 2024
    I am using pokefirered. I am sorry, I should have clarified. I found the critical hit damage multiplier in the pokemon.h file. I changed it from 2 to 3/2.
     
  • 23
    Posts
    1
    Years
    • Seen Jan 30, 2024
    I found the table, but where do I edit the multiplier for the different effectiveness?
     
  • 247
    Posts
    6
    Years
    • Seen May 28, 2024
    I found the table, but where do I edit the multiplier for the different effectiveness?

    It looks like you might be able to edit and/or create new multipliers in include/battle_main.h. Looking at this section here:
    Code:
    // defines for the gTypeEffectiveness multipliers
    #define TYPE_MUL_NO_EFFECT          0
    #define TYPE_MUL_NOT_EFFECTIVE      5
    #define TYPE_MUL_NORMAL             10
    #define TYPE_MUL_SUPER_EFFECTIVE    20
    The multiplier values seems to be what ever the multiplication should be multiplied by 10. So if you wanted something like a 0.3x multiplier, you'd change one of the multipliers to 3. You could also create your own constants with whatever value you want, and then add that to whatever row(s) you want in gTypeEffectiveness.
     
    Back
    Top