Swords and Shields
Awesome starters artwork by Ry Spirit: https://instagram.com/ryspiritart/

Calculating EVs needed to raise a stat in Pokémon

As a result of working on upgrades for this Pokémon Effort Value Calculator, math has been a pretty big part of my life for the past few months, as I’ve been rearranging the games’ formulas for stat and damage calculation to make my own that fit my needs.

One such formula was the EVs needed one, which gives you the amount of EVs you need to invest to raise a stat by n points. Everyone knows that at Level 100, you get 1 stat point for every 4 EV points you invest; but what happens when you’re not at Level 100, or when you factor in stat modifiers like Nature, or item and ability boosts?

Don’t know what effort values are? Start with this article from Bulbapedia. Don’t play the mainline Pokémon games? Then you should start with these.

The stat formula

A good starting point for this would be the stat formulas below — they determine a Pokémon’s stat at any given time. The formula for determining the HP stat is slightly different from the other stats.

Stat = ( (2 × Base + IV + EV4) × Level 100 + 5 ) × Nature HP = (2 × Base + IV + EV4) × Level 100 + Level + 10

As an aside, it’s interesting to note that the HP stat formula can be simplified into this:

HP = (2 × Base + IV + EV4 + 100 ) × Level 100 + Level + 10

This reorganisation makes the formula harder to read, but can actually allow your code to be more concise, because this makes it possible to combine both stat formulas:

Stat = ( (2 × Base + IV + EV4 + A ) × Level 100 + B ) × Nature where A = 100, B = 10 for HP stat; and A = 0, B = 5 for all other stats

Article continues after the advertisement:


Pulling out the EV portion

The math that we were doing above actually have nothing to do with calculating needed EVs to raise a stat — it was just some interesting trivia. Let’s get to what you came here for.

First, let’s reorganise the fractional part of the stat formulas, so it becomes clear how the Base, IVs and EVs affect the stat:

(2 × Base + IV + EV4) × Level 100 = (2 × Base + IV + EV4) × Level 100 = ( 2 × Base × Level 100 ) + ( IV × Level 100 ) + ( EV4 × Level 100 )

Since we are most concerned about the EVs, let’s examine that portion first and add in the rest of the formula as we go along:

Stat = EV4 × Level 100

We have to reorganise the formula so that EV alone ends up on one side.

Stat ÷ Level 100 = EV4 Stat × 100 Level = EV4

We need to break the floor operation to isolate EV on the right-hand side, which is tricky. Let’s ignore the floor operation for a moment:

Stat × 100 Level × 4 = EV

The floor operation basically makes it so that any remainder of the EV value after being divided by 4 is discarded. This means that, to move the floor operation to the other side, we have to round the result up to the nearest multiple of 4:

( Stat × 100 Level × 4 ) ÷ 4 × 4 = EV

Cleaning up our formula and making it more presentable:

EVs needed = ( Stat × 400 Level ) ÷ 4 × 4

Factoring in IV contributions

If you’re a competitive Pokémon player, you might be aware of this little quirk when it comes to EV-ing Level 50 Pokémon (all Pokémon have their Levels set to 50 in a competitive match). If a stat has 31 IVs, it takes 4 EVs to raise the stat by 1 point, then 8 EVs for every subusequent point.

IV stands for Individual Values. You can find out more about what they are in this Bulbapedia article.

This quirk exists because IVs affect how many EVs you need to raise a stat, as we see when we reorganise the stat formula above.

IV stat contribution = IV × Level 100

At Level 50, with 31 IVs, you will get the following stat contribution:

IV stat contribution = 31 × 50 100 = 15.5

If you refer to the stat formula again, you’ll see that the stat total is not rounded down until the base stat, IVs and EVs are totalled. That means that the decimal portion of the IV reduces the amount of EVs you’ll normally need to raise the stat.

IV and EV stat contribution = ( IV + EV4) × Level 100

Let’s rewrite this so that we can see their stat contributions more clearly:

IV and EV stat contribution = ( IV + EV4) × Level 100

At Level 50, with 31 IVs and (for example) 12 EVs invested, we will get the following:

( 31 + 124) × 50 100 = 15.5 + 1.5

Essentially, 12 EVs give us 1.5 points of stats, which total up with the stats from 31 IVs (15.5) to give us 17 points of stats. If we don’t fill up the .5 stat from the 31 IVs with EVs, it will be rounded down and wasted. This is why the calculator often recommends a spread of 244 HP / 4 Def / 4 SpD instead of 252 HP — you are essentially getting your first stat point at half the EV cost.

How do we factor this into our EVs needed formula? Remember that we only care about the fractional part of the IV contribution (i.e. the part after the decimal point).

EVs needed = ( ( Stat – { IV × Level100 } ) × 400 Level ) ÷ 4 × 4

Note: { and } in the formula mean we only take the fractional part. For e.g. { 4.5 } = 0.5.


Article continues after the advertisement:


Factoring in base stat contribution

Your Pokémon species’ base stat actually affects your EV cost too, similar to how IVs do. It’s just that at Level 50, the formula always works out in such a way that base stats always end up without any fractional part.

Base stat contribution = 2 × Base × Level 100 Base stat contribution (LV50) = 2 × Base × 50 100 = Base

At Levels outside of 50 and 100, however, the base stat contribution can create a fractional part. For example, at Level 32 with a base stat of 70:

Base stat contribution (LV32) = 2 × 70 × 32 100 = 44.8

Which means we have to factor this into our formula too.

EVs needed = ( ( Stat – { 2 × Base × Level100 + IV × Level100 } ) × 400 Level ) ÷ 4 × 4

Fun fact: There have been official online Pokémon tournaments that were held with Pokémon set to Levels outside of 50 and 100; but it was a long time ago.

Factoring in existing EV contribution

If you’ve already got existing EV investment in a stat, you’ve got to factor that in too. You should know the drill by now.

EVs needed = ( ( Stat – { 2 × Base × Level100 + IV × Level100 + ⌊ EV4 ⌋ × Level100 } ) × 400 Level ) ÷ 4 × 4

Since the formula is getting a little unwieldy, let’s also reorganise and simplify it:

EVs needed = ( ( Stat – { D } ) × 400 Level ) ÷ 4 × 4 Where D = { 2 × Base × Level100 + IV × Level100 + ⌊ EV4 ⌋ × Level100} = { (2 × Base + IV + ⌊ EV4 ⌋ ) × Level100}

Factoring in nature and other modifiers

If a stat is affected by Nature or other modifiers, you are going to have work that into the formula too. It may sound complicated, but since stat modifiers multiply into the stat, we just have to divide them from the stat in the formula.

We also have to round the result of the division up, since stats are normally rounded down after modifiers are applied.

EVs needed = ( ( ⌈ Stat ÷ Modifiers ⌉ – { D } ) × 400 Level ) ÷ 4 × 4 Where Modifiers = Product of all stat modifiers

The final formula

Here is the final formula for calculating how many EVs you need to raise a stat by a specific number of points.

EVs needed = ( ( ⌈ Stat ÷ Modifiers ⌉ – { D } ) × 400 Level ) ÷ 4 × 4 Where Stat = Desired increase in stat; and Modifiers = Product of all stat modifiers; and D = { (2 × Base + IV + ⌊ EV4 ⌋ ) × Level100}

Gotta say, I’m pretty proud of working this out on my own. Nonetheless, please feel free to point out any errors or mistakes in the comments section!

There are 1 comments:

  1. Thank you for this, incredible work! I’m making a Speed calculator spreadsheet, and was always just a few EVs off—your write-up helped me realize I have to round up instead of truncating :)

Leave a Reply

Your email address will not be published. Required fields are marked *

Note: You can use Markdown to format your comments.

For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

I agree to these terms.

This site uses Akismet to reduce spam. Learn how your comment data is processed.