예제 #1
0
        public static bool CanPlayOccupation(AgricolaPlayer player, int actionId, int cardId)
        {
            var card = ((AgricolaGame)player.Game).GetCard(cardId);

            if (!player.HandOccupations.Contains(card))
            {
                return(false);
            }

            ResourceCache[] costs = Curator.GetOccupationCost(player, actionId, cardId);
            if (!player.CanAfford(costs) || !card.PrerequisitesMet(player))
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        /// <summary>
        /// Checks that the requested rooms are valid.
        /// </summary>
        /// <param name="player"></param>
        /// <param name="rooms"></param>
        /// <returns></returns>
        public static bool CanBuildRooms(AgricolaPlayer player, int actionId, ImmutableArray <int> rooms)
        {
            var costs = Curator.GetRoomsCosts(player, actionId, rooms.Length);

            return(player.CanAfford(costs) && player.Farmyard.IsValidRoomLocations(rooms));
        }
예제 #3
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));
        }