Пример #1
0
 public void TakeOccupationAction(int actionId, OccupationActionData data)
 {
     TakeAction(actionId, data);
 }
Пример #2
0
        /// <summary>
        /// Puts an occupation into player for the given player. After all custom event triggers are fired,
        /// a PlayOccupationTrigger will be fired.
        /// </summary>
        /// <param name="player">The player who owns the occupation</param>
        /// <param name="eventTriggers">Any triggers that should be fired when this occupation is played</param>
        /// <param name="resultingNotices">A list of notices that should be sent to players</param>
        /// <param name="data">The data for the occupation being played</param>
        public static void PlayOccupation(AgricolaPlayer player, ImmutableList <GameEventTrigger> eventTriggers, List <GameActionNotice> resultingNotices, OccupationActionData data)
        {
            var card = ((AgricolaGame)player.Game).GetCard(data.Id.Value);
            var cost = Curator.GetOccupationCost(player, data.ActionId, data.Id.Value);

            foreach (var resource in cost)
            {
                player.AddResource(resource.Type, -resource.Count);
            }
            player.PlayCard(data.Id.Value);

            foreach (var evnt in card.OnPlayEvents)
            {
                evnt.Execute(player, null, card, resultingNotices);
            }

            resultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.PlayOccupation.ToString(), new IdPredicate(data.Id.Value)));

            CheckTriggers(player, eventTriggers, resultingNotices);


            var trigger = new PlayOccupationTrigger(card);

            ProcessEventTrigger(player, trigger, resultingNotices);
        }