Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        public override GameAction OnExecute(AgricolaPlayer player, GameActionData data)
        {
            base.OnExecute(player, data);

            if (Mode == BuildingResourcesActionMode.DoubleResourceOrFamilyGrowth && ((BuildingResourcesActionData)data).Growth == true)
            {
                player.AddFamilyMember();
                AddUser(player);    // Add the baby to the action display

                this.ResultingNotices.Add(new GameActionNotice(player.Name, NoticeVerb.GrowFamily.ToString()));
            }
            else
            {
                var resource1 = ((BuildingResourcesActionData)data).Resource1;
                var resource2 = ((BuildingResourcesActionData)data).Resource2;

                switch (Mode)
                {
                case BuildingResourcesActionMode.SingleResource:
                    ActionService.AssignCacheResource(player, eventTriggers, ResultingNotices, new ResourceCache(resource1.Value, 1));
                    break;

                case BuildingResourcesActionMode.SingleResourceWithFood:
                    ActionService.AssignCacheResources(player,
                                                       eventTriggers, ResultingNotices,
                                                       new ResourceCache[] {
                        new ResourceCache(resource1.Value, 1),
                        new ResourceCache(Resource.Food, 1)
                    });
                    break;

                case BuildingResourcesActionMode.DoubleResource:
                case BuildingResourcesActionMode.DoubleResourceOrFamilyGrowth:
                    ActionService.AssignCacheResources(player, eventTriggers, ResultingNotices,
                                                       new ResourceCache[] {
                        new ResourceCache(resource1.Value, 1),
                        new ResourceCache(resource2.Value, 1)
                    });
                    break;
                }
            }

            return(this);
        }
Exemplo 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);
        }