• 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.

A little help with math.

SakuraKenji

Breeder
39
Posts
15
Years
  • Im having trouble with some algorithms...

    Lets say my stats are:

    HP
    Attack
    Defense
    Accuarcy
    Evasion

    In addition to this each move has its own attack and accuracy stat.
    The move's accuracy stat is a percentage which adjusts the user's accuracy.

    To deal damage the user's attack and move's attack are weighed against the target's defense.

    To hit a target, the user's accuracy and move's accuracy are weighed against the target's evasion.

    There are other stats, but these are the ones Im having trouble with.
    There are no other factors to be added, other than the ones I have listed here. I have the accuracy handled, it's the damage I'm having an issue with.

    I just need some ideas or hints that I can use to help make my own algorithms. (I hate pirating other peoples work)

    And thanks for all the help I might recieve!

    Edit: Oh ya don't put any script up here. I can figure out the script when I have the formula.
     
    Last edited:
    2,048
    Posts
    16
    Years
    • Seen Sep 7, 2023
    You can multiply your move's accuracy by your Pokémon's accuracy, then divide by your opponent's evasion. For example, a move with 80% accuracy (0.8) used by a Pokémon with 150 accuracy against a Pokémon with 200 evasion would have 0.8 * 150 / 200 = 0.6 total accuracy. In that case, you should probably keep the accuracy and evasion stats similar across all levels, so a low-level Pokémon can still hit a high-level one.

    As for damage, the official games use something like this as their basic formula:
    ((Attacker level * 2 +10) * attack stat * power) / (250 * defense stat)
    As you can see, the attacker's level plays a major part; this is to balance the increase in HP as the opponent levels up. The 250 defense multiplier balances the attack power (the highest power of any attack is 250); if it wasn't there, attacks would do way too much damage.
    After that algorithm, the damage is further multiplied by type effectiveness and STAB. Finally, to give attack damage a element of randomness, it is decreased by between 0% and 15%.

    This formula doesn't take into account other variables such as items and abilities; however, these are just simple multipliers to either the Pokémon's stats or the final damage.
     

    SakuraKenji

    Breeder
    39
    Posts
    15
    Years
  • *sigh* That's what I came across too.
    Unfortunately my game doesn't use levels, strength is determined in experience. In addition, there isn't a limiter on stats either. I have control on how the stats function in my game however. To get your stats to ridiculous numbers will take a considerable amount of time.

    I might need to rethink this. I want my game to be origional, but the more I work with stuff like this I just seem to get more frustrated... Looks like it might be time for bed...

    Thanks for your input though! Other forums that I have asked this question on have given me ANY replies.
     
    Back
    Top