Пример #1
0
        public static int CalculateBoarScore(AgricolaPlayer player)
        {
            var boar = player.Farmyard.AnimalManager.GetAnimalCount(AnimalResource.Boar);

            // 165 - yoeman farmer
            if (boar == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (boar < 3)
            {
                return(1);
            }
            else if (boar < 5)
            {
                return(2);
            }
            else if (boar < 7)
            {
                return(3);
            }
            else
            {
                return(4);
            }
        }
Пример #2
0
        public static int CalculateCattleScore(AgricolaPlayer player)
        {
            var cattle = player.Farmyard.AnimalManager.GetAnimalCount(AnimalResource.Cattle);

            // 165 - yoeman farmer
            if (cattle == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (cattle < 2)
            {
                return(1);
            }
            else if (cattle < 4)
            {
                return(2);
            }
            else if (cattle < 6)
            {
                return(3);
            }
            else
            {
                return(4);
            }
        }
Пример #3
0
        public static int CalculateGrainScore(AgricolaPlayer player)
        {
            var grain = player.Grain + player.Farmyard.PlantedResourceCount(Resource.Grain);

            // 165 - yoeman farmer
            if (grain == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (grain < 4)
            {
                return(1);
            }
            else if (grain < 6)
            {
                return(2);
            }
            else if (grain < 8)
            {
                return(3);
            }
            else
            {
                return(4);
            }
        }
Пример #4
0
        public static int CalculateVegetablesScore(AgricolaPlayer player)
        {
            var vegetables = player.Vegetables + player.Farmyard.PlantedResourceCount(Resource.Vegetables);

            // 165 - yoeman farmer
            if (vegetables == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (vegetables > 4)
            {
                return(4);
            }
            else
            {
                return(vegetables);
            }
        }
Пример #5
0
        public static int CalculatePasturesScore(AgricolaPlayer player)
        {
            var pastures = player.Farmyard.Pastures.Count();

            // 165 - yoeman farmer
            if (pastures == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (pastures > 4)
            {
                return(4);
            }
            else
            {
                return(pastures);
            }
        }
Пример #6
0
        /// <summary>
        /// Calculates a players score for fields
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public static int CalculateFieldsScore(AgricolaPlayer player)
        {
            var fields = player.Farmyard.FieldLocations.Count();

            // 165 - yoeman farmer
            if (fields < 2)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (fields < 5)
            {
                return(fields - 1);
            }
            else
            {
                return(4);
            }
        }
Пример #7
0
        /// <summary>
        /// Returns a card to its original source.  Major Improvements return to the major improvement deck,
        /// minor improvements and occupations are returned to their owners hand.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="id"></param>
        public void ReturnCard(AgricolaPlayer player, int id)
        {
            if (!player.OwnsCard(id))
            {
                return;
            }

            var card = GetCard(id);

            if (card is MajorImprovement)
            {
                AssignMajorImprovement(id, null);
                player.RemoveMajorImprovement(id);
            }
            else
            {
                player.ReturnCard(card);
            }
        }
Пример #8
0
        public static int CalculateSheepScore(AgricolaPlayer player)
        {
            var sheep = player.Farmyard.AnimalManager.GetAnimalCount(AnimalResource.Sheep);

            // 165 - yoeman farmer
            if (sheep == 0)
            {
                return(player.OwnsCard(165) ? 0 : -1);
            }
            else if (sheep < 4)
            {
                return(1);
            }
            else if (sheep < 6)
            {
                return(2);
            }
            else if (sheep < 8)
            {
                return(3);
            }
            return(4);
        }