Example #1
0
        /// <summary>
        /// Pays for and builds the requested stables
        /// </summary>
        /// <param name="player"></param>
        /// <param name="stables"></param>
        /// <param name="actionId"></param>
        /// <param name="resultingNotices"></param>
        public static void BuildStables(AgricolaPlayer player, ImmutableArray <int> stables, int actionId, List <GameActionNotice> resultingNotices)
        {
            var costs = Curator.GetStablesCosts(player, actionId, stables.Length);

            player.PayCosts(costs);

            foreach (var stable in stables)
            {
                player.AddStable(stable);
            }

            player.UpdateAnimalManager();
            resultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.Build.ToString(), new BuildPredicate(stables.Length, Buildable.Stable)));
        }
Example #2
0
        /// <summary>
        /// Checks that the requested build stable data is valid.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="stables"></param>
        /// <param name="actionId"></param>
        /// <returns></returns>
        public static bool CanBuildStables(AgricolaPlayer player, ImmutableArray <int> stables, int actionId)
        {
            var costs = Curator.GetStablesCosts(player, actionId, stables.Length);

            return(player.CanAfford(costs) && player.Farmyard.IsValidStablesLocations(stables));
        }