public override void Resolve(ResolveParams rp)
        {
            //Generate Loot
            ResolveParams resolveParamsReward = rp;

            //Chance for a storage container
            if (Rand.Chance(0.3f))
            {
                resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateStorageBoxReward();
                resolveParamsReward.rect = new CellRect(rp.rect.minX + 3, rp.rect.minZ + 3, rp.rect.Width - 5, rp.rect.Height - 5);
                BaseGen.symbolStack.Push("storageBoxLGE", resolveParamsReward);
            }
            else
            {
                //Scattered Loot
                if (Rand.Chance(0.85f))
                {
                    resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateStockpileReward(0.28f);
                }
                else
                {
                    resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateWeaponsCacheReward(Rand.RangeInclusive(4, 5));
                }
                resolveParamsReward.rect.ContractedBy(1);
                BaseGen.symbolStack.Push("spawnStockpileLGE", resolveParamsReward);
            }

            //spawn empty room
            BaseGen.symbolStack.Push("emptyRoom", rp);

            //Clear out the entire rect (including roofs)
            rp.clearRoof = true;
            BaseGen.symbolStack.Push("clear", rp);
        }
        public override void Resolve(ResolveParams rp)
        {
            //Random chance for Danger
            if (Rand.Chance(0.9f))
            {
                if (rp.disableHives == false) //Meaning they should be active
                {
                    ResolveParams resolveParamsDanger = rp;
                    resolveParamsDanger.hivesCount = Rand.RangeInclusive(1, 2);
                    resolveParamsDanger.rect       = rp.rect.ContractedBy(1);
                    if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 4000f)
                    {
                        resolveParamsDanger.hivesCount = Rand.RangeInclusive(2, 3);
                    }
                    BaseGen.symbolStack.Push("hives", resolveParamsDanger);
                }
                else
                {
                    //MechanoidsSpawn
                    ResolveParams resolveParamsDanger = rp;
                    resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(3, 5);
                    resolveParamsDanger.rect            = rp.rect.ContractedBy(1);
                    if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 4000f)
                    {
                        resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(5, 7);
                    }
                    BaseGen.symbolStack.Push("randomMechanoidGroup", resolveParamsDanger);
                }
            }

            //Put in a storage container
            ResolveParams resolveParamsAncientStorage = rp;

            resolveParamsAncientStorage.rect = new CellRect(rp.rect.minX + 3, rp.rect.minZ + 3, rp.rect.Width - 6, rp.rect.Height - 5);
            //Reward Loot
            resolveParamsAncientStorage.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateStorageBoxReward();
            BaseGen.symbolStack.Push("storageBoxLGE", resolveParamsAncientStorage);

            ResolveParams resolveParamsCryoCaskets = rp;

            resolveParamsCryoCaskets.rect = rp.rect.ContractedBy(1);
            //We could steal from the SymbolResolver_Interior_AncientTemple here and include rewards and/or dangers
            BaseGen.symbolStack.Push("ancientShrinesGroup", resolveParamsCryoCaskets);

            //spawn empty room
            BaseGen.symbolStack.Push("emptyRoom", rp);

            //Clear out the entire rect (including roofs)
            rp.clearRoof = true;
            BaseGen.symbolStack.Push("clear", rp);
        }
        public static List <Thing> GenerateInterceptedMessageReward()
        {
            List <Thing> returnList = new List <Thing>();

            if (Rand.Chance(0.60f)) //0.65 usually
            {
                returnList = RewardGeneratorUtilityLGE.GenerateStockpileReward(0.20f);
            }
            else
            {
                if (Rand.Chance(0.5f)) //0.5 usually
                {
                    returnList = RewardGeneratorUtilityLGE.GenerateWeaponsCacheReward(Rand.RangeInclusive(3, 4));
                }
                else
                {
                    returnList = RewardGeneratorUtilityLGE.GenerateApperalReward(Rand.RangeInclusive(3, 4));
                }
            }

            return(returnList);
        }
        public override void Resolve(ResolveParams rp)
        {
            //Danger Spawn
            if (rp.disableHives == false) //Meaning they should be active
            {
                ResolveParams resolveParamsDanger = rp;
                resolveParamsDanger.hivesCount = Rand.RangeInclusive(1, 2);
                resolveParamsDanger.rect       = rp.rect.ContractedBy(1);
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 2500f)
                {
                    resolveParamsDanger.hivesCount = Rand.RangeInclusive(1, 3);
                }
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 4500f)
                {
                    resolveParamsDanger.hivesCount = Rand.RangeInclusive(2, 3);
                }
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 7000f)
                {
                    resolveParamsDanger.hivesCount = Rand.RangeInclusive(3, 4);
                }
                BaseGen.symbolStack.Push("hives", resolveParamsDanger);
            }
            else
            {
                //MechanoidsSpawn
                ResolveParams resolveParamsDanger = rp;
                resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(2, 4);
                resolveParamsDanger.rect            = rp.rect.ContractedBy(1);
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 2500f)
                {
                    resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(3, 5);
                }
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 4500f)
                {
                    resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(4, 7);
                }
                if (StorytellerUtility.DefaultThreatPointsNow(Find.World) > 7000f)
                {
                    resolveParamsDanger.mechanoidsCount = Rand.RangeInclusive(6, 10);
                }
                BaseGen.symbolStack.Push("randomMechanoidGroup", resolveParamsDanger);
            }

            //Generate Loot
            ResolveParams resolveParamsReward = rp;

            //Chance for a storage container
            if (Rand.Chance(0.9f))
            {
                resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateStorageBoxReward();
                resolveParamsReward.rect = new CellRect(rp.rect.minX + 3, rp.rect.minZ + 3, rp.rect.Width - 5, rp.rect.Height - 5);
                BaseGen.symbolStack.Push("storageBoxLGE", resolveParamsReward);
            }
            else
            {
                //Scattered Loot
                if (Rand.Chance(0.85f))
                {
                    resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateStockpileReward(0.28f);
                }
                else
                {
                    resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateWeaponsCacheReward(Rand.RangeInclusive(4, 5));
                }
                resolveParamsReward.rect.ContractedBy(1);
                BaseGen.symbolStack.Push("spawnStockpileLGE", resolveParamsReward);
            }

            //spawn empty room
            BaseGen.symbolStack.Push("emptyRoom", rp);

            //Clear out the entire rect (including roofs)
            rp.clearRoof = true;
            BaseGen.symbolStack.Push("clear", rp);
        }
        public override void Resolve(ResolveParams rp)
        {
            Map     map  = BaseGen.globalSettings.map;
            IntVec3 root = IntVec3Utility.ToIntVec3(rp.rect.CenterVector3);
            IntVec3 motherVec;

            CellFinder.TryFindRandomCellNear(root, map, 3, (IntVec3 x) => x.Standable(map) && map.fertilityGrid.FertilityAt(x) > ThingDefOf.Plant_Ambrosia.plant.fertilityMin, out motherVec);
            float eventPoints = StorytellerUtility.DefaultThreatPointsNow(Find.World) * 0.6f;

            if (eventPoints > 4000f)
            {
                eventPoints *= 0.9f;
                if (eventPoints > 7000f)
                {
                    eventPoints = 7000f;
                }
            }
            if (eventPoints < 400f)
            {
                eventPoints = 400f;
            }

            foreach (IntVec3 vec in rp.rect)
            {
                if (map.terrainGrid.TerrainAt(vec).fertility < 0.7f)
                {
                    if (Rand.Chance(0.5f))
                    {
                        map.terrainGrid.SetTerrain(vec, TerrainDefOf.Gravel);
                    }
                }
            }

            //spawn mother plant
            MotherAmbrosiaLGE motherAmbrosia = (MotherAmbrosiaLGE)GenSpawn.Spawn(DefsOfLGE.Plant_MotherAmbrosiaLGE, motherVec, map, WipeMode.Vanish);

            motherAmbrosia.Growth = Rand.Range(0.9f, 0.98f);

            PawnKindDef animalKind;

            (from k in map.Biome.AllWildAnimals
             where Find.World.tileTemperatures.SeasonAndOutdoorTemperatureAcceptableFor(map.Tile, k.race)
             select k).TryRandomElement(out animalKind);
            if (animalKind == null)
            {
                animalKind = ThingDefOfVanilla.Warg;
            }
            motherAmbrosia.SpawnAnimals(animalKind, eventPoints);


            int randomInRange = (int)(eventPoints / 80);//SymbolResolver_AmbrosiaAnimalsLGE.CountRange.RandomInRange;

            for (int i = 0; i < randomInRange; i++)
            {
                IntVec3 intVec;
                if (!CellFinder.TryRandomClosewalkCellNear(motherVec, map, SpawnRadius, out intVec, (IntVec3 x) => this.CanSpawnAt(x, map)))
                {
                    break;
                }
                Plant plant = intVec.GetPlant(map);
                if (plant != null)
                {
                    plant.Destroy(DestroyMode.Vanish);
                }
                Plant ambrosia = (Plant)GenSpawn.Spawn(ThingDefOf.Plant_Ambrosia, intVec, map, WipeMode.Vanish);
                ambrosia.Growth = Rand.Range(0.6f, 0.95f);
            }

            //Spawn ambrosia reward
            ResolveParams resolveParamsReward = rp;

            resolveParamsReward.rect = CellRect.CenteredOn(motherVec, SpawnRadius - 2);
            resolveParamsReward.stockpileConcreteContents = RewardGeneratorUtilityLGE.GenerateAmbrosia((int)(eventPoints / 150f));
            BaseGen.symbolStack.Push("spawnStockpileLGE", resolveParamsReward);
        }
Ejemplo n.º 6
0
 protected List <Thing> GenerateReward()
 {
     return(RewardGeneratorUtilityLGE.GenerateInterceptedMessageReward());
 }