Example #1
0
        private List <AbstractDefenderForcesGenerator> GeneratorsForBlueprint(Blueprint bp, RealRuinsPOIComp poiComp, Faction faction)
        {
            List <AbstractDefenderForcesGenerator> result = new List <AbstractDefenderForcesGenerator>();

            Debug.Log(Debug.Scatter, "Selecting force generators");
            //override forces for any kind of POI if no faction selected
            if (faction == null || (POIType)poiComp.poiType == POIType.Ruins)
            {
                if (Rand.Chance(0.25f))
                {
                    result.Add(new AnimalInhabitantsForcesGenerator());
                }
                else if (Rand.Chance(0.333f))
                {
                    result.Add(new MechanoidsForcesGenerator(0));
                }
                else if (Rand.Chance(0.5f))
                {
                    result.Add(new CitizenForcesGeneration(1000, Find.FactionManager.RandomEnemyFaction(true, true, false)));
                }
                Debug.Log(Debug.Scatter, "Selected {0} for abandoned or ruins", result.Count);
                return(result);
            }

            switch ((POIType)poiComp.poiType)
            {
            case POIType.MilitaryBaseSmall:
            case POIType.MilitaryBaseLarge:
            case POIType.Stronghold:
            case POIType.Outpost:
                result.Add(new MilitaryForcesGenerator(poiComp.militaryPower));
                break;

            case POIType.Camp:
            case POIType.City:
            case POIType.Factory:
            case POIType.PowerPlant:
            case POIType.Research:
                result.Add(new CitizenForcesGeneration(poiComp.bedsCount));
                if (bp.totalCost > 50000 || bp.totalCost > 10000 && (poiComp.bedsCount < 6))
                {
                    result.Add(new MilitaryForcesGenerator(3));
                }
                break;

            case POIType.Storage:
                if (bp.totalCost > 30000)
                {
                    result.Add(new MilitaryForcesGenerator(2));
                }
                else
                {
                    result.Add(new CitizenForcesGeneration(poiComp.bedsCount));
                }
                break;

            case POIType.Ruins:
            default:
                if (Rand.Chance(0.5f))
                {
                    result.Add(new MechanoidsForcesGenerator(0));
                }
                break;
            }
            Debug.Log(Debug.Scatter, "Selected {0} for POIs", result.Count);
            return(result);
        }