Пример #1
0
        public float GetScoreOfResourceNode(
            IResourceNode node, IEnumerable <ITechDefinition> availableTechs
            )
        {
            if (node == null)
            {
                return(0f);
            }

            if (TechCanon.GetDiscoveredResourcesFromTechs(availableTechs).Contains(node.Resource))
            {
                return(node.Resource.Type != ResourceType.Bonus ? node.Resource.Score * node.Copies : 0);
            }
            else
            {
                return(0f);
            }
        }
Пример #2
0
        public YieldSummary GetYieldEstimateForCell(
            IHexCell cell, IEnumerable <ITechDefinition> availableTechs
            )
        {
            var improvementModifications = new HashSet <IImprovementModificationData>(availableTechs.SelectMany(tech => tech.ImprovementYieldModifications));
            var visibleResources         = new HashSet <IResourceDefinition>         (TechCanon.GetDiscoveredResourcesFromTechs(availableTechs));
            var availableImprovements    = new HashSet <IImprovementTemplate>        (TechCanon.GetAvailableImprovementsFromTechs(availableTechs));
            var availableBuildings       = new HashSet <IBuildingTemplate>           (TechCanon.GetAvailableBuildingsFromTechs(availableTechs));

            return(GetYieldEstimateForCell(
                       cell,
                       new CachedTechData()
            {
                ImprovementModifications = improvementModifications,
                VisibleResources = visibleResources,
                AvailableImprovements = availableImprovements,
                AvailableBuildings = availableBuildings
            }
                       ));
        }