public override bool CanExecute(AgricolaPlayer player, GameActionData data)
        {
            if (!base.CanExecute(player, data))
            {
                return(false);
            }

            if (Mode == BuildingResourcesActionMode.DoubleResourceOrFamilyGrowth && ((BuildingResourcesActionData)data).Growth == true)
            {
                if (Game.CurrentRound < 5 || !Curator.CanGrowFamily(player))
                {
                    return(false);
                }
            }
            else
            {
                if (!((BuildingResourcesActionData)data).Resource1.HasValue)
                {
                    return(false);
                }

                if (Mode == BuildingResourcesActionMode.DoubleResource || Mode == BuildingResourcesActionMode.DoubleResourceOrFamilyGrowth)
                {
                    if (!((BuildingResourcesActionData)data).Resource2.HasValue)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Example #2
0
        public override bool CanExecute(AgricolaPlayer player, Data.GameActionData data)
        {
            if (!base.CanExecute(player, data))
            {
                return(false);
            }

            var fgData = (FamilyGrowthActionData)data;

            if (!Curator.CanGrowFamily(player, mode == FamilyGrowthActionMode.WithoutSpace))
            {
                return(false);
            }

            if (mode == FamilyGrowthActionMode.Improvement &&
                fgData.ImprovementData != null &&
                !ActionService.CanBuyImprovement(player, fgData.ImprovementData))
            {
                return(false);
            }

            if (player.FamilySize == 5)
            {
                return(false);
            }

            return(true);
        }