Example #1
0
        public bool CanBuild(Architecture a)
        {
            if (this.PositionOccupied > 0 && a.FacilityPositionCount == 0)
            {
                return(false);
            }
            if (!(!this.PopulationRelated || a.Kind.HasPopulation))
            {
                return(false);
            }
            if (a.BelongedFaction != null &&
                a.BelongedFaction.TechniquePoint + a.BelongedFaction.TechniquePointForFacility + a.BelongedFaction.TechniquePointForTechnique < this.PointCost)
            {
                return(false);
            }
            if (this.TechnologyNeeded > a.Technology)
            {
                return(false);
            }
            if (!Condition.CheckConditionList(this.Conditions.Conditions.Values, a))
            {
                return(false);
            }
            if (this.ArchitectureLimit < 9999 && a.GetFacilityKindCount(this.ID) >= this.ArchitectureLimit)
            {
                return(false);
            }
            if (a.BelongedFaction != null && this.FactionLimit < 9999 && a.BelongedFaction.GetFacilityKindCount(this.ID) >= this.FactionLimit)
            {
                return(false);
            }

            return(true);
        }