7

I'm trying to understand how to calculate IVs range in order to calculate Pokémon Max CP. I have the following info:

Pokemon: Exeggcute
His base stats are 110/132/120 (Atk/Def/Sta)
CP now: 176
HP now: 42
Dust cost: 600
-Not powered up
Trainer level 11

What's the formula and calculations I have to do in order to get the Pokémon's INDIVIDUAL stats?

I'm trying to figure out the formulas used in http://www.pgoiv.com

https://docs.google.com/spreadsheets/d/1wbtIc33K45iU1ScUnkB0PlslJ-eLaJlSZY47sPME2Uk/htmlview?usp=sharing&sle=true#

I'm not looking for automatic tools! I'm looking for the formula used for this calculations.

Jeremy
  • 1
  • 4
  • 29
  • 60
TheUnreal
  • 180
  • 1
  • 1
  • 10

2 Answers2

11

In summary it uses trial and error. There is a sheet of game data which has base stats and then a bunch of functions that just try different values of IV that would match the numbers you have given it. Since a given CP/HP combination can have multiple possible sets of stats it suggests levelling it up and trying again and this way it can eliminate some of the incorrect possibilities.

In more detail this is the algorithm that is uses...

  1. It works out level of Pokémon (and levels can be halves as well as whole numbers) by the stardust cost of the next upgrade (table is in the game data sheet). The "powered up?" column determines whether these half levels are actually allowed. If "powered up" is TRUE then it will allow half levels, otherwise the level must be a whole number. I assume this is because pokemon when caught will always have an integer level.

  2. It then loops through all possible levels getting all the combinations of stats that work for that.

    2.1. First for a given level it works out possible stamina values. Each level has a CP multiplier (in the game data sheet). IV stamina can be anything from 0 to 15. It adds this value to the base stamina of the pokemon and multiplies it by the CP value. It then takes the floor of this value (so taking just the whole number part so 59.9 would be 59). If this matches the HP you were given then the stamina is a valid possibility.

    2.2 Attack and Defence are also between 0 and 15 and it tries all 256 combinations of those with the possible staminas. It works out the CP for each possible combination and any that match the CP you have given it are added as possibilities.

    2.2.1 CP is worked out by taking the attack ((base+IV)*CPMultiplier), the square root of the defence ((base+IV)*CPMultiplier), and the square root of the stamina ((base+IV)*CPMultiplier), multiplying them together and dividing by 10.

  3. This gives you your list of possibilities.

  4. Once you try again after a level up because of the way the rounding works some of the previous calculated possibilities will likely differ by 1 (or maybe more) and therefore can be discounted. Do this enough times and it will work out a unique set of values for the stats.

The Dratini example should show you how this works. Follow through the maths on each of them to see how it works.

If you have any questions on specific bits of this operation then let me know and I'll see if I can clarify anything.

Source: This information is all derived from reading the scripts in the script of the sheet. You can see the code once you have copied the sheet for yourself by clicking on "Tools...Script Editor..."

Mathias711
  • 23,089
  • 28
  • 100
  • 166
Chris
  • 3,386
  • 6
  • 29
  • 37
  • Finally a comment on what I'm talking about. You comment is a good way to start, and I would love if you can help me further with making the formula in a math way. – TheUnreal Jul 24 '16 at 15:34
  • Managed to calculate the pokemon STA IV! Couldn't understand how to calculate and atk and def iv's from it – TheUnreal Jul 24 '16 at 17:40
  • The point of my answer is that there isn't really a standard calculation - there is no formula that you can put numbers into and it spits out the right value. You just have to try values and see if they fit the data you have available. An example with stamina which is relatively easy is that if a pokemon has 50HP then that might be a pokemon at level 10 with high stamina or it might be a pokemon at level 10.5 with lower stamina. If you want to work out the full stats you basically have to go through this algorithm. – Chris Jul 25 '16 at 08:45
  • Yeah, I understood the way of calculating the stamina, but I couldn't understand the way of achieving the right invidual stats (range) of the attack and defence stats. – TheUnreal Jul 25 '16 at 12:11
  • For each possible level/stamina combination you have worked out you need to try all 256 combinations of attack and defence and calculate the CP if the pokemon had those values. If the CP matches your pokemon then you know that the combination of level, stamina, attack and defence are valid possibilities. Repeat until you have all the possible combinations of stats that your pokemon might have. There is no formula. It is just trial and error to find the correct possibilities. – Chris Jul 25 '16 at 12:38
  • Thanks, but when you say "If the CP matches your pokemon", how can it match? I've been looking at the formula posted in Ninja answer and the formula is: CP = (Base Atk + Atk IV) * (Base Def + Def IV)^0.5 * (Base Stam + Stam IV)^0.5 * Lvl(CPScalar)^2 / 10. When I'm placing the combinations found in the .xl files posted in my question, the CP do not match and not even close – TheUnreal Jul 25 '16 at 14:37
  • Are you including the pokemon base stats? What it gives you in the box is the IV parts of that and you need to add the base from the pokemon type to it first. I also noticed that my described calculation in 2.2.1 was missing out the CP multipliers which I have now added in. – Chris Jul 25 '16 at 14:37
  • Lets use the dratini in the sample spreadsheet as an example. It is lvl 6 (CP multiplier is 0.3210876) and has IV stats of 13/15/15. Looking up the base dratini stats we see its base stats are 128/110/82. This means the actual attack/defence/stamina are 141/125/97. The CP then is 1410.3210876SQRT(1250.3210876)SQRT(97*0.3210876)/10. If we do the maths this then comes out as 160 which matches what is listed in the spreadsheet for the CP. – Chris Jul 25 '16 at 14:47
  • @The image links don't seem to work. If you tell me the input (type, CP, HP) and the combinations you got (level, attack, defence, stamina) I can try to work out why they are not valid or why the spreadsheet may not have returned them. but sadly I can't see what you are looking at right now. – Chris Jul 25 '16 at 16:37
  • fixed links Thanks for your assistant Chris, I got how it works. I managed to calculate the right Iv's but I got some different combinations that equals the total CP which are not shown in the .xl and I'm trying to figure out why. Those are the combinations from the xl file for my Rhyhorn: http://i.imgur.com/66YIeze.png and those are the the results I got from my calculations: http://i.imgur.com/yLxgEkm.png , I tried to calculate random result which is not shown in the XL file and got this: http://i.imgur.com/6oMYNnc.png , it's 333, why the xl file wont show it? – TheUnreal Jul 25 '16 at 16:44
  • I'm not sure if I completely understand what lvl(CPScalar) is? I've seen in other places that it's "~0.95" but here you says it's different for each level. If it's different for each level, how do we find that data, or where can we find that data? Because all of my calulcations have been WAY off. – FatalKeystroke Aug 10 '16 at 03:27
  • @FatalKeystroke: There is a table in the spreadsheet linked in the question with the values in. I believe it was datamined but I might be wrong on that. – Chris Aug 10 '16 at 08:37
0

https://pokeassistant.com/main/ivcalculator?utf8=%E2%9C%93&search_pokemon_name=Bulbasaur&search_cp=446&search_hp=53&search_dust=1300&search_powered=0&search_pokemon_id=1&evolver=true&lastmon=133&resubmit=21+15+15+2&commit=Find+IVs

There are some formulas on here that you might consider looking into and reverse engineering the spread sheets that have been posted on this forum should lead to the formula. I would do it for you but I am busy today.

EDIT: Keep in mind that for these to work you also need some of the data mined game data regarding the base stats of all the Pokemon in this game and the CP multipliers which both can be found on the spreadsheet you posted to begin with.

EDIT: Just in case you are to lazy to actually look

HP = (Base Stam + Stam IV) * Lvl(CPScalar)

CP = (Base Atk + Atk IV) * (Base Def + Def IV)^0.5 * (Base Stam + Stam IV)^0.5 * Lvl(CPScalar)^2 / 10

Ninja
  • 17
  • 2