Ejemplo n.º 1
0
 /// <summary>
 /// Called when a player attempts to use this action.
 /// The default behavior checks if the action is open and the player
 /// has a family member to place.
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public Boolean TryExecute(AgricolaPlayer player, GameActionData data, out GameAction updatedAction)
 {
     if (CanExecute(player, data))
     {
         if (ResultingNotices != null)
         {
             ResultingNotices.Clear();
         }
         updatedAction = OnExecute(player, data);
         return(true);
     }
     updatedAction = this;
     return(false);
 }
Ejemplo n.º 2
0
        public override GameAction OnExecute(AgricolaPlayer player, Data.GameActionData data)
        {
            base.OnExecute(player, data);

            player.AddFamilyMember();
            AddUser(player);    // Add the baby to the action display

            ResultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.GrowFamily.ToString()));

            if (mode == FamilyGrowthActionMode.Improvement && ((FamilyGrowthActionData)data).ImprovementData != null)
            {
                ActionService.BuyImprovement(player, ((FamilyGrowthActionData)data).ImprovementData, ResultingNotices);
            }

            return(this);
        }
Ejemplo n.º 3
0
        public override GameAction OnExecute(AgricolaPlayer player, Data.GameActionData data)
        {
            base.OnExecute(player, data);

            var occupationData = (OccupationActionData)data;

            if (occupationData.FamilyGrowth)
            {
                player.AddFamilyMember();
                AddUser(player);    // Add the baby to the action display

                ResultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.GrowFamily.ToString()));
            }
            else
            {
                var triggers = new List <GameEventTrigger>();
                triggers.AddRange(eventTriggers);
                triggers.Add(new TakeOccupationActionTrigger());
                ActionService.PlayOccupation(player, ImmutableList.Create <GameEventTrigger>(triggers.ToArray()), ResultingNotices, occupationData);
            }
            return(this);
        }