public int GetStat(PokeStat statWanted) { if (statWanted == PokeStat.NONE) { Console.WriteLine("Invalid stat value."); Utility.KeyToProceed(); return(0); } int index = (int)statWanted - 1; double transValue = 0; int statValue = 0; if (index == 0) { statValue = (int)(Math.Floor((((2 * _baseStats[index]) + _IVStats[index] + Math.Floor(_EVStats[index] / 4.0)) * _level) / 100) + _level + 10); } else { transValue = Math.Floor((((2 * _baseStats[index]) + _IVStats[index] + Math.Floor(_EVStats[index] / 4.0)) * _level) / 100) + 5; if (!(GetStatIncreased() == GetStatDecreased())) { if ((int)GetStatIncreased() - 1 == index) { transValue *= 1.1; } if ((int)GetStatDecreased() - 1 == index) { transValue *= 0.9; } } statValue = (int)Math.Floor(transValue); } return(statValue); }
public PokeStat GetStatIncreased() { PokeStat statIncreased = PokeStat.NONE; switch (_nature) { case 1: case 2: case 3: case 4: case 5: statIncreased = PokeStat.ATTACK; break; case 6: case 7: case 8: case 9: case 10: statIncreased = PokeStat.DEFENSE; break; case 11: case 12: case 13: case 14: case 15: statIncreased = PokeStat.SPEED; break; case 16: case 17: case 18: case 19: case 20: statIncreased = PokeStat.SPATTACK; break; case 21: case 22: case 23: case 24: case 25: statIncreased = PokeStat.SPDEFENSE; break; } return(statIncreased); }
public static PokeStat DetermineStatType(string typeString) { PokeStat statValue = PokeStat.NONE; string testString = typeString.ToLower(); switch (testString) { case "hp": statValue = PokeStat.HP; break; case "attack": case "att": statValue = PokeStat.ATTACK; break; case "defense": case "def": statValue = PokeStat.DEFENSE; break; case "spattack": case "special attack": case "spa": statValue = PokeStat.SPATTACK; break; case "spdefense": case "special defense": case "spd": statValue = PokeStat.SPDEFENSE; break; case "speed": case "spe": statValue = PokeStat.SPEED; break; default: statValue = PokeStat.NONE; break; } return(statValue); }