コード例 #1
0
ファイル: Pokemon.cs プロジェクト: alikoneko/DarwinianPokemon
        public Pokemon Breed(Pokemon father)
        {
            int average_hp = (MaxHP + father.HP) / 2;
            int average_atk = (attack + father.AttackPower) / 2;
            int average_def = (defense + father.Defense) / 2;
            int average_spa = (special_attack + father.SpecialAttack) / 2;
            int average_spdef = (special_defense + father.SpecialDefense) / 2;
            int average_spd = (speed + father.Speed) / 2;

            Pokemon baby = new Pokemon(type_1, father.Type_2, average_hp, average_atk, average_def, average_spa, average_spdef, average_spd, NameGenerator.Generate(name, father.name));
            int mutate = random.Next(0, 7);
            switch (mutate)
            {
                case 0:
                    baby.MutateType();
                    break;
                case 1:
                    baby.MutateStat();
                    break;
                case 2:
                    baby.Reroll();
                    break;
                default:
                    break;
            }

            return baby;
        }
コード例 #2
0
 private Pokemon FindMatch(Pokemon source)
 {
     return RandomPokemon(population.Where(candidate => candidate != source).ToList<Pokemon>());
 }
コード例 #3
0
ファイル: Pokemon.cs プロジェクト: alikoneko/DarwinianPokemon
 public void Attack(Pokemon target)
 {
     target.Damage(attacks[random.Next(attacks.Count)].GetDamage(this, target));
 }
コード例 #4
0
 private Pokemon FindBreedingMatch(Pokemon source)
 {
     return RandomPokemon(population.Where(candidate => candidate != source && candidate.Breedable).ToList<Pokemon>());
 }