예제 #1
0
        private PartialGameUpdate BuildPartialUpdate(AgricolaPlayer player, GameAction action)
        {
            var update = new PartialGameUpdate();

            ((PartialGameUpdate)update).ActivePlayerName = players[ActivePlayerIndex].Name;
            ((PartialGameUpdate)update).AddAction(action);
            ((PartialGameUpdate)update).AddPlayer(player);
            ((PartialGameUpdate)update).Interrupt = Interrupt;

            if (action is ImprovementAction || action is RenovationAction)
            {
                ((PartialGameUpdate)update).AddMajorImprovementOwners(MajorImprovementOwners);
            }

            if (newReservedResourcesAdded)
            {
                newReservedResourcesAdded = false;
                ((PartialGameUpdate)update).ReservedResources = ReservedResources;
            }

            if (action is StartingPlayerAction)
            {
                ((PartialGameUpdate)update).StartingPlayerName = StartingPlayerName;
            }

            return(update);
        }
예제 #2
0
        public bool CompleteHarvest(AgricolaPlayer player, HarvestData data, out IClientGameUpdate update, out List <GameActionNotice> notices)
        {
            if (Mode == GameMode.Harvest && player.Harvesting && CanCompleteHarvest(player, data))
            {
                var conversions = data.FeedResources;
                var feedNotice  = new List <INoticePredicate>();
                int begAmount;
                player.FeedFamily(data.FeedResources, feedNotice, out begAmount);

                notices = new List <GameActionNotice>();
                ActionService.AssignAnimals(player, data.AnimalData, notices);

                UpdateScorecards();

                if (begAmount > 0)
                {
                    feedNotice.Add(new IdPredicate(begAmount));
                }

                notices.Add(new GameActionNotice(player.Name, NoticeVerb.Fed.ToString(), feedNotice));
                if (IsHarvestComplete())
                {
                    update = StartNextRound(notices);
                }
                else
                {
                    update = new PartialGameUpdate();
                    ((PartialGameUpdate)update).AddPlayer(player);
                }
                return(true);
            }

            update  = null;
            notices = null;
            return(false);
        }