- 23
- Posts
- 20
- Years
- Seen Oct 22, 2008
This only deals with providing the Hidden Power Type. My IV Calculator does take this into consideration, but it seemed to only have a small impact. I just calculated the type by cycling thru all the currently valid IVs. If a particular IV didn't show up from the calculations, then I knew it was invalid.
However, I just noticed something that may make quite a difference. Since the type is in part determined by the evenness or oddness of an IV, we can eliminate whole sets. However, each power of 2 that gets produced has less and less of an impact, so only a few stat types will see a huge reduction in IVs:
int t1 = GetHiddenPowerTypeNumber(hpIV, 0);
int t2 = GetHiddenPowerTypeNumber(attIV);
int t3 = GetHiddenPowerTypeNumber(defIV, 2);
int t4 = GetHiddenPowerTypeNumber(speedIV, 3);
int t5 = GetHiddenPowerTypeNumber(spaIV, 4);
int t6 = GetHiddenPowerTypeNumber(spdIV, 5);
privateint GetHiddenPowerTypeNumber(int iv, int power)
{
if (iv % 2 == 1)
return (int)Math.Pow(2, power);
else
return 0;
}
Special Defense will almost always have it reduced one way or the other. Since the equation does this:
int hpTypeValue = (int)Math.Floor((double)((t1+t2+t3+t4+t5+t6) * 15 / 63));
And these are the correlating types:
switch (hpTypeValue)
{
case 0 :
hpType = 5; //Fighting
break;
case 1 :
hpType = 7; //Flying
break;
case 2 :
hpType = 13; //Poison
break;
case 3 :
hpType = 10; //Ground
break;
case 4 :
hpType = 15; //Rock
break;
case 5 :
hpType = 1; //Bug
break;
case 6 :
hpType = 8; //Ghost
break;
case 7 :
hpType = 16; //Steel
break;
case 8 :
hpType = 6; //Fire
break;
case 9 :
hpType = 17; //Water
break;
case 10 :
hpType = 9; //Grass
break;
case 11 :
hpType = 4; //Electric
break;
case 12 :
hpType = 14; //Psychic
break;
case 13 :
hpType = 11; //Ice
break;
case 14 :
hpType = 3; //Dragon
break;
case 15 :
hpType = 2; //Dark
break;
default:
// Let it return -1
break;
}
We know that the first 0-6 MUST have the SpD be even because otherwise it would already go past their base numbers... Just like we know that numbesr 8-15 MUST have the SpD be odd because otherwise it wouldn't be able to reach that high of a number. 7 (Steel) is the only type that could end up either way. These are all the number I've compiled. I don't know if I can further add to this list, but it seems promising:
Stat | IV Must Be This | case #
SpD | Even | 0-6
SpD | Odd | 8-15
SpA | Even | 0-2
SpA | Odd | 12-15
Speed | Even | 0
Speed | Odd | 14-15
Def | Odd | 15
Att | Odd | 15
HP | Odd | 15
If the type ends up being Dark, then we know all IVs must be an Odd number. The opposite (even) isn't the case for Fighting because Math.Floor messes things up.
At any rate, I was hoping some people might help me take a deeper look into this because we may be able to find some more specific cases that might occur. Thanks!
However, I just noticed something that may make quite a difference. Since the type is in part determined by the evenness or oddness of an IV, we can eliminate whole sets. However, each power of 2 that gets produced has less and less of an impact, so only a few stat types will see a huge reduction in IVs:
int t1 = GetHiddenPowerTypeNumber(hpIV, 0);
int t2 = GetHiddenPowerTypeNumber(attIV);
int t3 = GetHiddenPowerTypeNumber(defIV, 2);
int t4 = GetHiddenPowerTypeNumber(speedIV, 3);
int t5 = GetHiddenPowerTypeNumber(spaIV, 4);
int t6 = GetHiddenPowerTypeNumber(spdIV, 5);
privateint GetHiddenPowerTypeNumber(int iv, int power)
{
if (iv % 2 == 1)
return (int)Math.Pow(2, power);
else
return 0;
}
Special Defense will almost always have it reduced one way or the other. Since the equation does this:
int hpTypeValue = (int)Math.Floor((double)((t1+t2+t3+t4+t5+t6) * 15 / 63));
And these are the correlating types:
switch (hpTypeValue)
{
case 0 :
hpType = 5; //Fighting
break;
case 1 :
hpType = 7; //Flying
break;
case 2 :
hpType = 13; //Poison
break;
case 3 :
hpType = 10; //Ground
break;
case 4 :
hpType = 15; //Rock
break;
case 5 :
hpType = 1; //Bug
break;
case 6 :
hpType = 8; //Ghost
break;
case 7 :
hpType = 16; //Steel
break;
case 8 :
hpType = 6; //Fire
break;
case 9 :
hpType = 17; //Water
break;
case 10 :
hpType = 9; //Grass
break;
case 11 :
hpType = 4; //Electric
break;
case 12 :
hpType = 14; //Psychic
break;
case 13 :
hpType = 11; //Ice
break;
case 14 :
hpType = 3; //Dragon
break;
case 15 :
hpType = 2; //Dark
break;
default:
// Let it return -1
break;
}
We know that the first 0-6 MUST have the SpD be even because otherwise it would already go past their base numbers... Just like we know that numbesr 8-15 MUST have the SpD be odd because otherwise it wouldn't be able to reach that high of a number. 7 (Steel) is the only type that could end up either way. These are all the number I've compiled. I don't know if I can further add to this list, but it seems promising:
Stat | IV Must Be This | case #
SpD | Even | 0-6
SpD | Odd | 8-15
SpA | Even | 0-2
SpA | Odd | 12-15
Speed | Even | 0
Speed | Odd | 14-15
Def | Odd | 15
Att | Odd | 15
HP | Odd | 15
If the type ends up being Dark, then we know all IVs must be an Odd number. The opposite (even) isn't the case for Fighting because Math.Floor messes things up.
At any rate, I was hoping some people might help me take a deeper look into this because we may be able to find some more specific cases that might occur. Thanks!