A Pokémon instance that holds the definition and save data of a Pokémon instance.
Beispiel #1
0
        private Pokemon CreatePokemon(PokemonModel dataModel, int level)
        {
            var saveModel = new PokemonSaveModel();
            PopulateSaveModel(dataModel, saveModel, level);
            var pokemon = new Pokemon(_gameMode, dataModel, saveModel);

            pokemon.LearnStartupMoves();
            if (level > 1)
                pokemon.LevelUp(true, level);

            return pokemon;
        }
        private static int CalculateHP(Pokemon pokemon)
        {
            // HP = 
            // (floor((2 * Base + IV + floor(EV / 4)) * Level) + Level + 10)

            int baseHP = pokemon.BaseStats.HP;
            int IVHP = pokemon.IVs.HP;
            int level = pokemon.Level;
            int EVHP = pokemon.EVs.HP;

            return (int)(Floor(((2 * baseHP + IVHP + Floor((double)EVHP / 4)) * level) / 100) + level + 10);
        }
        private static int InternalCalculateStat(Pokemon pokemon, PokemonStatType statType)
        {
            // Stat = 
            // floor((floor(((2 * base + IV + floor(EV / 4)) * level) / 100) + 5) * nature)

            int IV = pokemon.EVs.GetStat(statType);
            int EV = pokemon.IVs.GetStat(statType);
            int baseStat = pokemon.BaseStats.GetStat(statType);

            double nature = 1.0d;

            if (pokemon.Nature.StatIncrease.Contains(statType))
                nature = 1.1d;
            else if (pokemon.Nature.StatDecrease.Contains(statType))
                nature = 0.9d;

            return (int)((Floor((Floor(2 * baseStat + IV + Floor((double)EV / 4)) * pokemon.Level) / 100) + 5) * nature);
        }
 /// <summary>
 /// Returns a specific stat for a Pokémon.
 /// </summary>
 public static int CalculateStat(Pokemon pokemon, PokemonStatType statType)
 {
     return statType == PokemonStatType.HP ? 
         CalculateHP(pokemon) :
         InternalCalculateStat(pokemon, statType);
 }